1. 程式人生 > 其它 >linux 搭載yum遠端倉庫

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

上篇搭載本地