How to Easily Remove Source Installed Packages in Linux

How to Easily Remove Source Installed Packages in Linux

Step 1: Install Stow

In this example, we are using CentOS, so we need the extended EPEL repository. You can install them using the following command:

yum install epel-release

Then, the following command:

yum install stow

Press Y to confirm the installation:

Now that stow is installed, we have to choose where to store the package files.

Step 2: Choose where to store the package file

The normal "make install" command copies package files to various locations. Stow works by putting them all in one place in one directory, then creating symbolic links to where they are supposed to go.

So we need to choose a directory for stow to save all the package files. By convention, this is usually:

/usr/local/stow/

In this location, there is a directory for each package. So if we were to install the “hello” program we used as an example in the previous article, the files would be stored in:

/usr/local/stow/hello

This location can be anything. Just to show, we will store the files in the following location:

/home/bhagwad/stow/

Step 3: Use "make install" with the "prefix" option

We saw in the previous article that installing from source requires the following commands:

./configure
make
make install

To install using stow, we just need to change the last step to:

make install prefix=/home/testuser/stow/hello

The "prefix" option tells us to put the package at a given location. This location is simply the directory selected in step 2 with the package name added as a separate folder. This will cause the file to be installed to the given location, as shown below:

Now we place all the files we need in our package in a folder in the stow directory.

Step 4: Complete the installation using stow

To install the package, first "cd" into the stow directory like this:

cd /home/testuser/stow

Make sure the folder containing the file is just one directory below your current location. Now type:

stow hello

The package is now installed on your system. Here is a screenshot of the "hello" command:

Step 5: Remove the package

The coolest part about loading is how easy it is to remove the pack from the system. No need to keep source packages or anything. Simply navigate to the stow directory, as shown in Step 4, and type:

stow --delete hello

It's done! You can see below that the command no longer works after this step:

As far as the system is concerned, the package has been completely removed! It's good to remember that the files don't actually disappear. They are still in the "hello" directory. You can easily install the package again using the stow command. If you don't need these files anymore, just delete the "hello" folder and your system is clean!

Summarize

The above is what I introduced to you on how to easily delete source installed software packages in Linux. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. Thank you very much for your support of 123WORDPRESS.COM

You may also be interested in:
  • How to install and uninstall rpm packages on Linux
  • Detailed explanation of installation and use of software packages under LINUX
  • Python environment package installation steps in Linux
  • How to check if a package is installed in Debian Linux

<<:  Error mysql Table 'performance_schema...Solution

>>:  VUE implements bottom suction button

Recommend

Summary of common tool functions necessary for front-end development

1. Time formatting and other methods It is recomm...

Simple operation of installing vi command in docker container

When using a docker container, sometimes vim is n...

Linux common commands chmod to modify file permissions 777 and 754

The following command is often used: chmod 777 文件...

Two ways to prohibit clearing the input text input cache in html

Most browsers will cache input values ​​by defaul...

Pitfall notes of vuex and pinia in vue3

Table of contents introduce Installation and Usag...

MYSQL uses Union to merge the data of two tables and display them

Using the UNION Operator union : Used to connect ...

A brief discussion on the types of node.js middleware

Table of contents Overview 1. Application-level m...

win10 docker-toolsbox tutorial on building a php development environment

Download image docker pull mysql:5.7 docker pull ...

CSS3 clear float method example

1. Purpose Through this article, everyone can und...