How To Install And Manage Software From Source Using GNU Stow In Linux
This tutorial explains how GNU Stow simplifies managing software installed from source in Linux. It uses symbolic links to keep installations organized, preventing conflicts and making updates/removal easy.
What is GNU Stow?
GNU Stow is a symlink manager streamlining source code software installation on Linux and Unix-like systems. It organizes files, enabling efficient management and maintenance by creating symbolic links from a central location to the actual software files. This prevents conflicts between multiple packages. It's especially useful for users managing their own installations and configurations, often paired with version control. It's free and open-source.
How GNU Stow Works
Stow assumes each software package resides in its own directory (e.g., /usr/local/stow/package1
). stow package1
creates symbolic links from this directory to the appropriate system locations (like /usr/local/bin
). stow -D package1
removes these links.
GNU Stow Features
- Symbolic Links: Creates symlinks, avoiding file conflicts.
- Package Management: Manages software installed in user-specific or system-wide locations.
- Easy Upgrades/Removals: Updating or removing a package is straightforward; Stow handles the symlinks automatically.
- Flexible Configuration: Customizable to suit individual needs.
Advantages of Using GNU Stow
- Simplified Package Management: Easy installation, updates, and removal. Multiple versions of the same package can coexist.
- Conflict Avoidance: Isolated package directories minimize file conflicts.
- Reproducibility: Easier to replicate and document software environments.
Use Case
Ideal for developers regularly compiling software from source and managing configuration files (dotfiles) across multiple systems.
Basic Usage
Install a package: cd /usr/local/stow; stow package1
Uninstall a package: cd /usr/local/stow; stow -D package1
Installing Software from Source using GNU Stow (Curl Example)
-
Update System:
sudo apt update
(Debian/Ubuntu),sudo yum update
(CentOS/RHEL), etc. -
Install Development Tools:
sudo apt install build-essential libssl-dev
(Debian/Ubuntu for Curl with OpenSSL), adjust for your system and desired TLS backend (GnuTLS requires different libraries). -
Install GNU Stow:
sudo apt install stow
(Debian/Ubuntu), adjust for your distribution. -
Download and Extract Curl:
wget https://github.com/curl/curl/releases/download/curl-8_8_0/curl-8.8.0.tar.gz; tar xvf curl-8.8.0.tar.gz
(replace with the actual latest version). -
Configure Build:
cd curl-8.8.0; ./configure --with-ssl --prefix=/usr/local/stow/curl-8.8.0
(or--with-gnutls
for GnuTLS). -
Compile:
make
-
Install:
sudo make install
-
Manage with Stow:
cd /usr/local/stow; sudo stow curl-8.8.0
-
Verify:
curl --version
Updating Software
-
Uninstall Old Version:
cd /usr/local/stow; sudo stow -D curl-8.7.1
(replace with the old version). - Download, Extract, Configure, and Build New Version: Repeat steps 4-7 from the installation section.
-
Manage New Version with Stow:
cd /usr/local/stow; sudo stow curl-8.8.0
-
Verify:
curl --version
-
Remove Old Directory (Optional):
sudo rm -rf /usr/local/stow/curl-8.7.1
Advanced Usage
Stow offers options for relocatable packages (--dir
, --target
), dry runs (-n
), verbose output (-v
), ignoring files (.stow-local-ignore
), restow
(-R
), destow
(-D
), adopting existing files (--adopt
), handling conflicts (--override
), and specifying custom directories. See the man stow
page for details.
GNU Stow Cheat Sheet (Summary of common commands and options)
-
stow package_name
: Stow a package. -
stow -D package_name
: Unstow a package. -
stow -R package_name
: Restow a package. -
stow --dir=/path/to/packages package_name
: Specify source directory. -
stow --target=/path/to/target package_name
: Specify target directory. -
stow -n package_name
: Dry run. -
stow -v package_name
: Verbose output. -
stow --adopt package_name
: Adopt existing files. -
stow --override package_name
: Override conflicts.
Frequently Asked Questions (FAQs) (Covered in original text, but could be summarized here for brevity)
Conclusion
GNU Stow is a valuable tool for efficiently managing source-built software in Linux, improving organization and simplifying updates and removals. Its use of symbolic links prevents conflicts and makes managing multiple software versions straightforward.
The above is the detailed content of How To Install And Manage Software From Source Using GNU Stow In Linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Linux is best used as server management, embedded systems and desktop environments. 1) In server management, Linux is used to host websites, databases, and applications, providing stability and reliability. 2) In embedded systems, Linux is widely used in smart home and automotive electronic systems because of its flexibility and stability. 3) In the desktop environment, Linux provides rich applications and efficient performance.

The five basic components of Linux are: 1. The kernel, managing hardware resources; 2. The system library, providing functions and services; 3. Shell, the interface for users to interact with the system; 4. The file system, storing and organizing data; 5. Applications, using system resources to implement functions.

Linux system management ensures the system stability, efficiency and security through configuration, monitoring and maintenance. 1. Master shell commands such as top and systemctl. 2. Use apt or yum to manage the software package. 3. Write automated scripts to improve efficiency. 4. Common debugging errors such as permission problems. 5. Optimize performance through monitoring tools.

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

Linux is widely used in servers, embedded systems and desktop environments. 1) In the server field, Linux has become an ideal choice for hosting websites, databases and applications due to its stability and security. 2) In embedded systems, Linux is popular for its high customization and efficiency. 3) In the desktop environment, Linux provides a variety of desktop environments to meet the needs of different users.

Linux devices are hardware devices running Linux operating systems, including servers, personal computers, smartphones and embedded systems. They take advantage of the power of Linux to perform various tasks such as website hosting and big data analytics.

The disadvantages of Linux include user experience, software compatibility, hardware support, and learning curve. 1. The user experience is not as friendly as Windows or macOS, and it relies on the command line interface. 2. The software compatibility is not as good as other systems and lacks native versions of many commercial software. 3. Hardware support is not as comprehensive as Windows, and drivers may be compiled manually. 4. The learning curve is steep, and mastering command line operations requires time and patience.

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.
