yum仓库源搭建

本地yum源搭建

cd源  mount /dev/sr0 /mnt   

 vim  /etc/yum.repos.d/base.repo

[centos-base]
name=centos7
#baseurl=file:///var/www/html/centos/
baseurl=file:///mnt
enabled=1
gpgcheck=0

yum clean all

yum makecache

yum repolist

iso源  mount -o loop centos7.4.iso /mnt  同上

http源  服务端:cp  -R  /mnt/*  /var/www/html/centos

createrepo /var/www/html/centos

yum install -y httpd

ps -ef |grep httpd && netstat -antup |grep 80

getenforce 0 && systemctl stop firewalld.service

客户端:vim /etc/yum.repos.d/base.repo

[centos-base]
name=centos7
baseurl=http://192.168.0.1/centos/
enabled=1
gpgcheck=0

yum clean all

yum makecache

yum repolist

同步外网yum源

使用reposync工具可以同步几乎所有的yum源,同步外网yum源软件至本地

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 

mv  CentOS7-Base-163.repo  /etc/yum.repos.d/centos.repo

yum clean all

yum makecache

安装reposync工具

yum install -y createrepo

通过reposync命令工具获取外网yum源所有软件包,-r指定repolist id,默认不加-r表示获取玩玩所有yum软件包,-p 指定下载软件的路径

reposync  -r base -p /var/www/html/centos/

reposync  -r updates -p /var/www/html/centos/

通过createrepo命令更新本地yum仓库源

createrepo /var/www/html/centos/

修改本地yum源配置文件

vim centos.repo

centos-base]
name=centos7
baseurl=file:///var/www/html/centos/
#baseurl=file:///mnt
enabled=1
gpgcheck=0

猜你喜欢

转载自www.cnblogs.com/xiaofeng666/p/10124483.html