配置Yum仓库的步骤如下:
本地Yum仓库配置步骤
- 挂载光盘或镜像文件
- 挂载光盘:
mount /dev/cdrom /mnt
- 挂载ISO镜像文件:
mkdir /mnt/centos7.5 mount /opt/CentOS-7-x86_64-DVD-1611.iso /mnt/centos7.5
- 备份原有的Yum源
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
- 创建新的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
- 更新Yum缓存
yum clean all yum makecache
- 验证配置
yum repolist
使用Aliyun官方Yum仓库配置步骤
- 进入Yum源配置文件目录
cd /etc/yum.repos.d/
- 下载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
- 安装必要的软件包
yum install -y cowsay
- 运行cowsay程序
cowsay "Goodbye 2023, hello 2024!"
局域网内共享Yum仓库配置步骤
-
在一台服务器上配置Yum源
-
使用httpd服务让其他服务器访问
yum install -y httpd systemctl start httpd systemctl enable httpd
以上是配置Yum仓库的基本步骤,具体操作可能会因不同的Linux发行版和具体需求而有所差异。