linux 搭载yum远程仓库

@

yum私有仓库远程版

为什么需要搭载远程版?
如果使用本地版那么每一台机器都需要搭载yum本地仓库
远程版的意义是在一台机器上搭载仓库其他机器可以直接用

1)参考本地版前6步

2)安装远程访问(Nginx)

由于使用的是本地源,未关闭无法下载
# 执行添加以下两个源
			[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
			[root@localhost ~]# yum-config-manager --add-repo=https://repo.huaweicloud.com/epel/7/x86_64/
			[root@localhost ~]# yum install nginx --nogpgcheck(忽略公钥)

3)修改nginx的配置文件

# 寻找nginx的配置文件
[root@localhost ~]# rpm -qc nginx
/etc/logrotate.d/nginx
/etc/nginx/fastcgi.conf
/etc/nginx/fastcgi.conf.default
/etc/nginx/fastcgi_params
/etc/nginx/fastcgi_params.default
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/mime.types.default
/etc/nginx/nginx.conf(# 此为Nginx的配置文件)
/etc/nginx/nginx.conf.default
/etc/nginx/scgi_params
/etc/nginx/scgi_params.default
/etc/nginx/uwsgi_params
/etc/nginx/uwsgi_params.default
/etc/nginx/win-utf

修改nginx的配置文件
https://nginx.org/en/docs/http/ngx_http_autoindex_module.html

[root@localhost ~]# vim /etc/nginx/nginx.conf
# include /etc/nginx/conf.d/*.conf;
root         /opt/repos;
autoindex on;

# 测试更改是否成功
[root@localhost ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# 尾部出现 successful 表示成功

# 启动nginx
[root@localhost ~]# systemctl start nginx

# 关闭selinux和firewalld
[root@localhost ~]# systemctl disable --now firewalld
[root@localhost ~]# setenforce 0

首先 ip a 查看自己的网卡
浏览器中输入网卡,博主是http://192.168.15.101若进去就能查看
如果可以进入,表示成功一半

接下来打开另一个虚拟机
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# yum install yum-utils -y
# 备份源
[root@localhost yum.repos.d]# mv *.repo backup
[root@localhost yum.repos.d]# ll
总用量 0
drwxr-xr-x. 2 root root 220 12月 16 20:48 backup

# 添加源
			[root@localhost yum.repos.d]# yum-config-manager --add-repo=http://192.168.15.101/
			
# 刷新源
[root@localhost yum.repos.d]# yum clean all 
[root@localhost yum.repos.d]# yum makecache

上篇搭载本地

posted @ 2021-12-16 22:05  谢俊杰  阅读(116)  评论(0)    收藏  举报