云计算实训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

相关推荐
东城绝神12 小时前
《Linux运维总结:基于ARM64+X86_64架构CPU使用docker-compose一键离线部署mongodb 7.0.22容器版分片集群》
linux·运维·mongodb·架构·分片集群
Akamai中国13 小时前
运维逆袭志·第4期 | 安全风暴的绝地反击 :从告警地狱到智能防护
运维·人工智能·云计算·云服务·云存储
peiwang24513 小时前
Linux系统中CoreDump的生成与调试
java·linux·开发语言
小立爱学习13 小时前
Linux 内存 --- get_user_pages/pin_user_pages函数
linux·c语言
江公望13 小时前
Qt enum ApplicationAttribute枚举值浅解
linux·qt
青鱼入云13 小时前
对比nginx、kong、apisix、zuul、gateway网关
nginx·gateway·kong
kailp13 小时前
OpenAI发布AI浏览器Atlas:探索下一代网页交互新可能
人工智能·大模型·云计算·aigc·算力
Yuki’13 小时前
Linux系统的ARM库移植
linux·arm开发
报错小能手14 小时前
linux学习笔记(51)Redis发布订阅 主从复制 缓存 雪崩
linux·笔记·学习
程序猿编码14 小时前
轻量级却实用:sigtrace 如何靠 ptrace 实现 Linux 信号的捕获与阻断(C/C++代码实现)
linux·c语言·c++·信号·捕获·ptrace