Powered By

Powered by Blogger

Minggu, 22 November 2009

Get A List Of Packages And Dependencies For Offline Installation [Ubuntu]

Some people do not have a permanent access to the Internet or the connection is limited; as an example, a friend can't download files larger than 10 mb. So how to install applications offline, in Ubuntu? Obviously, the packages have to be downloaded from another computer but this should include all the dependencies or else it would be useless.

The answer is a simple command:

sudo apt-get --print-uris --yes install PACKAGE_NAME | grep ^\' | cut -d\' -f2 >mydownload.txt


Where PACKAGE_NAME is the application you want to install and "mydownload.txt" is the output text file.

Basically, this command does not install the application, but creates a text file with the download URL for the application you want to install AND all its dependencies.

You can then download all the files from another computer, by using a download manager which supports downloading a list of urls from a file, or if you have access to another Linux machine, simply run this command to download all the packages:
wget --input-file mydownload.txt

The last (and worst) solution would be to enter each URL in a web browser and download them manually.

In case you did not understand how the command works, here is an example. To get a file with all the urls for the packages needed to install OpenOffice.org, you would run this in a terminal:
sudo apt-get --print-uris --yes install openoffice.org | grep ^\' | cut -d\' -f2 >mydownload.txt


The following URLs will then be written inside the mydownload.txt file:
http://archive.ubuntu.com/ubuntu/pool/main/o/openoffice.org/openoffice.org-filter-binfilter_3.1.1-5ubuntu1_i386.deb
http://archive.ubuntu.com/ubuntu/pool/main/libs/libservlet2.4-java/libservlet2.4-java_5.0.30-8ubuntu3_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/h/hsqldb/libhsqldb-java_1.8.0.10-2ubuntu1_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/o/openoffice.org/openoffice.org-java-common_3.1.1-5ubuntu1_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/o/openoffice.org/openoffice.org-base_3.1.1-5ubuntu1_i386.deb
http://archive.ubuntu.com/ubuntu/pool/main/o/openoffice.org/openoffice.org-report-builder-bin_3.1.1-5ubuntu1_i386.deb
http://archive.ubuntu.com/ubuntu/pool/main/t/ttf-dejavu/ttf-dejavu-extra_2.29-2_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/t/ttf-dejavu/ttf-dejavu_2.29-2_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/o/openoffice.org/openoffice.org-officebean_3.1.1-5ubuntu1_i386.deb
http://archive.ubuntu.com/ubuntu/pool/main/o/openoffice.org/openoffice.org-filter-mobiledev_3.1.1-5ubuntu1_all.deb
http://archive.ubuntu.com/ubuntu/pool/main/o/openoffice.org/openoffice.org_3.1.1-5ubuntu1_i386.deb


Once you have the packages and dependencies on the computer with no, or limited internet access, simply copy all of them in a new folder and run this command:
sudo dpkg -i *.deb

This will install all the .deb files.

Please note: the computer on which you need to install the files needs to have an internet connection from time to time, to be able to update the package list (sudo apt-get update) so you'll be able to download the latest files.

Important: the mydownload.txt file will be empty if you run this command for an application which is already installed and up to date! Also, you have to create the list on the machine where you want the packages to be installed, otherwise some dependencies will not be displayed if they are already installed on that machine but not on yours.

Tidak ada komentar:

Posting Komentar