Home System Tutorial LINUX How To Install And Manage Software From Source Using GNU Stow In Linux

How To Install And Manage Software From Source Using GNU Stow In Linux

Mar 16, 2025 am 10:51 AM

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)

  1. Update System: sudo apt update (Debian/Ubuntu), sudo yum update (CentOS/RHEL), etc.
  2. 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).
  3. Install GNU Stow: sudo apt install stow (Debian/Ubuntu), adjust for your distribution.
  4. 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).
  5. Configure Build: cd curl-8.8.0; ./configure --with-ssl --prefix=/usr/local/stow/curl-8.8.0 (or --with-gnutls for GnuTLS).
  6. Compile: make
  7. Install: sudo make install
  8. Manage with Stow: cd /usr/local/stow; sudo stow curl-8.8.0
  9. Verify: curl --version

How To Install And Manage Software From Source Using GNU Stow In Linux

Updating Software

  1. Uninstall Old Version: cd /usr/local/stow; sudo stow -D curl-8.7.1 (replace with the old version).
  2. Download, Extract, Configure, and Build New Version: Repeat steps 4-7 from the installation section.
  3. Manage New Version with Stow: cd /usr/local/stow; sudo stow curl-8.8.0
  4. Verify: curl --version
  5. 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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the Linux best used for? What is the Linux best used for? Apr 03, 2025 am 12:11 AM

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.

What are the 5 basic components of Linux? What are the 5 basic components of Linux? Apr 06, 2025 am 12:05 AM

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.

What is basic Linux administration? What is basic Linux administration? Apr 02, 2025 pm 02:09 PM

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.

How to learn Linux basics? How to learn Linux basics? Apr 10, 2025 am 09:32 AM

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.

What is the most use of Linux? What is the most use of Linux? Apr 09, 2025 am 12:02 AM

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.

What is a Linux device? What is a Linux device? Apr 05, 2025 am 12:04 AM

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.

What are the disadvantages of Linux? What are the disadvantages of Linux? Apr 08, 2025 am 12:01 AM

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.

Does the internet run on Linux? Does the internet run on Linux? Apr 14, 2025 am 12:03 AM

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.

See all articles