Home >System Tutorial >LINUX >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
Advantages of Using GNU Stow
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)
sudo apt update
(Debian/Ubuntu), sudo yum update
(CentOS/RHEL), etc.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).sudo apt install stow
(Debian/Ubuntu), adjust for your distribution.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).cd curl-8.8.0; ./configure --with-ssl --prefix=/usr/local/stow/curl-8.8.0
(or --with-gnutls
for GnuTLS).make
sudo make install
cd /usr/local/stow; sudo stow curl-8.8.0
curl --version
Updating Software
cd /usr/local/stow; sudo stow -D curl-8.7.1
(replace with the old version).cd /usr/local/stow; sudo stow curl-8.8.0
curl --version
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!