建立本地源
1、建立yum仓库
#mkdir -p /yum/local
#cp /media/cdrom/Packages/rpm* /yum/local
建立一个目录将光盘的安装包复制到文件夹/local上
2、建立repo文件
#cat >>/etc/yum.repos.d/CentOS-Local.repo<<-EOF
[Local]
name=Local Yum
baseurl=file:///yum/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1
EOF
name:源名字
baseurl:源路径
gpgcheck=1:验证合法性
gpgkey:公钥路径
enabled=1:此仓库是否可被使用
3、安装createrepo
#yum install createrepo
#rpm -ivh <a href="[http://mirror.centos.org/centos/7/os/x86_64/Packages/createrepo-0.9.9-28.el7.noarch.rpm">http://mirror.centos.org/centos/7/os/x86_64/Packages/createrepo-0.9.9-28.el7.noarch.rpm</a>
createrepo:创建仓库的软件包
4、创建索引
createrepo /yum
yum makecache
网友评论