云计算实训07——本地yum源及网络yum源配置、nginx源安装配置、自建yum源仓库、安装createrepo制作仓库软件

一、本地yum源光盘配置

1.查看现有的yum仓库镜像
2.查看所有镜像文件
3.将yum.repos.d下的所有文件打包成压缩包
4.删除yum.repos.d下以.repo结尾的文件
5.配置yum源仓库
yum仓库的格式

|----|---------------------------------|
| 编号 | 属性 |
| 1 | [仓库名称] 可以有多个仓库 |
| 2 | name=仓库描述 |
| 3 | baseurl=仓库的路径,支持多种格式file:///mnt |
| 4 | enabled=1/0 是否启用当前仓库,1启用,0不启用 |
| 5 | gpgcheck=0/1表示秘钥检测,0不检测,1检测 |

6.显示以配置的文件仓库列表及各个软件仓库的软件包数量

此时发现报错,而仓库数量显示为0

然后我们回到虚拟机,发现虚拟机设置中的设备状态,没有选中已连接

只需选中已连接,然后点击确定就好了

7.挂载虚拟光盘,将、/dev/cdrom挂载到mnt目录下,然后再次查看仓库数量

查看磁盘挂载情况

8.编辑永久挂载的文件
9.自动挂载

为方便后续操作,我们安装vim及net-tools

由于新建的虚拟机没有vim指令,只有vi,安装vim后我们能正常使用vim指令

安装net-tools后我们可以使用ifconfig命令,更方便我们查看虚拟机IP地址

10.测试yum

查看是否安装httpd

卸载httpd

再次查看是否安装httpd

重新安装httpd

再次查看是否安装httpd

二、网络yum源配置

1.百度搜索框搜索"阿里mirror镜像站点"

点击下载地址:
https://developer.aliyun.com/mirror/centos

2.根据官方提示配置yum源

(1)下载

(2)生成缓存
yum makecache

(3)清空内存
yum clean all

(4)查看源
yum repolist all

3.epel源配置

(1)下载epel软件包
yum -y install epel-release

(2)查看安装情况

(3)使用ls查看yum.repos.d目录

4.安装小火车

(1)安装软件包:
yum -y install sl

(2)使用sl查看,可以看到小火车图案

三、特定软件源配置--nginx

1.搜nginx的镜像

百度搜索 https://nginx.org/

2.搜document
3.搜install
4.点击packages
5.找到repo⽂件内容
6.安装稳定版本

root@localhost \~\]# vim /etc/yum.repos.d/nginx.repo ![](https://i-blog.csdnimg.cn/direct/3eedceed75b94aa4b2e64965723c99c5.png) ##### 7.创建缓存 \[root@localhost \~\]# yum clean all \[root@localhost \~\]# yum makecache \[root@localhost \~\]# yum list\|grep nginx ##### 8.安装并且检查 \[root@localhost \~\]# yum install nginx -y ##### 9.启动服务 \[root@localhost \~\]# nginx ##### 10. 查看指令 \[root@localhost \~\]# whereis nginx ##### 11. 访问服务器 \[root@localhost \~\]# curl http://localhost ##### 12.停⽤nginx \[root@localhost \~\]# nginx -s stop ##### 13.访问测试 \[root@localhost \~\]# curl http://localhost ### 四、⾃建yum源仓库 ##### 1.缓存安装软件包 -----使得下一次还能够使用 ##### 2.如何缓存 > \[root@localhost \~\]#vim /etc/yum.conf > \[main

cachedir=/var/cache/yum/basearch/releaserver # 定义软件包缓存路径
keepcache=1 #开启缓存
debuglevel=2
logfile=/var/log/yum.log

3.卸载,然后安装nginx 查看缓存⽂件

(1)卸载

root@localhost \~\]# yum -y remove nginx.x86_64 (2)安装 \[root@localhost \~\]# yum -y install nginx (3)查找安装包 > \[root@localhost \~\]# find /var/cache/ -name "\*tree\*" -type f > /var/cache/yum/x86_64/7/os/packages/tree-1.6.0-10.el7.x86_64.rpm > \[root@localhost \~\]# find /var/cache/ -name "\*nginx\*" -type f /var/cache/yum/x86_64/7/nginx-stable/packages/nginx-1.26.1-2.el7.ngx.x86_64.rpm (4)只下载不安装 \[root@localhost \~\]# yum install --downloadonly --downloaddir=./soft samba \[root@localhost \~\]# ls soft/ ### 五、安装createrepo制作仓库软件 ##### 1.下载createrepo的安装包 > \[root@localhost \~\]# yum -y install createrepo ##### 2.把soft⽂件夹做成⼀个本地的⾃建仓库 > \[root@localhost \~\]# createrepo soft/ > > \[root@localhost \~\]# ls ![](https://i-blog.csdnimg.cn/direct/5f6092198adc4de682823bc5589a81d8.png) \[root@localhost \~\]# cd soft/ \[root@localhost soft\]# ls ##### 3.在/etc/yum.repos.d/下创建 soft.repo > vim /etc/yum.repos.d/soft.repo > \[soft

name=soft_local
gpgcheck=0
baseurl=file:///root/soft
enable=1

4.删除其他仓库⽂件

root@localhost soft\]# rm -rf /etc/yum.repos.d/\*.repo \[root@localhost soft\]# ls /etc/yum.repos.d/ repo.tar.gz

5.配置仓库⽂件

root@localhost soft\]# vim /etc/yum.repos.d/soft.repo

6.创建缓存

root@localhost soft\]# yum clean all 已加载插件:fastestmirror 正在清理软件源: soft Cleaning up list of fastest mirrors Other repos take up 748 M of disk space (use --verbose for details) \[root@localhost soft\]# yum makecache 已加载插件:fastestmirror

7. 再次安装samba

root@localhost soft\]# yum -y install samba

相关推荐
Johny_Zhao8 小时前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
NineData13 小时前
数据库迁移总踩坑?用 NineData 迁移评估,提前识别所有兼容性风险
数据库·程序员·云计算
闲云一鹤2 天前
nginx 快速入门教程 - 写给前端的你
前端·nginx·前端工程化
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash2 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行4 天前
Linux和window共享文件夹
linux