当前位置: 代码迷 >> 综合 >> 将下载下来的rpm包生成自己的yum源
  详细解决方案

将下载下来的rpm包生成自己的yum源

热度:58   发布时间:2024-01-25 04:54:37.0
由于服务器的网络并不是都与外网通,所以需要将外网传过来的包存到本地,搭建一个本地yum源,供其他机器使用
1.开启包缓存
sed -i 's/keepcache=0/keepcache=1y/g'  /etc/yum.conf
 
2.安装createrepo软件包
yum install createrepo
 

3.将安装包移动到某个位置

mv /var/cache/yum/x86_64/6/*/packages/* /root/yum/
 

4.创建yum源xml

mkdir -p  /root/yum/repodata/
touch /root/yum/repodata/myyum.xml
createrepo -g /root/yum/repodata/myyum.xml  /root/yum/
 

5.编辑yum源配置

cd  /etc/yum.repos.d
vi test.repo
 
[test]
name=base
baseurl=file:///root/yum
enabled=1
gpgcheck=0
 
可以使用ftp共享baseurl=ftp://192.168.0.6/pub/Server 
 

6.测试

yum repolist
 
7 以后若有新增的包 重做第3-4部就可以了
  相关解决方案