日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > centos >内容正文

centos

Centos6.4 本地yum源配置

發(fā)布時間:2023/11/30 centos 114 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Centos6.4 本地yum源配置 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

由于單位的服務(wù)器均使用的是內(nèi)網(wǎng),而安裝一些軟件如Git,需要很多的依賴包,使用yum安裝相對簡單,由于不能聯(lián)網(wǎng)故配置本地yum源配置。

1.首先將需要rpm庫添加到系統(tǒng)中:

1).虛擬機中安裝的linux操作系統(tǒng):則只需將安裝包ISO文件掛載到media下面(如無法掛載請參考http://www.cnblogs.com/shenliang123/p/3203278.html)

2).單獨的服務(wù)器系統(tǒng),則先在/media下新建centos(名字可以自定義,但與下面4中添加的目錄相關(guān)),然后將ISO包里面的內(nèi)容全部復(fù)制到該文件夾中

2.進入到?/etc/yum.repos.d/??,該目錄下包含了四個文件:

[root@sl media]# ls -l /etc/yum.repos.d/ total 16 -rw-r--r--. 1 root root 1926 Feb 25 2013 CentOS-Base.repo -rw-r--r--. 1 root root 638 Feb 25 2013 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 630 Feb 25 2013 CentOS-Media.repo -rw-r--r--. 1 root root 3664 Feb 25 2013 CentOS-Vault.repo

3.將?CentOS-Base.repo和CentOS-Debuginfo.repo兩個文件改名,繞過網(wǎng)絡(luò)安裝:

[root@sl yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repose_bak [root@sl yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo_bak

4.編輯文件CentOS-Media.repo:(也可以自己新增一個repo文件,more用于查看,使用vi進行編輯)

[root@sl yum.repos.d]# more CentOS-Media.repo  #repo后綴 # CentOS-Media.repo # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command][c6-media]               #庫名稱 name=CentOS-$releasever - Media  #名稱描述 baseurl=file:///media/centos/ #yum源目錄,源地址 gpgcheck=1             #檢查GPG-KEY,0為不檢查,1為檢查 enabled=1               #是否用該yum源,0為禁用,1為使用 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  #gpgcheck=0時無需配置

5.測試yum是否配置成功:

[root@sl yum.repos.d]# yum list Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile Installed Packages ConsoleKit.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4 ConsoleKit-libs.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4 MAKEDEV.x86_64 3.24-6.el6 @anaconda-CentOS-201303020151.x86_64/6.4 MySQL-python.x86_64 1.2.3-0.3.c1.1.el6 @anaconda-CentOS-201303020151.x86_64/6.4 PyGreSQL.x86_64 3.8.1-2.el6 @anaconda-CentOS-201303020151.x86_64/6.4 SDL.x86_64 1.2.14-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4 TurboGears2.noarch 2.0.3-4.el6 @anaconda-CentOS-201303020151.x86_64/6.4 abrt.x86_64 2.0.8-15.el6.centos @anaconda-CentOS-201303020151.x86_ more.........

6.清除yum緩存:

[root@sl yum.repos.d]# yum clean all Loaded plugins: fastestmirror, security Cleaning repos: Cleaning up Everything Cleaning up list of fastest mirrors

?

可能由于沒有使用光驅(qū)的緣故,以上設(shè)置后安裝一直報nothing to do,所以選了另外一種方法重新安裝:

1.將yum源放到/opt目錄下,并復(fù)制系統(tǒng)安裝包下的packages文件夾中所有的repo文件

[root@sl opt]# mkdir yumserver [root@sl opt]# cp -rv /media/centos/Packages/* /opt/yumserver/

2.安裝createrepo命令

[root@sl opt]# cd localserver/ [root@sl localserver]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY error: Failed dependencies:python-deltarpm is needed by createrepo-0.9.9-17.el6.noarch

以上提示安裝失敗,需要安裝依賴包:python-deltarpm

[root@sl localserver]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%]1:deltarpm ########################################### [ 33%]2:python-deltarpm ########################################### [ 67%]3:createrepo ########################################### [100%]

createrepo安裝成功

3.利用createrepo創(chuàng)建yum倉庫,創(chuàng)建索引信息(需要等待一段時間)

[root@sl localserver]# createrepo -v ./

4.配置文件,將/etc/yum.repos.d/下現(xiàn)存文件都刪除或重命名.bak,然后新建一個local.repo文件,并添加相應(yīng)內(nèi)容:

[root@sl yum.repos.d]# touch local.repo [root@sl yum.repos.d]# vi local.repo  #repo后綴 # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command][local]               #庫名稱 name=CentOS-local   #名稱描述 baseurl=file:///opt/localserver/ #yum源目錄,源地址 gpgcheck=1           #檢查GPG-KEY,0為不檢查,1為檢查 enabled=1            #是否用該yum源,0為禁用,1為使用 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  #gpgcheck=0時無需配置

5.安裝成功后,測試:

[root@sl yum.repos.d]# yum clean all #清除緩存 Loaded plugins: fastestmirror, security Cleaning repos: Cleaning up Everything Cleaning up list of fastest mirrors[root@sl yum.repos.d]# yum makecache #重新建立緩存 Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile local | 2.9 kB 00:00 ... local/filelists_db | 3.9 MB 00:00 ... local/other_db | 1.7 MB 00:00 ... Metadata Cache Created

?

?

?

轉(zhuǎn)載于:https://www.cnblogs.com/shenliang123/p/3829044.html

總結(jié)

以上是生活随笔為你收集整理的Centos6.4 本地yum源配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。