Detailed Linux software management

The software packages in Linux are rich and diverse, but the diversity will also cause some confusion. Users need to consider which software package is suitable for the corresponding Linux distribution version, because many specific software packages are only suitable for specific distribution versions.
The more popular software package formats include RPM and DEB that can be installed directly; compressed packages such as gzip and bzip2 of source code packages

1. RPM package management

RPM is the abbreviation of RedHat Package Manager, which is the Red Hat package tool.

1.1. Install and uninstall RPM packages

  • For installation, we can use the following command to achieve, pay attention to the complete name of the package
rpm -i 软件包名
  • If you need to understand the installation process and progress, we will use these options together
rpm -ivh 软件包名
  • Uninstall the software package without adding the specific version number, which is different from the installation
rpm -e 软件包名
  • PRM can also be upgraded, it will delete the old version, keep the configuration, and then install the new version
rpm -U 软件名
  • During the installation process, if you are prompted about missing dependent packages, you can use –nodeps to ignore the prompt, otherwise an error will be reported
rpm -ivh --nodeps 软件包名

1.2. Software package information query

rpm can be rpm -qused for query work, the commonly used options are as follows

  • Query whether the specified software is installed
rpm -q 软件名
rpm -qa | grep 软件名
  • Query all software installed in the system
qpm -qa
  • Query the detailed information of the specified installation package
rpm -qi 软件名
  • Query the installation path and file list of the specified software
rpm -ql 软件名
  • Query the configuration file of the specified software
rpm -qc 软件名
  • If you want to know the information of a certain uninstalled software, you can do this:
rpm -qp 软件包名 

1.3. Security Verification

We can rpm -V 软件名track the status of the software in a way. When the software is tampered with, there will be a corresponding status. If it has not been tampered with, there will be no prompt.

  • Possible prompt characters and their meanings
5:MD5值更改
S:文件大小发生改变
L:链接文件的源发生改变
T:文件最后修改时间更改
D:设备更改
U:用户发生改变
G:组发生改变
M:权限及类型发生变化
?:不可读文件

2.YUM tool installation package

YUM is an improved version of RPM software manager, which solves the dependencies faced by RPM.
At least one YUM source is required to use YUM installation to provide software package files for YUM installation.
Of course, there is now an updated installation tool: dnf (not dungeon) is similar in usage, not much to say, if you are interested, you can check it yourself.

2.1. YUM source

  • My favorite network sources
阿里源:
https://mirrors.aliyun.com/repo/Centos-7.repo
清华源:
https://mirrors.tuna.tsinghua.edu.cn/
  • If you don’t have a network, you can use the CD to make your own local source
vim /etc/yum.repos.d/centos7.repo
# 注意,扩展名必须的repo结尾

[centos]
name = centos7
baseurl = file:///mnt
enabled = 1
gpgcheck = 0

# 将光盘挂载到/mnt目录下
mount /dev/cdrom /mnt

# 这样一个简单的本地源就好了

2.2.YUM command

  • grammar:
yum 选项 指令 软件包
例:
yum -y install vim
  • Software installation, upgrade, uninstall
yum -y {
    
    install|update|remove} 软件名

# check-update指令可检查可用的升级
  • List installed and available packages
yum list
  • Clear all cached information
yum clean all
  • Installation package group
yum -y groupinstall 包组
  • Install language pack
yum -y langinstall 语言包 

3. Compile and install software from source code

  • The source code packages we download are generally in tar.ge or tar.bz2 format and need to be decompressed with the tai command
  • Then enter the decompressed directory, run the configurescript to pre-compile; you can ./configure --helpview the optional functions
  • makeCompile by command
  • By make installinstalling
  • Note: Usually we need to install some compilation tools, such as: gcc, python, perl, make, automake, etc.
  • The corresponding case can be viewed in my Nginx compilation and installation process
    Nginx compilation and installation

4. Binary package

  • There is nothing to say about this, usually it can be used directly after decompression.

5. Service Management

In the centos7 version, software packages installed through YUM or RPM can systemctlbe managed directly using commands.
Commonly used options include {start, stop, restart, reload, status, enable, disable}, etc.

# 开启服务
systemctl start sshd
# 关闭服务
systemctl stop sshd
# 查看服务状态
systemctl status sshd
# 重启服务
systemctl restart sshd
# 设置开机启动
systemctl enable sshd
# 关闭开机启动
systemctl disable sshd

Let's stop this part of the content first!

Guess you like

Origin blog.csdn.net/qq_42527269/article/details/114868450