1、修改IP
[root@localhost ~]# sed -i 's#.200#.50#g' /etc/sysconfig/network-scripts/ifcfg-eth[01]
[root@localhost ~]# systemctl restart network
2、关闭selinux
/etc/selinux/config
1、临时关闭
[root@localhost ~]# setenforce 0
2、永久关闭
[root@localhost ~]# vi /etc/selinux/config
SELINUX=disabled
3、关闭默认的防火墙 [root@localhost ~]# systemctl disable --now firewalld
disable : 禁用
enable : 启用
--now :立即执行
4、安装web服务软件以及yum仓库软件
1、清理yum源
[root@localhost yum.repos.d]# mkdir backup
[root@localhost yum.repos.d]# mv ./*.repo* backup/
[root@localhost yum.repos.d]# ll
total 4
drwxr-xr-x. 2 root root 4096 Sep 24 09:15 backup
2、安装base源和epel源
[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
[epel]
name="epel"
baseurl=https://repo.huaweicloud.com/epel/7/x86_64/
gpgcheck=0
yum clean all
yum makecache
3、安装
yum install nginx yum-utils createrepo -y
5、建立仓库
[root@localhost yum.repos.d]# mkdir -p /yumrepo3/Packages
6、下载软件
curl -o /yumrepo3/Packages/zip-3.0-11.el7.x86_64.rpm https://repo.huaweicloud.com/centos/7/os/x86_64/Packages/zip-3.0-11.el7.x86_64.rpm
扩展内容: curl 和 wget 之间的区别
curl 是用来访问链接的
-o : 指定保存文件的路径
curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
wget 是用来下载文件的
-O :指定下载文件的路径
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
7、修改Nginx配置文件
[root@localhost ~]# vi /etc/nginx/nginx.conf
# 大致在42行左右
root /yumrepo3;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
8、重启Nginx服务
systemctl restart nginx
9、初始化yum仓库
createrepo /yumrepo3
10、编写yum源测试
[root@localhost yum.repos.d]# vi local.repo
[root@localhost yum.repos.d]# cat local.repo
[local]
name="This is Local repo"
baseurl=http://192.168.15.50/
gpgcheck=0
11、更新yum源 yum clean all yum makecache
12、测试安装
yum remove zip -y
yum install zip -y