内网服务器如何配置yum

提前准备:

  • Yum源服务器:
    可以是内网的任意服务器,要保证服务器空间足够
  • Yum源镜像文件
    这里可以用已下载的repo包集,也可以用iso镜像

步骤:

  1. yum源服务端:

  • 上传yum镜像并挂载到/mnt/iso
mkdir /mnt/iso
mount -o loop -t iso9660 xxx.iso /mnt/iso/
  • 移除默认yum文件
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak/
  • 新建NeoKylin.repo,内容如下
[xxx]# vi private.repo
[private]
name=isofile
baseurl=file:///mnt/iso
enabled=1
gpgcheck=0
gpgkey=file:///mnt/iso/RPM-GPG-KEY-neokylin-release
  • 查看yum源
yum clean all
yum makecache
yum repolist
  • 安装httd并设置开机启动
yum -y install httpd
systemctl start httpd
systemctl enable httpd
  • 关闭本机防火墙
systemctl stop firewalld
systemctl disable firewalld
  • 创建软连接
ln -s /mnt/iso /var/www/html
  1. yum源客户端:

  • 移除原有yum源
cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak/
  • 新建yum源文件private.repo
[xxx]# cat private.repo
[private]
name=isofile
baseurl=http://10.x.x.x/iso
enabled=1
gpgcheck=0
gpgkey=http://10.x.x.x/iso/RPM-GPG-KEY-neokylin-release
  • 更新yum源
yum clean all
yum makecache

你可能感兴趣的:(服务器,linux,运维)