Use a CD to make yum source in Linux (CentOS7) (configure yum source)

Configure yum source in Linux

1. Mount the CD
Reference link https://blog.csdn.net/m0_53521757/article/details/112536969
Command: mount -r /dev/sr0 /c1
Insert picture description here
2. The yum source configuration directory is "/etc/yum.repos. d/", when the network is unavailable, you can back up to another directory and then delete it (as configured below), or use mv to rename files that do not end with ".repo".
cd /etc/yum.repos.d/
cp * /root
rm -f *
3. Create a new file tsu.repo, yum source configuration files all end with repo

[tsu] //The name of the yum source, which serves as a mark
name=erniu //Description of the yum source, so that users can read the file
baseurl=file:///c1 //Specify the path to find dependencies; network path or local The path "file://" table uses the local yum file protocol
enabled=1 //Enable; 0 table baseurl definition is not available, 1 table can be used
gpgcheck=0 // table for gpg detection; 0 table does not perform, 1 table performs
Insert picture description here

4. Refresh the repos generation cache
yum clean all
yum makecache
Insert picture description here
complete code:

[root@localhost ~]# mkdir /c1
[root@localhost ~]# mount -r /dev/sr0 /c1 
[root@localhost ~]# mount -a 
[root@localhost ~]# df
文件系统                   1K-块    已用     可用 已用% 挂载点
devtmpfs                  480796       0   480796    0% /dev
tmpfs                     497852   12820   485032    3% /dev/shm
tmpfs                     497852    8712   489140    2% /run
tmpfs                     497852       0   497852    0% /sys/fs/cgroup
/dev/mapper/centos-root 17811456 5460580 12350876   31% /
/dev/sda1                1038336  175208   863128   17% /boot
tmpfs                      99572      36    99536    1% /run/user/0
/dev/sr0                 4669162 4669162        0  100% /c1
 [root@localhost ~]# cd /etc/yum.repos.d/  //进入yum源主目录
 [root@localhost yum.repos.d]# cp * /root //将所有默认yum源备份至root家目录
[root@localhost yum.repos.d]# rm -f * //删除所有默认yum源
[root@localhost yum.repos.d]# vim tsu.repo  //写入内容!!!保存并退出
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache


At this point, the configuration of the yum source is completed. If there are any private messages and comments that you don't understand, the blogger will definitely reply, and we will communicate together. If there are any shortcomings and mistakes, please give pointers.

Guess you like

Origin blog.csdn.net/m0_53521757/article/details/112546446