温馨提示×

Yum仓库配置步骤是什么

小樊
63
2025-03-06 01:52:08
栏目: 编程语言

配置Yum仓库的步骤如下:

本地Yum仓库配置步骤

  1. 挂载光盘或镜像文件
  • 挂载光盘:
    mount /dev/cdrom /mnt 
  • 挂载ISO镜像文件:
    mkdir /mnt/centos7.5 mount /opt/CentOS-7-x86_64-DVD-1611.iso /mnt/centos7.5 
  1. 备份原有的Yum源
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak 
  1. 创建新的Yum配置文件
  • 创建CentOS.Base.repo配置文件:
    cd /etc/yum.repos.d/ vim CentOS.Base.repo 
  • 配置文件内容示例:
    [centos7.5] name=centos7.5 baseurl=file:///mnt/centos7.5 enabled=1 gpgcheck=0 gpgkey=file:///mnt/centos7.5/RPM-GPG-KEY-CentOS-7 
  1. 更新Yum缓存
yum clean all yum makecache 
  1. 验证配置
yum repolist 

使用Aliyun官方Yum仓库配置步骤

  1. 进入Yum源配置文件目录
cd /etc/yum.repos.d/ 
  1. 下载Aliyun的Yum源配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 
  1. 安装必要的软件包
yum install -y cowsay 
  1. 运行cowsay程序
cowsay "Goodbye 2023, hello 2024!" 

局域网内共享Yum仓库配置步骤

  1. 在一台服务器上配置Yum源

  2. 使用httpd服务让其他服务器访问

yum install -y httpd systemctl start httpd systemctl enable httpd 

以上是配置Yum仓库的基本步骤,具体操作可能会因不同的Linux发行版和具体需求而有所差异。

0