linux 内网repo

本文介绍了如何将CentOS-7-x86_64-Everything-1908.iso镜像挂载并用Nginx作为下载服务器,通过配置Nginx的repo.conf文件和创建软链接,实现ISO文件的HTTP访问。然后在客户端配置yum源,通过yum reposync命令验证了服务器的设置成功。
摘要由CSDN通过智能技术生成

镜像挂载

/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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值