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

Detailed tutorial on deploying Django project under CentOS

Basic Environment Pagoda installation service [Py...

Detailed explanation of various loop speed tests in JS that you don’t know

Table of contents Preface 1. for loop 2. while lo...

Example method of deploying react project on nginx

Test project: react-demo Clone your react-demo pr...

Solve the problem of Docker starting Elasticsearch7.x and reporting an error

Using the Docker run command docker run -d -p 920...

MySQL Database Iron Laws (Summary)

Good database specifications help reduce the comp...

Sublime / vscode quick implementation of generating HTML code

Table of contents Basic HTML structure Generate s...

Zabbix monitoring solution - the latest official version 4.4 [recommended]

Zabbix 2019/10/12 Chenxin refer to https://www.za...

Sharing tips on using scroll bars in HTML

Today, when we were learning about the Niu Nan new...

Nginx service 500: Internal Server Error one of the reasons

500 (Internal Server Error) The server encountere...

The latest mysql-5.7.21 installation and configuration method

1. Unzip the downloaded MySQL compressed package ...

The role and opening of MySQL slow query log

Preface The MySQL slow query log is a type of log...

Several ways to encapsulate breadcrumb function components in Vue3

Table of contents Preface 1. Why do we need bread...

Detailed tutorial on installing PHP and Nginx on Centos7

As the application of centos on the server side b...

Detailed explanation of the use of DockerHub image repository

Previously, the images we used were all pulled fr...