序号 | 修订内容 | 修订时间 |
---|---|---|
1 | 新增 | 2021/2/21 |
本文主要介绍搭建内网yum 源,以centos8.1 内网系统源为例。使用nginx 作为web 服务器。
[root@10-3-170-32 ~]# createrepo --version
createrepo 0.9.9
[root@10-3-170-32 ~]#
[root@10-3-170-32 ~]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.18.0
[root@10-3-170-32 ~]#
[dev@10-3-170-32 ~]$ cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)
[dev@10-3-170-32 ~]$
使用xshell 等软件上传到服务器。
[root@10-3-170-32 mnt]# rm -rf centos81/
[root@10-3-170-32 mnt]# mkdir /mnt/centos81
[root@10-3-170-32 mnt]# cd centos81/
[root@10-3-170-32 centos81]# pwd
/mnt/centos81
[root@10-3-170-32 centos81]# mount /home/yunwei/software/centos/CentOS-8.1.1911-x86_64-dvd1.iso /mnt/centos81/
mount: /dev/loop0 写保护,将以只读方式挂载
检查挂载是否成功
root@10-3-170-32 mnt]# cd centos81/
[root@10-3-170-32 centos81]# ll
总用量 12
dr-xr-xr-x 4 root root 2048 1月 4 2020 AppStream
dr-xr-xr-x 4 root root 2048 1月 4 2020 BaseOS
dr-xr-xr-x 3 root root 2048 1月 4 2020 EFI
dr-xr-xr-x 3 root root 2048 1月 4 2020 images
dr-xr-xr-x 2 root root 2048 1月 4 2020 isolinux
-r--r--r-- 1 root root 87 1月 4 2020 media.repo
-r--r--r-- 1 root root 664 1月 4 2020 TRANS.TBL
[root@10-3-170-32 centos81]# df -h | grep centos81
/dev/loop0 7.1G 7.1G 0 100% /mnt/centos81
[root@10-3-170-32 centos81]#
[root@10-3-170-32 localyum]# cp -r /mnt/centos81/ /data/localyum/
createrepo /data/localyum/centos81/
centos81.mirror.digital.com 这个用你对应的域名
[root@10-3-170-32 conf.d]# cat centos81mirror.conf
server {
listen 80;
server_name centos81.mirror.digital.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /data/localyum/centos81;
autoindex on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
重启nginx
[root@10-3-170-32 conf.d]# /usr/local/nginx/sbin/nginx -s reload
[base]
name=CentOSBase
baseurl=http://centos81.mirror.digital.com
gpgcheck=0
enabled=1
原文:https://www.cnblogs.com/weiwei2021/p/14425681.html