Linux system configuration YUM source in the virtual machine

Linux system configuration YUM source in the virtual machine

1. First, we check whether our virtual machine has yum source, the command is

[root@red ~]# ls /etc/yum.repos.d/ (没有yum源)

If it shows that the file cannot be found here, it means that there is no yum source. If it shows that there is a file, it means that there is a yum source.
2. There is no yum source, we need to create a new file with the extension repo, the command is

[root@red ~]# vim /etc/yum.repos.d/rhel.repo 

(Create a new file, the file name is arbitrary, and the extension is repo)
3. At this time, you will enter the default command mode of this file, and you cannot edit the file. You need to enter the i key to enter the edit mode, and manually enter the following content:

[a]
name=a
baseurl=http://172.25.0.254/rhel8.2/AppStream
gpgcheck=0
[b]
name=b
baseurl=http://172.25.0.254/rhel8.2/BaseOS
gpgcheck=0

Note: After the input is completed, it is in the edit mode at this time, and it cannot be saved and exited. You need to press the ESC key, and then enter: wq (save and exit)

After finishing, how to verify whether the software warehouse (YUM source) configured by yourself is correct?

1. First of all, we need to clear the previous cache, the command is as follows

[root@red ~]# yum clean all

(Clear the cache, the input result can be ignored)
2. At this time, we view the yum source, the command is as follows

[root@red ~]# yum repolist 

(There are several yum sources, and the output results are roughly as follows)
id name
aa
bb
yum source Some software management related commands:
yum install (install software), yum remove (uninstall software), yum update (upgrade software)

[root@red ~]# yum -y install vsftpd 

(Install a software named vsftpd)
#install stands for installation, -y (yes) to confirm, do not install in Chinese during the installation process, give the answer in advance, yes needs to install the software
At the end of the installation, it will prompt:
complete! (It means the installation is complete!)
The other two commands have the same format!

Guess you like

Origin blog.csdn.net/qq_51344334/article/details/111689538