[Linux study notes] Linux package installation and uninstallation

7.1 Three methods of installing software packages
rpm tool: similar to the exe file under windows.
yum tool: supports automatic installation of dependent packages. Equivalent to app store.
Source package: Various files of the programming language can be seen, and the encoder needs to be compiled and installed.


The 7.2rpm package introduces the
mounting CD, the CD in the lower right corner of the screen.
mount /dev/cdrom /mnt/
Hint: write-protected, will mount read-only. (The CD-ROM cannot be written to) You can check that there are many rpm packages in
ls /mnt/packge . Package name - version number - release version number (el7 (centos7), el6) - platform (i386, x86_64, etc.).rpm


7.3 rpm tool usage
rpm -ivh RPM package file Install RPM package.
-i install install.
-v Visualize.
-h More user-friendly display, showing progress.
rpm -Uvh RPM package file Upgrade RPM package.
-U upgrade.
rpm -e packagename Uninstall. If there is a relationship during uninstallation, you need to uninstall them in sequence according to the prompts.
rpm -qa queries installed packages.
rpm -q package name Check whether the specified package is installed.
rpm -qi package name Query the specified package information.
rpm -ql package name Query the files installed by the specified package.
rpm -qf file absolute path Query which package the file was installed by.
Special usage of backticks "`" (in front of 1 on the left side of the keyboard):
rpm -qf `which cd` , enter the path found by which cd into rpm -qf .


7.4 yum tool usage
yum list lists all RPM packages.
Package name + other information version number warehouse
yum install [-y] package name Install the package, add the -y option, and install it directly without asking.
yum search NAME searches for packages related to NAME.
yum list |grep 'NAME' to search for packages with NAME.
yum grouplist lists all available groups.
yum groupinstall [y] Group name Installation group. If the group name has more than one word, it must be enclosed in single quotation marks.
yum remove [-y] package name Uninstall package. This command will also uninstall dependent packages.
yum update [-y] package name Upgrade package. If the package name is omitted, all RPM packages in the system will be upgraded, even the system itself. Often used when the system is just installed.
yum provides "//COMMAND" to search the system for packages that provide the COMMAND command. /*/ is a wildcard for directories.


7.5yum build a local warehouse
and mount the CD-ROM to the /mnt directory.
Back up the configuration file /etc/yum.repos.d, and then delete all repo files in the directory. and create a new file dvd.repo with the following content:

[dvd]           #仓库名
name=install dvd            #自定义描述字符串
baseurl=file:///mnt         #RPM包目录
enable=1            #是否可用
gpcheck=0           #是否检测,可不检测

yum clean all clears the previous cache.
yum list [|less] scrolls through the screen with less, and the packages with @ in front of the warehouse are already installed packages.


7.6 yum update
domestic source is a foreign website, the download is very slow, you can change the domestic yum source.
Delete the dvd.repo file created in the previous section and restore the backed up files.
The online download source is stored in the /etc/yum.repos.d directory.
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
or
curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo


7.7 yum downloads the rpm package and
installs the extension source epel
yum install -y epel-release After the installation is complete, the epel extension source file is added to the /etc/yum.repos.d directory.
At this time , under the yum list , many RPM packages of the epel repository have been added.
yum install -y package name --downloadnoly [--downloaddia=DIRNAME] , only download RPM package, do not install, you can specify the save address, the default address is /var/cache/yum/x86_64/7/warehouse name.
If the package is already installed:
yum reinstall packagename Reinstalls the package.
yum reinstall package name --downloadnoly [--downloaddia=DIRNAME] only downloads but does not install.


7.8 Source Package Installation (Part 1)
Download the source package, which is agreed to be stored in the /usr/local/src directory.
unzip. After decompression, focus on viewing the README and INSTALL documents.
./configure [--prefix=DIRNAME] Check the configuration and generate a MAKEFILE file. The installation path can be specified with --prefix.
Run echo $ immediately after finishing , you can see whether the last command is running normally, 1 is wrong, 0 is normal.
make compile.
make install install.


7.9 Source package installation (below)
Source packages with unknown sources may have unsafe factors such as Trojan horses, and you should go to the official download source package.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324738448&siteId=291194637