1、自建yum仓库,分别为网络源和本地源
一、本地源
备份文件
[21:55:01 root@CentOS8 /etc/yum.repos.d]#mkdir backup
[21:55:08 root@CentOS8 /etc/yum.repos.d]#mv *.repo ./backup/
1)挂载
mount /dev/cdrom /mnt/
2)修改配置文件
vim /etc/yum.repos.d/local.repo
[aaa]
name=aaa
baseurl=file:///mnt/AppStream/
gpgcheck=0
[bbb]
name=bbb
baseurl=file:///mnt/BaseOS/
gpgcheck=0
enabled=1
~
对于yum源的URL地址,有三种表示模式:
(1)指向网络的web服务器:baseurl=http://.....................
(2)指向网络的ftp服务器:baseurl=ftp://..........................
(3)指向本地的某个目录:baseurl=file://............................
我们只需要更改对应的地址就可以。
3)检查挂载点是否生效
Yum repolist
4)安装软件yum扩展包
[21:15:27 root@CentOS8 /etc/yum.repos.d]#yum install yum-utils -y
5)安装软件vsftpd
[21:19:32 root@CentOS8 /etc/yum.repos.d]#yum install vsftpd -y
二、网络源
备份文件
[15:21:46 root@localhost /etc/yum.repos.d]#mkdir backup
[15:21:58 root@localhost /etc/yum.repos.d]#mv *.repo ./backup/
1)修改清华yum源配置文件Centos-7.repo
设置虚拟机网卡为桥接模式,更改IP地址获取方式为dhcp,就可以上网了。
2)vim /etc/yum.repos.d/Centos-7.repo
3)清除yum缓存
[15:52:14 root@localhost /etc/yum.repos.d]#yum clean all
[15:52:17 root@localhost /etc/yum.repos.d]#yum repolist
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/4): extras/7/x86_64/primary_db | 246 kB 00:00:00
(3/4): base/7/x86_64/primary_db | 6.1 MB 00:00:01
(4/4): updates/7/x86_64/primary_db | 15 MB 00:00:02
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10,072
extras/7/x86_64 CentOS-7 - Extras 509
updates/7/x86_64 CentOS-7 - Updates 3,728
repolist: 14,309
4)安装软件
[15:56:06 root@localhost /etc/yum.repos.d]#yum install httpd -y