Installation of RPM and YUM

The relationship between applications and system commands

Character System command application
File location Generally in the /bin and /sbin directories, or shell internal commands Usually in /usr/bin, /usr/sbin and /usr/local/bin, /usr/local/sbin
The main purpose Complete the basic management of the system, such as IP configuration tools Complete other relatively independent auxiliary tasks, such as a web browser
Applicable environment Generally only run in the character operation interface According to actual needs, some programs can be run in the graphical interface
Run format Generally include command words, command options and command parameters Usually there is no fixed execution format, which is defined by the program developer

Directory structure of a typical application

file type Save directory Description
Ordinary executable program /usr/bin Executable by all users
Server program, management program command /usr/sbin Only the administrator can execute
Application configuration file /etc Applications installed via rpm or yum
Log file / var / log System log
Application Reference Document File /usr/share/doc Reference documents and other data about the application
Application man page file /usr/share/man Man manual for execution files and configuration files

Common package types

file type Save directory
RPM package The extension is ".rpm", suitable for RHEL, CentOS and other systems
DEB software package The extension is ".deb", suitable for Ubuntu, Debian and other systems
Source code package Generally, it is a compressed package in the format of ".tar.gz", ".tar.bz2", etc., which contains the original code of the program and needs to be compiled and installed
Package with installer The extension of the software package is mostly in TarBall format, and the executable program or script file for installation will be provided in the software package. Example: install.sh, setup, etc.

RPM package management tool

The RPM package manager Red-Hat Package Manager
was proposed by Red Hat and is adopted by many Linux distributions.
Establish a unified file database.
Detailed records of software package installation, uninstallation, upgrade and other changes.
Automatic analysis of software package dependencies.
RPM software package
software Material reference: http://www.rpm.org
General naming format: bash-4.2.46-28.e17.x86_64.rpm (software name + version number + number of releases + hardware platform + extension)

Format of the rpm command

The rpm command can realize almost all the management functions of the RPM software package.
Execute the "man rpm" command to get detailed help information about the rpm command. The
rpm command function
Query and verify the relevant information of the RPM software package.
Install, upgrade, uninstall the RPM software package to
maintain and rebuild Comprehensive management operations such as RPM database information

Query information about installed rpm software

rpm -q software name# Query whether the specified software has been installed
rpm -qi software name# Display the detailed information of the specified software that has been installed
rpm -ql software name# Display the file list of the specified software that has been installed
rpm -qc software name# list The configuration file of the installed specified software
rpm -qd software name# List the dependent software packages and files of the specified installed software
rpm -qf file or directory# Query which installation package the specified installed software belongs to
rpm -qa # —
—Display the list of all software installed in rpm mode in the current system rpm -qa | grep -i postfix # Query whether the software postfix is ​​installed

Query the information in the RPM package file

rpm -qpi RPM包FILENAME# Query the detailed information of the specified software package
rpm -qpl RPM包FILENAME# Query the file list of the specified software package
rpm -qpc RPM包FILENAME# Query the configuration file of the specified software package
rpm -qpd RPM package File name# Query the location of the software package documentation of the specified software package

Install, upgrade, and uninstall RPM packages

format:

rpm [options] RPM package file
rpm -ivh RPM package
1
2
common options:
-i: install a new RPM package.
-U: Upgrade a software package, if it has not been installed, install it.
-F: Upgrade a certain software package, if it has not been installed, abort the installation.
-h: In the process of installing or upgrading the software package, the installation progress will be displayed with "#".
-v: Display detailed information during the software installation process.

  • -force: Forcibly install a certain software package, such as installing an older software package.
    -e: Uninstall the software package with the specified name.
  • -nodeps: When installing, upgrading, or uninstalling a software package, it does not check the dependencies with other software packages.

Maintain RPM database

1. Rebuild the RPM database
When the RPM database is damaged, it can be repaired by rebuilding the RPM database

rpm --rebuilddb		或者		rpm --initdb

2. Import the verification public key
Before importing the public key file for digital signature verification, an error will be reported when installing part of the RPM software package in the CD. Need to import the public key file located in the root directory of the CD into the RPM database

mount /dev/sr0 /mnt/
rpm --import /mnt/RPM-GPG-KEY-CentOS-7

To install the source code software package, you need to compile and install, and you need to install a compiler that supports c and c++ programming languages, such as gcc, gcc-c++, and make.
If you use rpm to install, you need to install multiple dependency packages first, which will be very cumbersome. Here you can use yum to perform one-click installation.

(1) Configure the local yum source warehouse

mount /dev/cdrom /mnt/			#把光盘挂载到/mnt目录下
cd /etc/yum.repos.d/
mkdir repos.bak
mv * repos.bak

vim local.repo
[local]							#仓库类别
name=local						#仓库名称
baseurl=file:///mnt				#指定URL 访问路径为光盘挂载目录
enabled=1						#开启此yum源,此为默认项,可省略
gpgcheck=0						#不验证软件包的签名

yum clean all && yum makecache		#删除yum缓存并更新

(2) Commonly used yum operation commands
yum -y install software name# install and upgrade the software package, "-y" option means to automatically confirm
yum -y remove software name# uninstall the software package, which can automatically resolve its dependencies
yum -y update Software name# Upgrade package

yum list # Query the package list
yum list installed # Query the installed packages in the system
yum list available # Query the packages that have not been installed in the warehouse
yum list updates # Query the packages that can be upgraded

yum info software name# Query the description information of the software package
yum info httpd

yum search [all] Keywords# Find related software packages based on a certain keyword
yum search all httpd

yum whatprovides command# Query which package the command belongs to
yum whatprovides netstat
(3) Use yum to install
yum install -y gcc gcc-c++ make

Windows sharing permission setting:

1. Unblock Guest,
right-click on My Computer and select Manage -> Local Users and Groups -> Double-click Guest user in the user item -> Cancel the account disabled option
2. Set shared directory permissions,
right-click on the shared directory point properties -> on the sharing page Click on the sharing option -> drop down to select the shared object as Everyone -> click on the sharing button
3. Set the local policy
Open the command box -> enter secpol.msc -> select the local policy
user rights assignment -> Deny access to this computer from the network -> Delete the guest user
Security option -> Network access: local account sharing and security model -> drop down to select only the guest
Linux mount end:
1. Scan the shared directory
smbclient -L //192.168.80.1/ #Windows end IP address is
not required Enter the password directly and press Enter
2. Mount the shared directory
yum install -y cifs-utils
mkdir /data
mount.cifs //192.168.80.1/share /data
directly press Enter without entering the password.
Query command:
df -h
ls /data

Guess you like

Origin blog.csdn.net/xiwagogogo/article/details/113495815