0


centos yum源配置

yum源配置

1.删除centos自带的yum源

[root@cloud ~]# rm -rf /etc/yum.repos.d/*

  1. 创建挂载点并挂载镜像

[root@cloud ~]# mkdir /opt/centos

[root@cloud ~]# mount /dev/cdrom /opt/centos/

mount: /dev/sr0 写保护,将以只读方式挂载

3.创建本地yum源

[root@cloud ~]# vi /etc/yum.repos.d/local.repo //编写本地yum源内容,内容如下

[centos]

name=centos # Yum源的名称,用于描述这个源

baseurl=file:///opt/centos # 本地Yum源的位置,指向挂载点目录

gpgcheck=0 # 不进行GPG签名检查

enabled=1 # 启用该Yum源

4.清楚旧yum源的缓存

[root@cloud ~]# yum clean all

已加载插件:fastestmirror, langpacks

正在清理软件源: crntos

Cleaning up list of fastest mirrors

Other repos take up 681 M of disk space (use --verbose for details)

5.更新yum源缓存

[root@localhost ~]# yum makecache

已加载插件:fastestmirror, langpacks

Determining fastest mirrors

crntos | 3.6 kB 00:00:00

(1/4): crntos/group_gz | 153 kB 00:00:00

(2/4): crntos/filelists_db | 3.3 MB 00:00:00

(3/4): crntos/primary_db | 3.3 MB 00:00:00

(4/4): crntos/other_db | 1.3 MB 00:00:00

元数据缓存已建立

6.下载httpd测试

[root@localhost ~]# yum install httpd

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

正在解决依赖关系

--> 正在检查事务

---> 软件包 httpd.x86_64.0.2.4.6-95.el7.centos 将被 安装

--> 正在处理依赖关系 httpd-tools = 2.4.6-95.el7.centos,它被软件包 httpd-2.4.6-95.el7.centos.x86_64 需要

--> 正在检查事务

---> 软件包 httpd-tools.x86_64.0.2.4.6-95.el7.centos 将被 安装

--> 解决依赖关系完成

依赖关系解决

=======================================================================================

Package 架构 版本 源 大小

=======================================================================================

正在安装:

httpd x86_64 2.4.6-95.el7.centos crntos 2.7 M

为依赖而安装:

httpd-tools x86_64 2.4.6-95.el7.centos crntos 93 k

事务概要

=======================================================================================

安装 1 软件包 (+1 依赖软件包)

总下载量:2.8 M

安装大小:9.5 M

Is this ok [y/d/N]: y //输入y,确认安装。

Downloading packages:


总计 146 MB/s | 2.8 MB 00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

正在安装 : httpd-tools-2.4.6-95.el7.centos.x86_64 1/2

正在安装 : httpd-2.4.6-95.el7.centos.x86_64 2/2

验证中 : httpd-tools-2.4.6-95.el7.centos.x86_64 1/2

验证中 : httpd-2.4.6-95.el7.centos.x86_64 2/2

已安装:

httpd.x86_64 0:2.4.6-95.el7.centos

作为依赖被安装:

httpd-tools.x86_64 0:2.4.6-95.el7.centos

完毕!

7.卸载httpd

[root@localhost ~]# yum remove httpd

已加载插件:fastestmirror, langpacks

正在解决依赖关系

--> 正在检查事务

---> 软件包 httpd.x86_64.0.2.4.6-95.el7.centos 将被 删除

--> 解决依赖关系完成

依赖关系解决

=======================================================================================

Package 架构 版本 源 大小

=======================================================================================

正在删除:

httpd x86_64 2.4.6-95.el7.centos @crntos 9.4 M

事务概要

=======================================================================================

移除 1 软件包

安装大小:9.4 M

是否继续?[y/N]:y

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

正在删除 : httpd-2.4.6-95.el7.centos.x86_64 1/1

验证中 : httpd-2.4.6-95.el7.centos.x86_64 1/1

删除:

httpd.x86_64 0:2.4.6-95.el7.centos

完毕!

8.检查httpd是否卸载,如果还有httpd的安装,则重复上一步把还在的httpd卸载即可

[root@localhost ~]# rpm -qa | grep httpd

标签: linux centos 服务器

本文转载自: https://blog.csdn.net/2201_75876611/article/details/141941330
版权归原作者 shuxu115 所有, 如有侵权,请联系我们删除。

“centos yum源配置”的评论:

还没有评论