- Offline installation of packages
- Contents
- Install from file: pacman -U
- Offline cache
- Local repository
- Generate a list of packages to download
- Download/copy the packages and their dependencies
- Create a repository database just for these packages
- Transfer the packages
- Install the packages
- Restoring online sources
- Links and sources
- How to Install Packages on Arch Linux
- 1) Installing Packages on Arch Linux using Pacman
- 2) Installing Packages on Arch Linux using yaourt
- 3) Installing Packages on Arch Linux using packer
- 4) Installing Packages on Arch Linux using aurman
- Reinstall All Packages with Pacman on Arch Linux
- Reinstallation Fixes Missing Files
- Creating a Script for Reinstalling All the Packages
- Reinstalling All the Packages When You Can Boot Into your Arch Linux System
- Reinstalling All the Packages When You Can’t Boot into Your Arch Linux System
Offline installation of packages
This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
From time to time you might end up with a copy of Arch Linux on an offline computer and want to install packages for it.
Contents
Install from file: pacman -U
The Pacman -U command installs packages from the provided paths, and is probably what you are looking for in casual use cases.
For one package:
For several packages:
Offline cache
You can stuff things into /var/lib/pacman/sync and /var/cache/pacman/pkg to make pacman think it has everything it needs to do searches, updates, and installs. This method is based on byte’s post from this thread.
Download the package databases on a computer with internet access and transfer them to your computer. If needed, change MIRROR to any mirror from the mirror status list.
Following steps will make sure you are working with up-to-date package lists, as if you ran pacman -Sy .
After transferring the *.db files to the offline PC, do the following:
To update a New Arch Linux base system after installation you may enter
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 run wget in an empty directory:
Take all the *.pkg.tar.gz files back home, put them in /var/cache/pacman/pkg and finally run
Local repository
Scenario: you have two Arch Linux machines, ‘Al’ (with internet connection) and ‘Bob’ (without internet connection), and you need to install some NVIDIA packages and their dependencies on ‘Bob’. In this example, the wanted packages are nvidia , nvidia-utils , and xf86-video-nouveau , but you want to use a dedicated directory instead of /var/cache/pacman/pkg/ and a dedicated repository called nvidia (instead of the usual core, extra etc. )
Generate a list of packages to download
This can be done on any Arch Linux 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:
The file nvidia.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/ .
Download/copy the packages and their dependencies
Obviously this requires an internet connection, so on ‘Al’ create a directory called /path/to/nvidia for the files and run:
Then copy the dependencies you have already installed from the cache. Either find them manually by browsing https://archlinux.org/packages/ or if the total size of all your packages is not too large just copy them all
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/nvidia directory where the packages were downloaded, then create database file called nvidia.db.tar.gz :
Transfer the packages
Now all the packages have been downloaded, you do not need ‘Al’ anymore. Copy the contents of /path/to/nvidia to a the temporary NVIDIA packages cache directory on ‘Bob’. In this example, this folder is called /home/me/nvidia :
Next, pacman must be made aware of this new repository of packages. First copy your current pacman.conf :
Now in /etc/pacman.conf make sure that your SigLevel is set to Never as your repository will not provide signatures
and add the following lines at the bottom of pacman.conf :
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 synchronize with the dedicated NVIDIA repository we created:
This command finds the nvidia.db.tar.gz file in /home/me/nvidia and expands it to /var/lib/pacman/sync/nvidia to create a database of packages contained in the NVIDIA repository.
Install the packages
Finally install the packages:
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 .
Links and sources
Compiled from the forums, with thanks to Heller_Barbe and byte
Источник
How to Install Packages on Arch Linux
Arch Linux is one of the popular Desktop Operating systems. Its main pros revolve around large community and thousands of packages that can be installed on Arch Linux, both from official repositories and from AUR. In this tutorial, we will cover how to install packages on Arch Linux. Some of the installation methods we will look at include:
- Installing packages using official Arch package manager — Pacman
- Installing packages from AUR
AUR is a community-driven repository for Arch Linux users. It was created with an intention to make it easy to share community packages in an organized manner. AUR contains package descriptions called PKGBUILDs which allow you to compile a package from source with makepkg.
For you to install a package on Arch Linux from AUR, you need a helper tool which automates the process of building and installing the package. In this tutorial, we’ll look at:
- Using Yaourt
- Using packer
- Using aurman
1) Installing Packages on Arch Linux using Pacman
Arch Linux comes with default package manager tool called Pacman which uses tar to package applications. Pacman works seamlessly with Arch Build System. To install a package with pacman, use -S option. The example below will install vlc and elinks packages on Arch using pacman:
Get details about installed package using -Qi
To remove the package, use -R option
2) Installing Packages on Arch Linux using yaourt
yaourt is a pacman wrapper with extended features and AUR support. The package can be installed using pacman, unlike other pacman wrappers which are mostly packages as AUR builds. yaourt depends on diffutils, pacman>=5.0, package-query>=1.8 and gettext.
Before you can install yaourt, you need to enable the use of community repos on Arch
Add below content:
-y option is used to sync package content list.
To install a package with AUR use:
You can then search for packages on AUR:
It will give you an easy way to install the package by picking a number on the list. Input package number on the list and press key.
3) Installing Packages on Arch Linux using packer
Packer is one of many pacman wrappers that can be used to install packages from AUR. To install packer on Arch Linux you can use another AUR helper like yaourt or build the package yourself. If you have yaourt already installed, install packer from it by running:
The —noconfirm is used to silence questions prompts. It will answer all for you.
The yaourt is available from official Arch repo. It can be installed with pacman:
Once the package has been installed, you can start using it to manage packages on Arch Linux. One advantage of packer over AUR is that it doesn’t need sudo privileges. You can do package installation and removal using your normal user account.
As an example, install elinks and vlc as we did with pacman using the commands:
If you want to upgrade all packages including ones from the AUR:
To remove a package, pass similar options as for pacman.
4) Installing Packages on Arch Linux using aurman
Aurman can be installed in two ways:
- Using another AUR helper — yaourt, pacaur e.t.c
- By manually building pkg.tar.xz and installing using pacman.
Install aurman from AUR with yaourt:
Install aurman by building pkg.tar.xz package
Installing a package manager is done by using below syntax:
In this blog post, we have covered different package management tools you can use on your Arch-based Linux distributions. This will work fine both for Desktop/Server centric Arch operating systems. For more command options, refer to each package official documentation. A great place for reference is Pacman Documentation.
Источник
Reinstall All Packages with Pacman on Arch Linux
Let’s say you have Arch Linux installed on your machine and it is fully functional. No problem here. Now imagine, you are playing with your Arch Linux system and accidentally deleted some of the system files and folders. You’re freaked out saying, ‘Oh no! I shouldn’t have played God with sudo’. Don’t freak out just yet. There may still be a chance you can fix that using Pacman. You can use Pacman package manager to reinstall all the system packages on your Arch Linux machine.
Another scenario may be, let’s say you did a full system upgrade. Everything went well. But once you reboot your system, it won’t start and you’re getting warnings that some files are missing. This can also be fixed by reinstalling all the packages on your Arch Linux machine.
In this article, I will show you how to reinstall all the packages with Pacman on Arch Linux. Let’s get started.
Reinstallation Fixes Missing Files
In this section I will delete some files from /usr/bin and recover them by reinstalling the package to show you that reinstalling fixes issues related to missing files or corrupted files.
I am going to run the following command to remove all the grub related binary files:
As you can see in the screenshot below, the files are removed.
Now I am going to reinstall the grub package with the following command:
The grub package is reinstalled.
Now let’s do a ls -la grub-*, and as you can see in the screenshot below, the removed files are back.
So reinstalling packages can recover broken Arch Linux systems.
Creating a Script for Reinstalling All the Packages
I am not going to reinstall packages one by one. Instead, I will write a bash script to do that automatically.
First create a new directory recovery/ with the following command:
Now navigate to the newly created directory with the following command:
Now export all the package names that are installed on your Arch Linux system with the following command:
Now create a new shell script with the following command:
An empty file should be opened in nano text editor.
Now add these lines to the file:
#!/bin/bash
for pkgName in $ ( cat packages.txt
do
pacman -S —force —noconfirm $pkgName
done
echo «Reinstalled all packages.»
Now press + x and then press y and then press to save the file.
Now make the script executable with the following command:
Reinstalling All the Packages When You Can Boot Into your Arch Linux System
If you can boot into your Arch Linux machine, then it’s really easy to reinstall all the packages with Pacman package manager with the script I created earlier.
First navigate to the recovery/ directory:
Now run the reinstall.sh script as follows:
As you can see, packages are being reinstalled.
It should take a long time to completed depending on your internet connection.
Reinstalling All the Packages When You Can’t Boot into Your Arch Linux System
If you fail to boot into your Arch Linux system, then grab an Arch Linux installation CD and boot into it.
Once you boot into your Arch Linux installer CD, connect to the internet. If you’re using a wired connection and your network is configured with DHCP, then all you have to do is run the following command:
Then you have to mount the Root and Boot (also EFI partition if you’re using GPT partition table) partition of your broken Arch Linux to /mnt directory. My Root partition is /dev/sda3, Boot partition is /dev/sda2, and EFI partition is /dev/sda1.
Mount these partitions to /mnt with the following commands:
Now Chroot into /mnt directory.
Navigate to your recovery/ directory and execute the reinstall script. If you weren’t able to create these, then you should be able to follow Creating a Script for Reinstalling All the Packages section of this article and create it now.
The package reinstallation process should start as you can see in the screenshot below.
Once the reinstallation is complete, run the following command to exit out of Chroot:
Then reboot your computer. Your problem should be solved.
That’s how you reinstall all the packages of Arch Linux with Pacman. Thanks for reading this article.
Источник