[Linux system] Part 3: The use of the software package manager yum in Linux


1. yum

1. What are software packages and package managers

Packages and package managers are like the relationship between "App" and "App Store"

2. What is yum

Yum (Yellow dog Updater, Modified) is a very commonly used package manager under Linux. It is mainly used in distributions such as Fedora, RedHat, and Centos.

In layman's terms: yum is equivalent to the "app store" provided in Linux

3. Several ways to install software under Linux

  • Source code installation : Download the source code of the program and compile it to get an executable program. The source code installation will cause cross-compilation problems. The source code may have different effects in different environments, which makes installation very troublesome. This type of installation is rarely used.
  • Rpm installation : Compared with the above method, rpm installation is more friendly. These software will be compiled in advance, then packaged into a software package and placed on the server, and then installed through instructions. Its biggest flaw is that it cannot solve the problem of dependence. Once it encounters a problem of dependence, it will feedback the problem to the user and let the user solve it by himself.
  • yum manager : yum is a very commonly used software package manager under Linux (equivalent to the application market of mobile phones). It will consider software dependencies and use third-party libraries to help users solve dependency problems. A little friendlier than rpm.

4. Precautions for using yum

After the download is complete, it must be installed. The essence of the installation is to copy to a specific directory. Some directories have permission constraints, so sudo privileges or root installation during installation .

After installation, all users can use it.

5. The use of yum

  1. Software installation (such as sl installation)
yum install sl     #会询问你是否安装

insert image description here

yum install -y sl     #带 -y 选项就不会进行询问了

Effect display: After installation, you can directly enter it on the command line (consistent with the command usage method)

Please add a picture description

  1. Software uninstallation (such as sl uninstallation)
yum remove sl
yum remove -y sl    #不会进行询问

insert image description here

  1. find software
yum list

This command will list all the software available for us to download on the remote server corresponding to our current yum source.
insert image description here

You can use grep to filter out the software you want (such as searching for sl)

yum list | grep sl

insert image description here

2. Data transfer under Linux/Windows

1. Installation of lrzsz

To achieve data mutual transmission under Linux/Windows, first download lrzsz

  1. find lrzsz
yum list | grep lrzsz

insert image description here

  1. install lrzsz
yum install -y lrzsz

2. rzsz tool

After downloading and installing lrzsz, you can use the rssz tool

About rzsz:

This tool is used to transfer files between windows machines and remote Linux machines through XShell.
After installation, files can be uploaded by dragging and dropping.

3. Transfer Windows data to Linux

rz

insert image description here
insert image description here

4. Transfer Linux data to Windows

sz 文件名   #//将Linux.txt下载到Windows中

insert image description here

Show results:
Please add a picture description

Three, yum source configuration file

1. Yum source configuration file path

The CentOS-Base.repo under this path is the basic yum source, and there are software download links in it.

ls /etc/yum.repos.d/

insert image description here

2. View the yum source configuration file

insert image description here
insert image description here
Here is the yum source we used when downloading the software package

3. Replace the yum source configuration file

Generally, the cloud server we use does not need to configure the yum source by ourselves, the system will automatically configure it for us.

  1. The first is to go to the yum source configuration file path
cd /etc/yum.repos.d/

insert image description here

  1. Backup old config files
mv  CentOS-Base.repo  CentOS-Base.repo_tmp
  1. Download Ali yum source configuration file
wget https://mirrors.aliyun.com/repo/Centos-7.repo

insert image description here

Rename the downloaded Ali yum source to CentOS-Base.repo.

Because the Linux system only recognizes CentOS-Base.repothis file name as the yum configuration file
, Linux will use the Ali yum source.

  1. clear cache
   yum clean all
  1. Regenerate the cache

yum makecache

  1. View yum source information again
 yum repolist

Fourth, the installation of epel-release

Some software is not included in the official software collections of centos, Ubuntu, kail and other related ecological platforms. If the official download link is not found in CentOS-Base.repo when installing the software, yum will automatically go to the link pointed to by
the unofficial software collection list to find it.epel-release

For example, what we installed above slis downloaded from the unofficial software collection list.

yum install -y epel-release

After the download is complete, there will be one of the following files:
insert image description here

Guess you like

Origin blog.csdn.net/m0_58124165/article/details/127625883