镜像挂载
/data/img/CentOS-7-x86_64-Everything-1908.iso /rhel7/dvd/ iso9660 loop,ro 0 0
mount -a
安装nginx,让其作为下载服务器使用
yum -y install nginx
[root@localhost ~]# cat /etc/nginx/conf.d/repo.conf
server {
listen 80;
server_name localhost;
add_header Cache-Control no-cache;
underscores_in_headers on;
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
location /rh7dvd {
root /usr/share/nginx/html;
}
}
软连接
ln -s /rhel7/dvd /usr/share/nginx/html/rh7dvd
客户端
rm -rf /etc/yum.repos.d/*
vi /etc/yum.repos.d/rhel7.repo
[rhel7]
name=rhel7.0
baseurl=http://192.168.1.11/rh7dvd
enabled=1
gpgcheck=0
[root@localhost ~]# yum repolist
已加载插件:fastestmirror
Determining fastest mirrors
rhel7 | 3.6 kB 00:00:00
(1/2): rhel7/group_gz | 165 kB 00:00:00
(2/2): rhel7/primary_db | 6.0 MB 00:00:00
源标识 源名称 状态
rhel7 rhel7.0 10,097
repolist: 10,097