1、配置国内优秀的yum源仓库和epel源
/etc/yum.conf #为所有仓库提供公共配置
/etc/yum.repos.d/*.repo #为每个仓库提供配置文件
[root@y_zilong yum.repos.d]# cat tx.repo
[tx]
name=tx #自定义源名字
baseurl=https://mirrors.cloud.tencent.com/centos/7/os/x86_64/
#访问路径指定到repodate数据文件的上级目录
enabled=1
#是否启用软件仓库(1启动,0不启用)
gpgcheck=1
#安装包前要做包的合法和完整性效验
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#指定公钥文件存放位置
[epel]
name=epel
baseurl=https://mirrors.cloud.tencent.com/epel/7/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@y_zilong yum.repos.d]# yum clean all #清除缓存
Loaded plugins: fastestmirror, langpacks
Cleaning repos: epel tx
Cleaning up everything
Cleaning up list of fastest mirrors
[root@y_zilong yum.repos.d]# yum repolist #显示仓库
Loaded plugins: fastestmirror, langpacks
epel | 4.7 kB 00:00:00
tx | 3.6 kB 00:00:00
(1/5): epel/group_gz | 96 kB 00:00:00
(2/5): epel/updateinfo | 1.0 MB 00:00:00
(3/5): tx/group_gz | 153 kB 00:00:00
(4/5): epel/primary_db | 6.9 MB 00:00:02
(5/5): tx/primary_db | 6.1 MB 00:00:02
Determining fastest mirrors
repo id repo name status
epel epel 13,571
tx tx 10,072
repolist: 23,643
[root@y_zilong yum.repos.d]#
2、为CentOS7用系统安装光盘作的本地网络yum仓库
本地yum源是利用光盘镜像作为本地yum源
1.安装http服务, 关闭防火墙,测试服务是否可用, 在本地浏览器输入本机ip地址
[root@y_zilong ~]# systemctl stop firewalld #关闭防火墙
[root@y_zilong ~]# systemctl enable firewalld
[root@y_zilong ~]# yum install -y httpd #安装httpd
[root@y_zilong ~]# systemctl enable --now httpd
2.创建网页页面
[root@y_zilong ~]# cd /var/www/html/
[root@y_zilong html]# mkdir -p centos/7/os
3.安装autofs服务,在客户端上面持续检测某个指定的目录,并预先设置当使用到该目录的某个子目录时,将会取得来自服务器端的NFS文件系统资源,并进行自动挂载的操作
[root@y_zilong ~]# yum install -y autofs
[root@y_zilong ~]# systemctl enable --now autofs
4. 挂载光盘到网页/var/www/html/centos/7/os目录
[root@y_zilong ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 300M 0 part /boot
├─sda2 8:2 0 2G 0 part [SWAP]
└─sda3 8:3 0 17.7G 0 part /
sr0 11:0 1 4.1G 0 rom
sr1 11:1 1 4.4G 0 rom /var/www/html/centos/7/os
[root@y_zilong ~]# cd /var/www/html
[root@y_zilong html]# mount /dev/sr1 centos/7/os
5.使用本地网络yum仓库的服务器配置本地源
[root@y_zilong yum.repos.d]# cat base.repo
[base]
name=Centos
baseurl=http://10.0.0.102/centos/7/os/
enabled=1
gpgcheck=0
[root@y_zilong yum.repos.d]#
[root@y_zilong yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
(1/2): base/group_gz | 165 kB 00:00:00
(2/2): base/primary_db | 3.2 MB 00:00:00
Determining fastest mirrors
repo id repo name status
base Centos 4,067
repolist: 4,067