- 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
- What is package installation in linux
- Important
- How to find out if package is installed in Linux
- Debian / Ubuntu Linux
- Red Hat Enterprise / Fedora Linux / Suse Linux / Cent OS
- See also:
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
Источник
What is package installation in linux
Modern systems based on Linux include a huge number of resources commonly used by many programs, such as shared libraries of standard functions, executable files, scripts and standard utilities necessary for the normal work of many programs. Removal or upgrade of one of the system components may cause other dependent components to stop functioning correctly or even make the entire system inoperable. In the context of system administration such problems are called loss of system integrity. The goal of an administrator is to ensure that the system contains compatible versions of all the necessary components (system integrity control).
To install, delete and update program packages and to maintain the integrity of the Linux system, package managers (such as RPM in RedHat distributions or dpkg in Debian GNU/Linux) began to be used primarily. For a package manager, software consists of sets of components known as software packages. Such components contain sets of executables and auxiliary files needed for the correct work of software. Package managers unify and automate the process of building binary packages and make program installation easier, allowing to directly check for availability of components with the required versions at installation time, and performing all the procedures necessary to register the program in all the user operating environments. As soon as installation is completed, the program becomes available to from the command prompt and appears in the menus of all the graphical environments.
Important
Thanks to package managers, Linux users usually do not need to call the installation procedures of individual applications directly, or to directly interact with directories in which executable files and other program components are installed (these normally are /usr/bin and /usr/share/ package_name). All this work is done by a package manager. This is why program installation, uninstallation and upgrade are usually referred to as package management in Linux.
Components used by different programs are often gathered in separate packages. Package A, needed for software included in Package B to function, is marked in a special way. In this case it is said that Package B depends on Package A, or that there exists a dependency between packages A and B.
Tracking dependencies among such packages is a serious task for any Linux distribution. Some packages may be mutually replaceable, there may be several packages containing a required resource.
The task of controlling integrity and consistency of software installed in the system is more difficult. Let us imagine that certain programs A and B require the presence of component C, version 1.0, in the system. Update of package A, which requires upgrading of component C to a new version (let’s say 2.0) that provides a new access interface, will thus necessarily lead to the update of program B.
However, package managers are not always capable of preventing all possible errors during program installation and uninstallation. Neither can they effectively restore system integrity. This defect is especially obvious when the system is updated from a centralized repository of packages, in which packages are continuously updated and sometimes split into smaller ones etc. This problem stimulated the creation of software package management and integrity maintenance systems.
To automate this process, the Advanced Packaging Tool ( APT ) is used. Such automation is achieved by creating one or several external repositories, in which program packages are stored. Packages installed in the system are checked against these repositories. A repository may contain an official version of a distribution, updated by developers as new versions of programs are released. However, it may also contain packages developed locally, for instance, builds of internal company projects.
Thus there are two databases at the disposal of APT : one describes packages installed in the system, the second one describes the external repository. APT keeps track of integrity of the installed system, and, if any inconsistencies in package dependencies are discovered, it uses data from the external repository to resolve conflicts and to find a correct way to fix the problem.
APT was initially developed to manage installation and removal of programs in the Debian GNU/Linux distribution. During development, the goal of replacing dselect , a package selection utility used in Debian, with a new one was set. The new system had to have wider functionality and a simple user interface. It also had to allow users to perform installation, updates and routine management of programs installed on a computer without the need to study subtleties of a software package manager used in the distribution.
Such attractive features had for a long time been available only to Debian users, because only one package manager had been supported by APT , namely the dpkg package manager, used in Debian, incompatible with RPM , used in ALT Linux. This incompatibility mostly lies in different data formats (although converter applications exist), but there are also other differences, which are outside the scope of this description.
However, APT was initially conceived as independent of the particular method of handling packages installed in the system, and this peculiarity allowed developers from the Brazilian company Conectiva to implement the support of RPM package manager in it. Thus users of distributions based on RPM (ALT Linux being one of them) gained an opportunity to use this powerful tool.
APT is at the present time still in its development stage, and the current version that supports RPM is classified as unstable. This, however, does not mean that operations carried out with the help of APT will inevitably make the system unstable. On the contrary, strict control over the system integrity is possible with APT : broken dependencies between installed packages can be checked and the found errors can be corrected.
Источник
How to find out if package is installed in Linux
Debian / Ubuntu Linux
Use dpkg command. It is a package manager for Debian/Ubuntu Linux. Suppose you want to find out package apache-perl or sudo is installed or not, type command:
$ dpkg -s apache-perl
Sample outputs:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Another example:
$ dpkg -s sudo
Sample outputs:
Use file /var/lib/dpkg/available to find out all package names available to you. Or you can use following command (list all packages in /var/lib/dpkg/status):
$ dpkg-query -l
You can also try to match package name using wild cards:
$ dpkg-query -l ‘libc6*’
Once you’ve found package name, use the following command to get exact status (whether it is installed or not):
$ dpkg-query -W -f=’$
Sample outputs:
Red Hat Enterprise / Fedora Linux / Suse Linux / Cent OS
Under Red Hat/Fedora/CentOS/Suse Linux use the rpm command:
$ rpm -qa | grep
$ rpm -qa | grep mutt
Output:
If you do not see or get any outputs (package name along with version), it means the package is not installed at all. You can display or list all installed packages with the following command:
$ rpm -qa
$ rpm -qa | less
You can conditionally do something if a rpm command succeeded or failed to find package using bash shell if command:
On a CentOS/RHEL version 6.x/7.x and above use the following yum command to tell whether a package named htop is installed:
$ yum list installed
$ yum list installed htop
Sample outputs:
If you are using Fedora Linux, try the following dnf command:
$ dnf list installed
$ dnf list installed htop
See also:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Category | List of Unix and Linux commands |
---|---|
Documentation | help • mandb • man • pinfo |
Disk space analyzers | df • duf • ncdu • pydf |
File Management | cat • cp • less • mkdir • more • tree |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Linux Desktop Apps | Skype • Spotify • VLC 3 |
Modern utilities | bat • exa |
Network Utilities | NetHogs • dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop |
Searching | ag • grep • whereis • which |
Shell builtins | compgen • echo • printf |
Text processing | cut • rev |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Comments on this entry are closed.
This is my first massage over here& i hope i will get full support.
How to open usermap.cfg file on NetApp server?- As i have to check whether unix user login is mapped correctly with Windows login.
As the main problem which few of the users are having is as below —
They are NOT able to map from Windows any network
drive (unix accounts) due to they have not access to their share drive.
It ask me for login and password, BUT earliear it never asked me for my windows login and password . It’s been working till the end of the year 2006.
Please suggest solutions—–
Many thanks in Advance
just a small addition –
on Gentoo Linux just do a:
or
cat /var/lib/portage/world
on CentOS or other “yum”-based systems:
yum list installed
how to see the programs and features in redhat linux (e.g– in windows we can check the same through control panel–progrmas)
@john: On RedHat – which is a rpm package management based distribution – you should can use i.e.:
to list all installed packages or
to get out details about the installed package.
how do i verify packages that are installed without using rpm, i mean recently i installed squid using make, make all, configure configure-install
after this, how do I check this package is installed?
…this is not possible as installing “by hand” (make install) has nothing to do with a “package” nor package management.
To find out if i.e. squid was installed just try to locate the squid binary by where, locate or find, even if you build and install software from sources by make.
If you use a port management system from i.e. pkgsrc, getoo portage or even FreeBSD the port management counts each modified and installed file of a port to make it possible to see which file belongs to which port (package) or which are installed etc.
this might be another story.
Thank you very much, I have another issue, I have Installed texlive but I still get an error message in my crm ” pdf latex not installed”, so do you know how check if any software is installed or not ? It’s different from packages, isn’t it ?
If you have a list of packages you want to query, it’s much easier to just list them instead of using grep:
rpm -q automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel
Why such a complicated command for rpm-based systems? On my machine (Fedora 20), I can just run rpm -q $
[blong@blong-desktop tmp]$ rpm -q vala; echo $?
vala-0.22.1-1.fc20.x86_64
0
[blong@blong-desktop tmp]$ rpm -q missing-package; echo $?
package missing-package is not installed
1
Is this a new feature?
In Debian based distros like Ubuntu, you can find out if a package is installed with:
apacheInstalled=$(dpkg -s apache2 | grep ‘Status: install ok installed’| wc -l)
#change apache2 to the package you are checking for. returns 1 if installed, 0 otherwise.
#script does not have to be running as root… but to change installed stuff… it would.
Источник