1 环境说明
查看系统版本
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
设置主机名
[root@localhost ~]# hostnamectl --static set-hostname yum-cache
防火墙状态
[root@yum-cache ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
查看selinux状态
[root@yum-cache ~]# sestatus
SELinux status: disabled
查看iptables规则
[root@yum-cache ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
2 配置yum缓存
查看配置yum缓存后的配置文件
[root@yum-cache ~]# egrep -v "^$ | #" /etc/yum.conf
[main]
cachedir=/var/cache/yum # 设置rpm包缓存的路径
keepcache=1 # 默认为0,改为1