(一)配置yum源
1.将系统yum进行打包备份,打包完成之后把文件中的 .repo 文件删除
![](https://i-blog.csdnimg.cn/direct/f41a98a6dc584f4ca84a30639c1752ed.png)
2.编辑本地镜像文件
![](https://i-blog.csdnimg.cn/direct/71094e0166ff481d9c89daab3625a35d.png)
![](https://i-blog.csdnimg.cn/direct/726440df702c4a8b8e1d84ac4ae2ee90.png)
此时使用yum repolist 查看发现并没有安装好我们的yum源
![](https://i-blog.csdnimg.cn/direct/0c9a7415d52f4039b44c5337f4b16ea7.png)
然后检查我们的光盘
![](https://i-blog.csdnimg.cn/direct/42ee13d1e0c242feaf1111ff05f96b58.png)
发现并没有连接,然后选定连接,选定完成之后进行挂载,在查看就行了
![](https://i-blog.csdnimg.cn/direct/06b07e125d014c1fae50a729f7b461d6.png)
然后用lsblk查看我们的挂载
![](https://i-blog.csdnimg.cn/direct/e0170e486f874e3a83ee9cce5033e3a6.png)
配置永久挂载、
![](https://i-blog.csdnimg.cn/direct/ac10d5f2180f41b8b78e794fd5957c7a.png)
![](https://i-blog.csdnimg.cn/direct/a8aec6a41c3847a2963ba9dd1c9db5e3.png)
配置完成之后,自动挂载一下,然后进行查看
![](https://i-blog.csdnimg.cn/direct/ec0916c0979b485bbe579a52c8b4deea.png)
(二)配置阿里官方云
1.首先去浏览器搜索阿里云镜像站,找到与我们系统匹配的源进行复制
![](https://i-blog.csdnimg.cn/direct/c12f1acac2394f689c3e01cc43cfbfd8.png)
![](https://i-blog.csdnimg.cn/direct/e9c668335e224271bd152b58ad9525ff.png)
2.然后回到我们虚拟机,用wget进行下载(没有wget的先下载wget)
wget下载:yum -y install wget
![](https://i-blog.csdnimg.cn/direct/9fc5dcf036f0448db94aee923d616376.png)
载完成之后先用yum clean all 清除一下,再用yum makecache生成存
![](https://i-blog.csdnimg.cn/direct/8f5e1b5e03ad41ae9fc4591081d25f77.png)
3.完成以上步骤之后就可以利用这个yum源查看到我们的python3
![](https://i-blog.csdnimg.cn/direct/91d95e219c874e26b5efc03f5a253cc5.png)
(三)下载epel仓库
1.安装
yum -y install epel-release.noarch
2.安装完成之后可以下载一个sl
yum -y install sl
输入sl 可以看见一个小火车
![](https://i-blog.csdnimg.cn/direct/6cd89b6f72eb442f89fdf602393d9c8f.png)
四)安装nginx
1.去nginx.org官网找到centos的源
![](https://i-blog.csdnimg.cn/direct/3838d8c57a8e4ec39e8916bd512eb2fe.png)
![](https://i-blog.csdnimg.cn/direct/c6038829afe448f9b539975e01735280.png)
![](https://i-blog.csdnimg.cn/direct/14234212befb4927b90986b7fbf7ffc7.png)
![](https://i-blog.csdnimg.cn/direct/399419d2a9544cdfa5e6ba48a97f3cdf.png)
将上图选中内容进行复制
然后回到我们虚拟机,将多余的yum源删除,然后修改本地yum源
rm -rf /etc/yum.repos.d/*
vim /etc/yum.repos.d/ln.repo
![](https://i-blog.csdnimg.cn/direct/2d6b8083e6a44f53a52bb5e20cd45188.png)
改完成之后清除缓存再yum makecache
yum clean all
yum makecache
2.完成之后就可以直接下载nginx了
yum -y install nginx
![](https://i-blog.csdnimg.cn/direct/0c88256497ce45459ea2f27b667f87ad.png)
然后启动nginx
[root@localhost~]#nginx
查看
[root@localhost~]#whereis nginx
![](https://i-blog.csdnimg.cn/direct/1565103fe10e47b3b8ff497fdad9d400.png)
# 访问服务器
[root@localhost ~]# curl http://localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</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>
</body>
</html>
# 停⽤nginx
[root@localhost ~]# nginx -s stop
您在 /var/spool/mail/root 中有新邮件
#访问测试
[root@localhost ~]# curl http://localhostcurl: (7) Failed connect to localhost:80; 拒绝连接
五)自建yum仓库
1.配置文件定义软件包缓存路径
[root@localhost ~]#vim /etc/yum.conf
![](https://i-blog.csdnimg.cn/direct/5cfbbad1a1e54f1596a133295ae7df0b.png)
2.卸载nginx,然后安装nginx 查看缓存⽂件
[root@localhost ~]#yum -y remove nginx
![](https://i-blog.csdnimg.cn/direct/475c05d31a514ab59f592a5a0160cda7.png)
[root@localhost ~]#yum -y install nginx
#查找安装包
![](https://i-blog.csdnimg.cn/direct/7e638fc22f1c4247b0ca8c3abff36f9f.png)
3.只下载不安装
![](https://i-blog.csdnimg.cn/direct/b9ccdca43d3348d0879db9c755bef82f.png)
4.安装createrepo制作仓库的软件
![](https://i-blog.csdnimg.cn/direct/3e12ff32830546aebcc688ebfdc9b56f.png)
5.把soft⽂件夹做成⼀个本地的⾃建仓库
root@localhost ~]# createrepo soft/
Spawning worker 0 with 19 pkgs
Workers FinishedSaving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost ~]# cd soft/
6.在/etc/yum.repos.d/下创建 soft.repo
root@localhost ~]# vim /etc/yum.repos.d/soft.repo
[soft]
name=soft_local
gpgcheck=0
baseurl=file:///root/soft
enable=1
root@localhost ~]# yum clean all
# 再次安装samba
![](https://i-blog.csdnimg.cn/direct/d4dc30a4d23c4b1a9a079abaf03a2e3a.png)
![](https://i-blog.csdnimg.cn/direct/e6ee6a83f31e42b5935725e7186f3c09.png)