/dev/cdrom —-本地镜像挂载路径,如果是拷贝到服务器上的需要更改路径
baseurl=file:///mnt/iso/ —–rhel5 需要添加Server
直接全量复制粘贴接口快速创建本地yum源
mkdir /mnt/iso
mkdir /etc/yum.repos.d/old/
mv /etc/yum.repos.d/* /etc/yum.repos.d/old/
touch /etc/yum.repos.d/local.repo
cat >/etc/yum.repos.d/local.repo<<EOF
[base]
name=CentOS
baseurl=file:///mnt/iso/
gpgcheck=0
enabled=1
EOF
mount -o loop /dev/cdrom /mnt/iso
yum list
附加:
如果出现下面问题需要删除 :
rm /var/run/yum.pid
yum list
Failed to set locale, defaulting to C
Loaded plugins: product-id, security, subscription-manager
Updating Red Hat repositories.
Existing lock /var/run/yum.pid: another copy is running as pid 8534.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 34 M RSS (248 MB VSZ)
Started: Thu Mar 2 10:40:35 2017 - 00:06 ago
State : Traced/Stopped, pid: 8534
更多相关yum 参数参考:
http://www.runoob.com/linux/linux-yum.html