Offline installation of packages

From ParabolaWiki
Jump to: navigation, search

1 Normal Method: Pacman

This method is based on byte's post (Arch user) from this thread.

Download the package databases on a computer with internet access and transfer them to your computer.

For i686:

For x86_64:

For arvm7h:

Following steps will make sure you're working with up-to-date package lists, as if you ran pacman -Sy.

On offline PC , do the following as root:

mkdir -p /var/lib/pacman/sync/{libre,core,extra,community,multilib}
rm -r /var/lib/pacman/sync/{libre,core,extra,community}/*
tar -xzf libre.db.tar.gz     -C /var/lib/pacman/sync/libre
tar -xzf core.db.tar.gz      -C /var/lib/pacman/sync/core
tar -xzf extra.db.tar.gz     -C /var/lib/pacman/sync/extra
tar -xzf community.db.tar.gz -C /var/lib/pacman/sync/community
tar -xzf multilib.db.tar.gz  -C /var/lib/pacman/sync/multilib
rm -r /var/lib/pacman/sync/*.db
cp libre.db /var/lib/pacman/sync/
cp core.db /var/lib/pacman/sync/
cp extra.db /var/lib/pacman/sync/
cp community.db /var/lib/pacman/sync/
cp multilib.db /var/lib/pacman/sync/
pacman -Sp --noconfirm package-name > pkglist
Tip: Be aware you have enabled at least one of the servers defined in the /etc/pacman.d/mirrorlist file. Otherwise all what you get is a misleading error message:

error: no database for package: package-name

To update a New Parabola base system after installation you may enter

pacman -Sup --noconfirm > pkglist

Now open that textfile with an editor and delete all lines that are not URLs. Next, bring that list with you to a place where you have internet and either download the listed packages manually or do

wget -nv -i ../pkglist

in an empty directory. Take all the *.pkg.tar.gz files back home, put them in /var/cache/pacman/pkg and finally run

pacman -S package-name

1.1 A simple example

This is a simple way to install a package you have downloaded

 pacman -U /root/Download/packagename.tar.gz

This is how to install several packages you have installed into a directory

 pacman -U /root/Download/*.tar.gz

1.2 A slightly contrived example

Scenario: you have two Parabola machines, 'Al' (with internet connection) and 'Bob' (without internet connection), and you need to install some mesa packages and their dependencies on 'Bob'. Let's say the wanted packages are mesa, mesa-libcl and opencl-mesa, but you want to use a dedicated directory instead of /var/cache/pacman/pkg/ and a dedicated repository called mesa (instead of the usual libre, core, extra etc...)

1.2.1 Generate a list of packages to download

This can be done on any Parabola machine which has up-to-date repository data bases (see above for links to database files); to create the list of links to the required packages, use:

pacman -Sp mesa mesa-libcl opencl-mesa > /path/to/mesa.list

The file mesa.list will contain links to the listed packages and any others which they depend on which are not already installed on Al. Unless you have cleared your cache the packages you have installed will be in your cache location. You can check /etc/pacman.conf for the location. It is probably something like /var/cache/pacman/pkg/

1.2.2 Download/copy the packages and their dependencies

Obviously this requires an internet connection, so on 'Al' create a directory called /path/to/mesa for the files and run:

wget -P /path/to/mesa/ -i /path/to/mesa.list

Then copy the dependencies you have already installed from the cache. Either find them manually by browsing or if the total size of all your packages is not too large just copy them all

cp /var/cache/pacman/pkg/* /path/to/mesa/

1.2.3 Create a repository database just for these packages

This can be done on either 'Al' or 'Bob' using the repo-add command which comes with pacman (from version 3?); first, change to the /path/to/mesa directory where the packages were downloaded, then create database file called mesa.db.tar.gz:

cd /path/to/mesa
repo-add mesa.db.tar.gz *.pkg.tar.xz

1.2.4 Transfer the packages

Now all the packages have been downloaded, you do not need 'Al' anymore. Copy the contents of /path/to/mesa to a the temporary mesa packages cache directory on 'Bob', let's say this folder is called /home/me/mesa:

cp /path/to/mesa/* /home/me/mesa

Next, pacman must be made aware of this new repository of packages. First copy your current pacman.conf

cp /etc/pacman.conf /etc/pacman.conf.old

Now in /etc/pacman.conf make sure that your SigLevel is set to Never as your repository will not provide signatures

SigLevel = Never

and add the following lines at the bottom of pacman.conf:

Server = file:///home/me/mesa

You may also need to comment out the other repositories so stale defaults do not cause failed attempts to download from online Now, instruct pacman to synchronise with the dedicated mesa repository we created:

pacman -Sy 

This command finds the mesa.db.tar.gz file in /home/me/mesa and expands it to /var/lib/pacman/sync/mesa to create a database of packages contained in the mesa repository.

1.2.5 Install the packages

Finally install the packages:

pacman -S mesa mesa-libcl opencl-mesa

1.3 Restoring online sources

Should Bob ever be put online we can restore access to the online sources by replacing /etc/pacman.conf with the previously created /etc/pacman.conf.old

1.3.1 Links and sources

Compiled from the forums, with thanks to Heller_Barbe and byte

2 Simpler Method: Powerpill Portable

Powerpill Portable is a tool created by Xyne to simplify offline updates. It has the following requirements:

Warning: Powerpill development has been officially discontinued: its latest version does not work with pacman>=3.5. See [1].

2.1 Requirements

2.1.1 Unconnected Computer

  • powerpill
  • rsync

2.1.2 Connected Computer

  • perl
  • aria2

The connected computer does not need to be running Parabola or have Pacman installed.

2.2 Steps

An enumerated list of steps can be found here.

Basically, simply download the Powerpill Portable script and run it on the unconnected computer. It will create a directory named "portable" and copy some files into it (the local database and everything needed to run powerpill-portable on another system, minus perl itself and aria2). Simply take the directory to the connected computer (e.g. on a USB stick) and run the "pp" script in it on that system as though it were pacman, e.g. "pp -Syu foo bar". It will download the databases and packages into the portable directory. When you're done, bring the directory back to your unconnected computer, run the "sync" script in the portable directory, then simply run the same command(s) that you ran with pp using pacman, e.g. "pacman -Syu foo bar".

Your system is now up-to-date. Simply repeat the steps to keep it that way.

3 Acknowledgement

This wiki article is based on ArchWiki. We may have removed non-FSDG bits from it.