Install Package From Usb Ubuntu

The following article describes how to install Ubuntu from a USB flash drive if there is no CD or DVD drive available. The USB flash drive used is prepared under. Ubuntu has a lot of GUI-based methods for installing applications, but they take some time to search and find. Since the keyboard is usually faster than the mouse, managing your software via the command-line can be a real time-saver. Linux manages software through packages, individual units of software that contain user interfaces, modules,.

A while ago, we discussed how to Install Softwares offline in Ubuntu. In that guide, we explained how can you download packages in an Internet-enabled system, and install them in another system that has slow or no Internet connection. In this tutorial, we will see how to download packages with dependencies locally in Ubuntu and its derivatives.

Using this method, we can download a .DEB package along with all required dependencies without actually installing it. This way we can download packages from one system and install them later in the same system itself or any other system that has no Internet connection. We can also download packages for different architecture systems. For example, it is possible to download the 32 bit packages from a 64 bit system and vice versa.

Download Packages With Dependencies Locally In Ubuntu

We can do this in two methods. I tested this guide on Ubuntu 16.04 and 18.04 LTS desktop editions. It worked just fine as described below.

Method 1:

This is the simplest and straight-forward method than other other methods given below.

To download a package with all dependencies, without installing them, just run:

For instance, let us download the Vim package with all required dependencies, without installing them, using command:

Sample output:

As you see in the above output, we have downloaded Vim package will all dependencies, but we didn’t actually install it.

All downloaded files will be saved in /var/cache/apt/archives directory.

Just copy the entire cache folder on any USB or transfer them via network to a system that you wanted to install the packages in it.

To install the downloaded packages, go to the cache folder and install them as shown below.

See? It’s that simple!

However, this method only works if the system that you use to download the packages does not have the main package or its dependencies installed locally.

If you try to download a package which is already installed in the same system itself, you will see an output like below.

In such cases, use “apt-rdepends” to download all packages. If apt-rdepends is not installed yet, install it using command:

And then download the main package (i.e. Vim in our case) along with all dependencies using command:

This command will recursively download all required packages.

Just in case if you encountered with an error like below:

Try this command instead:

This command will download Vim with all needed packages and save them in the current working directory. Spiderman 2000 pc iso download.

To install all downloaded packages, run:

Method 2:

First, download the dependencies of the package you wanted to download.

To display list of all dependencies of a package, for example Python, run:

Sample output:

Let us download python package with its dependencies to our local disk.

To do so, first create a directory to save the packages.

Go to the directory:

And then run:

The above command will download Python package along with all required dependencies and saves them in the current working directory. This command will also save any errors in the errors.txt file.

Let us view the downloaded files using ‘ls’ command:

Sample output:

As you see in the above output, python package with all its dependencies has been downloaded.

Just copy them to your USB drive and install the python packages on any offline system as shown below.

Mount the USB drive, go to the location where you have mounted the drive, and run the following command to install Python.

Suggested Read :

Download packages with dependencies locally for a specific architecture

You might notice that the above command has downloaded the 64 bit packages. It is because I am downloading them from the 64-bit Ubuntu system. What if you want to download packages for 32-bit arch systems? It’s also possible!

First, enable the architecture you want in your Ubuntu system using command:

If you don’t add the architecture, you will get the following error message when try to download the packages.

After enabling the Architecture of your choice, run the following command to download specific architecture related packages.

As you see in the above output, I have added the architecture ‘i386’ with ‘apt-cache’ command.

Sample output:

Let us check the downloaded packages.

Sample output:

See? The above command downloaded the 32 bit packages only.

Recommended read:

You know now how to download packages with dependencies in Ubuntu systems. This method is same for all DEB-based systems. Hope this helps.

Thanks for stopping by!

Help us to help you:

  • Subscribe to our Email Newsletter : Sign Up Now
  • Support OSTechNix : Donate Via PayPal
  • Download free E-Books and Videos : OSTechNix on TradePub
  • Connect with us: RedditFacebookTwitterLinkedInRSS feeds

Have a Good day!!

Share