linux installation software program (Debian [aptitude], Red Hat system [yum], source code installation) - with detailed methods

Posted by big-dog on Thu, 09 Dec 2021 19:26:57 +0100

Install software programs

0 summary

linux, package management system (PMS), and command line tools for software installation, management and deletion.

How to use the software package management system (PMS) to install, update or delete software at the command line. Although most
Linux distributions use beautiful GUI tools for package management, but you can do the same from the command line.

Debian based Linux distributions use the dpkg tool as an interface between the command line and PMS. One front end of the dpkg tool is
aptitude, which provides simple command line options for handling dpkg format packages.

Linux distributions based on Red Hat are based on the rpm tool, but different front-end tools are used under the command line. Red
Install and manage packages using yum or up2date for Hat and Fedora. The openSUSE distribution uses zypper to manage the software, while Mandriva
The line version adopts urpm.

This article discusses how to install packages that are only published as source tarballs. The tar command unpacks the source from the tarball
Code file, and then use the configure and make commands to build the final executable from the source code.

1. Fundamentals of package management

The two main PMS basic tools widely used in Linux are dpkg and rpm. Debian based distributions (such as Ubuntu and Linux Mint) use the dpkg command; Red Hat - based distributions such as Fedora, openSUSE, and Mandriva use the RPM command

2 Debian based system

Tools included in PMS are:

  • apt-get
  • apt-cache
  • aptitude

The most commonly used is aptitude, which is essentially the front end of apt tool and dpkg. Dpkg is a software package management system tool, and aptitude is a complete software package management system.

List all files installed by the package:

dpkg -L package_name

Find which package a particular file belongs to:

dpkg --search absolute_file_name

2.1 using aptitude

  • 1. Install aptitude:
sudo apt-get install aptitude

If e: unable to fetch some archives, may run apt get update or try with -- fix missing?, The solution is

Change mirror source:

sudo vi  /etc/apt/sources.list

# to update
sudo apt-get clean
sudo apt-get update
  • 2. View the installed packages:

Type aptitude to enter the function, and you can use the direction key to move on the menu. Select the menu option Installed Packages to see what packages are installed.

  • 3. Determine the name of the software package to be installed:
aptitude search package_name

be careful:

  • Each package name is preceded by a p or i. If you see an i, it indicates that the package has been installed on your system. If you see a p or v, it indicates that the package is available but not installed.

  • 4. Installation package:

The format is:

aptitude install package_name
  • 5. Update package (update all installed packages to the latest version in the software warehouse):
aptitude safe-upgrade
  • 6. Uninstall the software:

To delete only the software package without deleting the data and configuration files, you can use the remove option of aptitude:

sudo aptitude remove package_name

To delete packages and associated data and profiles, the purge option is available:

sudo aptitude purge package_name
  • 7. Software warehouse:

aptitude is the default software warehouse location and is stored in the file / etc / apt / sources List.

Specify the warehouse source in the following format:

deb (or deb-src) address distribution_name package_type_list

Explanation:
The value of deb or deb SRC indicates the type of package. The deb value indicates that this is a compiled program source, and deb Src
Value indicates that this is the source of a source code. The address entry is the Web address of the software warehouse. distribution_ The name entry is the name of the distribution version of this particular software warehouse. package_ type_ The list entry may be more than one word, indicating what type of package is in the warehouse.

3 Red Hat based system

Common front end tools:

  • yum: use in Red Hat and Fedora.
  • urpm: used in Mandriva.
  • zypper: used in openSUSE.

3.1 use

  • 1. To find the installed package on the system, enter the following command at the shell prompt
yum list installed

# Redirect the list of installed packages to a file
yum list installed > installed_software

# Find out the details of a specific package
yum list xterm

# Find out which package a particular file on the system belongs to
yum provides file_name

# Locate the configuration file / etc / yum.com Examples of conf attribution
yum provides /etc/yum.conf
  • 2. Install software

Switch to root before installing:

su-

Remote installation:

yum install package_name

Local installation:

yum localinstall package_name.rpm
  • 3. Update the software
# Lists the available updates for all installed packages
yum list updates

# Update a specific package
yum update package_name

# Update all
yum update

  • 4. Uninstall the software
# Delete only the package and retain the configuration file and data file
yum remove package_name

# To delete the software and all its files
yum erase package_name

Uninstall the software using zypper and urpm:

Front end tool commands
urpm 	urpme package_name
zypper zypper remove package_name
  • 5. Handle damaged package dependencies
yum clean all

yum update

If this does not solve the problem, try the following command (this command shows the library dependencies of all packages and what software can provide these library dependencies.):

yum deplist package_name

If this does not solve the problem, there is a last resort (- - skip broken option allows you to ignore the package whose dependency is damaged and continue to update other packages):

yum update --skip-broken

Fix broken dependencies using zypper and urpm:

Front end tool commands
urpm 	urpmi –clean
Zipper 	zypper verify
  • 6. Software warehouse (adhere to the approved warehouse)

View the warehouse where the software comes from:

yum repolist

The warehouse definition file for Yum is located in / etc / yum repos. d. If you need to add a warehouse, you need to add the correct URL and obtain the necessary encryption key.

Warehouse management command:

zypper and urpm Library of
 Action front end tool command
 Display warehouse urpm urpmq --list-media
 Add warehouse urpm urpmi.addmedia path_name
 Display warehouse zypper zypper repos
 Add warehouse zypper zypper addrepo path_name

4 source code installation

  • 1. Use tarball (tar package) to decompress the software package;
$ tar -zxvf sysstat-11.1.1.tar.gz
sysstat-11.1.1/
sysstat-11.1.1/cifsiostat.c
sysstat-11.1.1/FAQ
sysstat-11.1.1/ioconf.h
sysstat-11.1.1/rd_stats.h
sysstat-11.1.1/COPYING
sysstat-11.1.1/common.h
sysstat-11.1.1/sysconfig.in
sysstat-11.1.1/mpstat.h
sysstat-11.1.1/rndr_stats.h
[...]

Now, tarball has finished understanding the package, and all files have been successfully placed in a file called sysstat-11.1 1.

  • 2. The cd command enters the new directory and lists the contents of the directory;
$ cd sysstat-11.1.1
$ ls
activity.c iconfig prealloc.in sa.h
build INSTALL pr_stats.c sar.c
CHANGES ioconf.c pr_stats.h sa_wrap.c
cifsiostat.c ioconf.h rd_sensors.c sysconfig.in
cifsiostat.h iostat.c rd_sensors.h sysstat-11.1.1.lsm
common.c iostat.h rd_stats.c sysstat-11.1.1.spec
common.h json_stats.c rd_stats.h sysstat.in
configure json_stats.h README sysstat.ioconf
configure.in Makefile.in rndr_stats.c sysstat.service.in
contrib man rndr_stats.h sysstat.sysconfig.in
COPYING mpstat.c sa1.in version.in
count.c mpstat.h sa2.in xml
count.h nfsiostat-sysstat.c sa_common.c xml_stats.c
CREDITS nfsiostat-sysstat.h sadc.c xml_stats.h
cron nls sadf.c
FAQ pidstat.c sadf.h
format.c pidstat.h sadf_misc.c

In the list of this directory, you should see the README or AAA README file (which contains the operations required for software installation).

  • 3. According to the recommendations in the README file, the next step is to configure sysstat for the system (sysstat is a software toolkit commonly used in Linux system servers, which can be used to monitor the performance of the server). It checks your Linux system to make sure
    It has a suitable compiler to compile the source code, and also has the correct library dependencies.
# ./configure
Check programs:
.
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
[...]
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking ctype.h usability... yes

If something is wrong, an error message will be displayed in the configure step, indicating what is missing. If you want to
If the GNU C compiler is not installed in the Linux distribution, you will only get an error message.

  • 4. Build various binary files with make command;
# make
–gcc -o sadc.o -c -g -O2 -Wall -Wstrict-prototypes -pipe -O2
-DSA_DIR=\"/var/log/sa\" -DSADC_PATH=\"/usr/local/lib/sa/sadc\"
-DUSE_NLS -DPACKAGE=\"sysstat\"
-DLOCALEDIR=\"/usr/local/share/locale\" sadc.c

At the end of the make step, the runnable sysstat software program will appear in the directory! But run the program from that directory
Some inconvenience. If you want to install it in a common location in the Linux system, you must log in as root
Record (or use the sudo command), and then use the install option of the make command.

# make install
mkdir -p /usr/local/share/man/man1
mkdir -p /usr/local/share/man/man5
mkdir -p /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sa1.8*
install -m 644 -g man man/sa1.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sa2.8*
install -m 644 -g man man/sa2.8 /usr/local/share/man/man8
rm -f /usr/local/share/man/man8/sadc.8*
[...]
install -m 644 -g man man/sadc.8 /usr/local/share/man/man8
install -m 644 FAQ /usr/local/share/doc/sysstat-11.1.1
install -m 644 *.lsm /usr/local/share/doc/sysstat-11.1.1

Topics: Linux Red Hat yum debian