内网配置yum repo服务

本文档详细介绍了如何在内网环境中,将Redhat服务器的yum替换为Centos服务,以及如何搭建内网yum repo服务。首先,通过更换yum包并配置CentOS-Base.repo文件来使未注册的Redhat服务器使用Centos源。然后,针对内网环境,通过将CentOS ISO镜像加载到服务器并配置本地源,实现离线安装基础服务包。最后,通过安装httpd和creatrepo服务,搭建本地yum仓库,并在客户端配置指向该仓库的源。
部署运行你感兴趣的模型镜像
    
背景:现有服务器放在内网,且服务器版本为未注册的redhat,无法提供yum服务。
目标:在内网中搭建yum repo服务,使同一个域中的机器均可使用yum。
思路:完成该任务需要解决以下三个问题:
(1)服务器操作系统版本为redhat ,虽然本地已经有yum源的包,但未经注册无法使用。
(2)服务器在内网,无法直接连接外网开源的yum源,如网易源和阿里源。
(3)搭建Yum repo,这样该域内的服务器均只需通过配置即可获得yum服务,无需每台机器都安装。
解决过程:
问题(1):将redhat的yum修改为使用centos的yum服务
1、cat  /etc/redhat-release , 查看服务器版本:
     Red Hat Enterprise Linux Server release 6.5 (Santiago)
2、rpm -qa |grep yum   查看服务器上的yum包,如下:
    yum-metadata-parser-1.1.2-16.el6.x86_64
    yum-utils-1.1.30-14.el6.noarch
    yum-3.2.29-30.el6.noarch
    yum-rhn-plugin-0.9.1-40.el6.noarch
    yum-plugin-security-1.1.30-14.el6.noarch
3、rpm -e (包名)  --nodeps      忽略关联关系,删除服务器上的yum包
4、外网登录网易云    http://mirrors.163.com/centos/6/os/x86_64/Packages/    找到以下5个包,下载,通过sftp传到服务器上。

5、rpm -ivh (包名) --nodeps   安装第四步下载好的5个包。
到目前为止,redhat上的yum包已被替换。如果此机器可以连接外网,则可以直接按照以下第6步配置即可。
【6】、 vi /etc/yum.repos.d/CentOS-Base.repo    (ps:如果比较信任所连接的源,则可配置 gpgcheck =0  ,这样可以跳过验证
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.

[base]
name=CentOS-6 - Base - 163.com
gpgcheck=0

#released updates
[updates]
name=CentOS-6 - Updates - 163.com
gpgcheck=1

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
gpgcheck=0

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
gpgcheck=1
enabled=0

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
gpgcheck=1
enabled=0

实际上,我的服务器在内网,无法连接internet,需解决问题(2):将外网的包直接load到内网服务器上。
2、通过sftp上传到内网服务器/data_disk/iso 文件夹中

3、服务器设置yum 软件仓库
(1)mkdir /mnt    新建文件夹 /mnt/  
(2)mount -o loop /data_disk/mnt/ CentOS-6.9-x86_64-bin-DVD1.iso  /mnt/     将iso 文件挂载 
(3)df -h 查看挂载情况,如下说明已经挂载完成。

4、vi /etc/yum.repos.d/CentOS6-Base-163.repo   将[base ] [ updates  ][ extras ]中的baseurl  指向本地源所在文件夹 ,即 baseurl=file:///mnt/    暂时将gpgcheck关闭,即gpgcheck=0 ,整个文件配置如下。

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.

[base]
name=CentOS-6 - Base - 163.com
baseurl=file:///mnt/
gpgcheck=0

#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=file:///mnt/
gpgcheck=1

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=file:///mnt/
gpgcheck=0

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
gpgcheck=1
enabled=0

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
gpgcheck=1
enabled=0

完成以上配置后,本地机器即可通过yum服务进行基础服务包的安装。
问题(3):搭建本地yum repo
1、   yum install httpd creatrepo   在作为仓库的服务器端的机器上,安装httpd服务和创建yum源的服务
2、vi /etc/httpd/conf/httpd.conf    进入配置文件修改httpd服务的 apache配置,修改文件中的 ServerName  内网ip:端口  (端口用80端口,试过改成其他端口无法使用,暂时还没找到原因)
3、客户端配置:vi /etc/yum.repos.d/CentOS6-Base-163.repo     新建一个yum的配置文件,复制如下内容,注意标红的内网ip:端口 即为第2步中服务端配置的内网ip和端口。

#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.

[base]
name=CentOS-6 - Base - 163.com
#baseurl=file:///mnt/
baseurl=http:// 内网ip:端口 /yum/CentOS/
gpgcheck=0
gpgkey=file:///var/www/html/yum/CentOS

#released updates
[updates]
name=CentOS-6 - Updates - 163.com
#baseurl=file:///mnt/
baseurl=http:// 内网ip:端口 /yum/CentOS/
gpgcheck=0
gpgkey=file:///var/www/html/yum/CentOS

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
#baseurl=file:///mnt/
baseurl=http:// 内网ip:端口 /yum/CentOS/
gpgcheck=0
gpgkey=file:///var/www/html/yum/CentOS

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http:// 内网ip:端口 /yum/CentOS/
gpgcheck=0
enabled=0
gpgkey=file:///var/www/html/yum/CentOS

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http:// 内网ip:端口 /yum/CentOS/
gpgcheck=0
enabled=0
gpgkey=file:///var/www/html/yum/CentOS

完成以上配置后,内网yum仓库即配置完成。


您可能感兴趣的与本文相关的镜像

GPT-SoVITS

GPT-SoVITS

AI应用

GPT-SoVITS 是一个开源的文本到语音(TTS)和语音转换模型,它结合了 GPT 的生成能力和 SoVITS 的语音转换技术。该项目以其强大的声音克隆能力而闻名,仅需少量语音样本(如5秒)即可实现高质量的即时语音合成,也可通过更长的音频(如1分钟)进行微调以获得更逼真的效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值