前言
本地源和网络源的搭建使用
一切都是自己的想法,如有问题欢迎及时纠正
一、本地源和网络源
本地源:
使用ISO搭建的本地YUM源,满足基本服务器所需的软件包或服务安装等
缺点:就是软件升级版本问题,比如php版本现在7以上,而ISO镜像里面的php在5.3版本
网络源:
网络源解决了版本更新的问题
缺点:暂且不知,后续再看
二、使用步骤
1.本地源
首先在虚拟机里面挂载ISO,并设置为启动
开机后挂载,这里先创建一个文件夹来挂载
代码如下(示例):
[root@hostlocal]# mkdir /ISO //创建一个ISO的文件夹
[root@hostlocal]# mount /dev/cdrom /ISO //将dev设备的cdrom(光盘)挂载到ISO文件夹里面
1.1
可以使用ls查看ISO文件夹里面的文件

1.2
这里我们来写个repo
代码如下(示例):
[root@hostlocal]# vim cdrom.repo
写入配置
[cdrom]
name=cdrom
baseurl=file:///ISO
enable=1
gpgcheck=0
[root@hostlocal]# cp -a cdrom.repo /etc/yum.repos.d/
1.3
这里使用YUM,缓存下来
[root@hostlocal]# yum makecache
到这里本地的YUM源配置就结束了
2.网络源
这里使用的是阿里云的镜像源网站
2.1
先使用wget下载EPEL
代码如下(示例):
[root@hostlocal]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@hostlocal]# yum clean all
[root@hostlocal]# yum makecache
先清除缓存,在使用yum makecache后可以看到服务器建立了数据缓存
2.2
在用rpm下载安装REMI
[root@hostlocal]# rpm -Uvh https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm
[root@hostlocal]# yum makecache
参考实用命令
[root@hostlocal]# yum repolist all | grep php
[root@hostlocal]# yum --enablerepo=remi info php
这里有个php源禁用的问题
使用命令查看后会发现源都是处于禁用状态,禁用状态下安装php会失败
[root@wnt-rhel7 yum.repos.d]# yum repolist all |grep php
remi-php54 Remi's PHP 5.4 RPM repository for 禁用
remi-php55 Remi's PHP 5.5 RPM repository for 禁用
remi-php55-debuginfo/x86_64 Remi's PHP 5.5 RPM repository for 禁用
remi-php56 Remi's PHP 5.6 RPM repository for 禁用
remi-php56-debuginfo/x86_64 Remi's PHP 5.6 RPM repository for 禁用
remi-php70 Remi's PHP 7.0 RPM repository for 禁用
remi-php70-debuginfo/x86_64 Remi's PHP 7.0 RPM repository for 禁用
remi-php70-test Remi's PHP 7.0 test RPM repository 禁用
remi-php70-test-debuginfo/x86_64 Remi's PHP 7.0 test RPM repository 禁用
remi-php71 Remi's PHP 7.1 RPM repository for 禁用
remi-php71-debuginfo/x86_64 Remi's PHP 7.1 RPM repository for 禁用
remi-php71-test Remi's PHP 7.1 test RPM repository 禁用
remi-php71-test-debuginfo/x86_64 Remi's PHP 7.1 test RPM repository 禁用
remi-php72 Remi's PHP 7.2 RPM repository for 禁用
remi-php72-debuginfo/x86_64 Remi's PHP 7.2 RPM repository for 禁用
remi-php72-test Remi's PHP 7.2 test RPM repository 禁用
remi-php72-test-debuginfo/x86_64 Remi's PHP 7.2 test RPM repository 禁用
remi-php73 Remi's PHP 7.3 RPM repository for 禁用
remi-php73-debuginfo/x86_64 Remi's PHP 7.3 RPM repository for 禁用
remi-php73-test Remi's PHP 7.3 test RPM repository 禁用
remi-php73-test-debuginfo/x86_64 Remi's PHP 7.3 test RPM repository 禁用
remi-php74 Remi's PHP 7.4 RPM repository for 禁用
remi-php74-debuginfo/x86_64 Remi's PHP 7.4 RPM repository for 禁用
remi-php74-test Remi's PHP 7.4 test RPM repository 禁用
remi-php74-test-debuginfo/x86_64 Remi's PHP 7.4 test RPM repository 禁用
remi-php80 Remi's PHP 8.0 RPM repository for 禁用
remi-php80-debuginfo/x86_64 Remi's PHP 8.0 RPM repository for 禁用
remi-php80-test Remi's PHP 8.0 test RPM repository 禁用
remi-php80-test-debuginfo/x86_64 Remi's PHP 8.0 test RPM repository 禁用
remi-php81 Remi's PHP 8.1 RPM repository for 禁用
remi-php81-debuginfo/x86_64 Remi's PHP 8.1 RPM repository for 禁用
remi-php81-test Remi's PHP 8.1 test RPM repository 禁用
remi-php81-test-debuginfo/x86_64 Remi's PHP 8.1 test RPM repository 禁用
一定要去你需要的remi-php你要使用的php版本的repo,把enable设置为1(默认为0)


然后在使用命令查看,可以看到已经启用
[root@wnt-rhel7 yum.repos.d]# yum repolist all |grep php
remi-php70-debuginfo/x86_64 Remi's PHP 7.0 RPM repository for 禁用
remi-php70-test Remi's PHP 7.0 test RPM repository 禁用
remi-php70-test-debuginfo/x86_64 Remi's PHP 7.0 test RPM repository 禁用
remi-php71 Remi's PHP 7.1 RPM repository for 禁用
remi-php71-debuginfo/x86_64 Remi's PHP 7.1 RPM repository for 禁用
remi-php71-test Remi's PHP 7.1 test RPM repository 禁用
remi-php71-test-debuginfo/x86_64 Remi's PHP 7.1 test RPM repository 禁用
remi-php72 Remi's PHP 7.2 RPM repository for 禁用
remi-php72-debuginfo/x86_64 Remi's PHP 7.2 RPM repository for 禁用
remi-php72-test Remi's PHP 7.2 test RPM repository 禁用
remi-php72-test-debuginfo/x86_64 Remi's PHP 7.2 test RPM repository 禁用
remi-php73 Remi's PHP 7.3 RPM repository for 禁用
remi-php73-debuginfo/x86_64 Remi's PHP 7.3 RPM repository for 禁用
remi-php73-test Remi's PHP 7.3 test RPM repository 禁用
remi-php73-test-debuginfo/x86_64 Remi's PHP 7.3 test RPM repository 禁用
remi-php74 Remi's PHP 7.4 RPM repository for 禁用
remi-php74-debuginfo/x86_64 Remi's PHP 7.4 RPM repository for 禁用
remi-php74-test Remi's PHP 7.4 test RPM repository 禁用
remi-php74-test-debuginfo/x86_64 Remi's PHP 7.4 test RPM repository 禁用
remi-php80 Remi's PHP 8.0 RPM repository for 启用: 355
remi-php80-debuginfo/x86_64 Remi's PHP 8.0 RPM repository for 禁用
remi-php80-test Remi's PHP 8.0 test RPM repository 禁用
remi-php80-test-debuginfo/x86_64 Remi's PHP 8.0 test RPM repository 禁用
remi-php81 Remi's PHP 8.1 RPM repository for 禁用
remi-php81-debuginfo/x86_64 Remi's PHP 8.1 RPM repository for 禁用
remi-php81-test Remi's PHP 8.1 test RPM repository 禁用
remi-php81-test-debuginfo/x86_64 Remi's PHP 8.1 test RPM repository 禁用
总结
以上就是本地YUM源和网络源(EPEL+REMI)
总的来说问题不是很大
本文分享了如何在RHEL系统中配置本地YUM源(通过ISO镜像)和网络源(EPEL+REMI),讨论了各自优缺点及使用步骤。本地源方便但软件版本可能过时,网络源能获取最新版本,但可能有未知问题。详细步骤包括ISO挂载、repo配置、yum缓存和EPEL、REMI源的启用。
3342

被折叠的 条评论
为什么被折叠?



