[root@node1 tmp]# yum install wget yum-utils createrepo nginx -y [root@node1 tmp]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo [root@node2 ~]# wget -O /etc/yum.repos.d/docker.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo [root@node1 tmp]# cat > pkg.list <<EOF docker-ce-19.03.4 docker-python docker-compose python-chardet python-requests chrony audit rsync jq git tcpdump nc bind-utils net-tools ipvsadm graphviz EOF [root@node1 tmp]# mkdir rpms [root@node1 tmp]# yum install -y --downloadonly --downloaddir=rpms $(cat pkg.list) [root@node1 tmp]# createrepo rpms/ [root@node1 tmp]# sed '/default_server/ s/^/#/' /etc/nginx/nginx.conf -i [root@node1 tmp]# cat > /etc/nginx/conf.d/test.conf <<EOF server { listen 80; server_name localhost; location / { root /tmp/tmp; index index.html; autoindex on; } error_page 500 502 503 504 /50x.html; location = 50x.html { root /usr/share/nginx/html; } } EOF
[root@node1 rpms]# cat /tmp/tmp/index.html <!DOCTYPE html> <html> <head> <title>Wise2C Yum Repo for Docker/K8S/Ceph/NFS installation</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Wise2C Yum Repo for Docker/K8S/Ceph/NFS installation</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> <br /> <br /> <a href = "rpms" >Enter the RPM folder </a><br /> <br /> <br /> <p><em>Please create the file wise2c.repo as below and then move to /etc/yum.repos.d/</em></p> <script type="text/javascript"> var ip = location.host; var comment = "###############################################"; document.write(comment.fontcolor("Red")); document.write("<pm><em></em></p>"); document.write("[wise2c]"+"<br>"); document.write("name=wise2c"+"<br>"); document.write("baseurl=http://"+(ip)+"/rpms"+"<br>"); document.write("enabled=1"+"<br>"); document.write("gpgcheck=0"+"<br>"); document.write("<pm><em></em></p>"); document.write(comment.fontcolor("Red")); </script> </body> </html>
[root@node1 tmp]# cd [root@node1 ~]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@node1 ~]# nginx -s reload
測試沒有問題:javascript
[root@node1 ~]# cat > /etc/yum.repos.d/docker.repo <<EOF [wise2c] name=wise2c baseurl=http://192.168.38.145/rpms enabled=1 gpgcheck=0 EOF [root@node1 ~]# yum install docker-ce-19.03.4 -y