rhel6添加本地yum
<h3><strong>1、准备工作</strong></h3><p>关闭selinux</p><pre class="brush:bash;toolbar:false">#setenforce 0</pre><p>创建yum目录</p><pre class="brush:bash;toolbar:false">#mkdir /yum</pre><p>挂载光盘</p><pre class="brush:bash;toolbar:false">#mount -o loop /dev/cdrom /mnt</pre><p>拷贝光盘内所有文件到本地目录</p><pre class="brush:bash;toolbar:false">#cp -ar /mnt/* /yum</pre><p></p>
<h3><strong>2、添加配置文件</strong></h3>
<p>修改repo文件,访问本地yum库</p><pre class="brush:bash;toolbar:false">#vi /etc/yum.repos.d/local.repo</pre><p></p><pre class="brush:bash;toolbar:false">
name=Red Hat Enterprise Linux update6
baseurl=file:///yum/
gpgcheck=0
enabled=1</pre><p>删除或者备份原始repo文件,否则yumlist会报错如下:</p><pre class="brush:bash;toolbar:false">#mv /etc/yum.repos.d/packagekit-media.repo /etc/yum.repos.d/packagekit-media.repo.bk
rhel6 Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia. Please verify its path and try again</pre><p>清除yum缓存</p><pre class="brush:bash;toolbar:false">#yum clean all</pre><p></p>
<h3><strong>3、测试</strong></h3>
<p></p><pre class="brush:bash;toolbar:false"># yum repolist
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
repo id repo name status
local Red Hat Enterprise Linux update6 3,391
repolist: 3,391</pre><p>看到上述信息,表示yum库创建成功</p>
頁:
[1]