首页 > 其他 > 详细

制作内网yum仓库

时间:2021-06-17 00:26:13      阅读:33      评论:0      收藏:0      [点我收藏+]

nginx官方源

cat > /etc/yum.repos.d/nginx.repo << ‘EOF‘

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

EOF
yum makecache fast -y

需要的软件

createrepo
nginx


yum install nginx createrepo -y

配置索引模块

rm -rf /etc/nginx/conf.d/*
[root@web-7 /etc/nginx/conf.d]# 

cat > /etc/nginx/conf.d/yum.conf << ‘EOF‘
server {
 listen 80;
 server_name yum.linux08.com;
 location / {
 autoindex on;
 autoindex_exact_size off;
 autoindex_localtime on;
 autoindex_format html;
 charset utf-8,gbk;
 root /data/yum;
 index index.html index.htm;
 }
}

EOF


安装createrepo


[root@web-7 /etc/nginx/conf.d]# yum install createrepo -y

准备软件仓库

[root@web-7 /etc/nginx/conf.d]# 

yum install -y --downloadonly --downloaddir=/data/yum vim

生成yum元数据

[root@web-7 /etc/nginx/conf.d]# cd /data/yum
[root@web-7 /etc/nginx/conf.d]# createrepo /data/yum
[root@web-7 /etc/nginx/conf.d]# createrepo --update /data/yum

客户端生成本地源

mv /etc/yum.repos.d/* /tmp

cat > /etc/yum.repos.d/local.repo << ‘EOF‘ 
[local]
name=local
enable=1
gpgcheck=0
baseurl=http://10.0.0.149
EOF


添加阿里源(可选)

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i ‘/aliyuncs/d‘ /etc/yum.repos.d/CentOS-Base.repo
yum makecache fast
ll /etc/yum.repos.d/

客户端测试安装

[root@m-61 /etc/yum.repos.d]# yum makecache fast 
[root@m-61 /etc/yum.repos.d]# yum search nginx
[root@m-61 /etc/yum.repos.d]# yum install nginx 


更改本地hosts文件

制作内网yum仓库

原文:https://www.cnblogs.com/jinglobal/p/14891467.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!