⬆️ ⬇️

Linux: Installing non-distributable software with the xstow manager

Introduction




Modern Linux distributions incorporate a lot of software. Problems with installing / removing / updating such software have been solved, one might say, ideally. All involved in the package manager. Chose the right package, the package manager will install it. It is necessary to delete - the package manager will remove and clean everything neatly. But, sometimes you want, or need to install software that is not included in the distribution, or distributed in the source, or even in the binary. What to do in such cases?





Further, for definiteness, we assume that we use Linux, a distribution kit of Ubuntu or Debian.

')

Installing a package from source




Classic for free software distribution path, distribution in source code. In this form, the program is an archive with the following name:



 name-version.tar.gz




Installation of such software is done by executing a set of simple commands:



 tar -xzvf name-version.tar.gz
 cd name-version
 ./configure
 make
 sudo make install




Decoding actions:



StepTeamWhat is he doing
onetar -xzvf name-version.tar.gzArchive unpacking
2cd name-versionGo to the received after unpacking directories
3./configureSetting up the source for our system
fourmakeCompilation
fivesudo make installInstallation




Problems




Problem 1: Lack of required libraries




Very often, things are not going so smoothly, and in step 3, the configure command complains about something. And as a rule, she complains about the absence of the necessary libraries, or library headers. Consider carefully the output that the configure command issued to the console and install the missing libraries and headers. The headers for Debian-like distributions, including Ubuntu, are in packages with the suffix -dev in the package name.



Suppose we saw that configure complains about the library, install it into the system:



 sudo apt-get install name




Run configure again. Now complains about the headers of the same library. Install them too:



 sudo apt-get install name-dev




Well, finally, they have installed everything they need, compiled, we work and enjoy. It would seem, happiness, here it is. But no, problem 2 emerges:



Problem 2: system mess




Suppose we installed one program from source, another, a third. And suddenly we needed to remove the first one, or replace its version. And we, it turns out, do not know which files belong to this program and where they are. Some programs install their files in the / usr / local hierarchy, others generally in / usr . In general, we do not know how to clean out files related to a package.



Digression: Linux File System Standard Hierarchy (File System Hierarchy Standard)




Linux has a standard for placing files on the system. Links are given in the Literature section. According to this standard, the files used by users, including users from other computers, should be stored in the hierarchy of the / usr directories. In the hierarchy of directories / usr / local - files used by local users. Thus, we need to put our programs in the hierarchy of / usr / local , while avoiding mess.



Xstow package manager




The xstow package manager will help us to do this. You can also use the stow manager, xstow is an extended version. What is he doing? Very simple thing. We install our programs into the / usr / local / stow hierarchy , each program in its own directory, and then the xstow manager creates symbolic links to our files from the / usr / local hierarchy. Install xstow :



 sudo apt-get install xstow




Now the sequence of operations when installing a package using the xstow manager.



 tar -xzvf name-version.tar.gz
 cd name-version
 ./configure --prefix = / usr / local / stow / name-version
 make
 sudo make install
 cd / usr / local / stow /
 sudo xstow name-version




Decoding actions:



StepTeamWhat is he doing
onetar -xzvf name-version.tar.gzArchive unpacking
2cd name-versionGo to the received after unpacking directories
3./configure —prefix = / usr / local / stow / name-versionSetting up the source for our system so that it can be installed into the specified directory
fourmakeCompilation
fivesudo make installInstallation
6cd / usr / local / stow /Go to the directory where the programs are located.
7sudo xstow name-versionCreate symbolic links to the / usr / local hierarchy




Team:



 sudo xstow -D name-version




Removes symbolic links. After deleting the links, the directory with the program files located in / usr / local / stow / can be deleted.



Conclusion




Using the xstow package manager, you can not only maintain order in the system, you can have several versions of programs at the same time and quickly switch between them.



Literature




1. Standard Linux File System Hierarchy (File System Hierarchy Standard)

2. Filesystem Hierarchy Standard

Source: https://habr.com/ru/post/63221/



All Articles