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
[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
[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
原文:https://www.cnblogs.com/jinglobal/p/14891467.html