標籤:
一、準備工作
1. Linux安裝盤插入光碟機
2. 掛載光碟機
[[email protected] ~]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
如果光碟機沒有插入光碟片,可把iso鏡像拷貝到伺服器載入:mount -t iso9660 -o loop /soft/OracleLinux-R6-U1-Server-x86_64-dvd.iso /mnt
[[email protected] ~]#
3. 安裝createrepo軟體包 ---> 這是一個解決依賴性的工具
[[email protected] ~]# cd /mnt/Packages/
[[email protected] Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch
[[email protected] Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
deltarpm = 3.5-0.5.20090913git.el6 is needed by python-deltarpm-3.5-0.5.20090913git.el6.x86_64
[[email protected] Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[[email protected] Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
[[email protected] Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
[[email protected] Packages]#
4. 拷貝光碟機中的rpm包到本系統中,並建立對應的目錄
[[email protected] Packages]# mkdir -pv /var/ftp/pub
mkdir: created directory `/var/ftp‘
mkdir: created directory `/var/ftp/pub‘
[[email protected] Packages]# cp -R /mnt/Packages /var/ftp/pub/
註:我這裡沒有此步驟
二、 開始搭建yum
1. 產生依賴關係
[[email protected] Packages]# createrepo -g /mnt/repodata/cda5429be6f36ce1348e8f897f4fc96aa00d5727c75e9e5a0b5dc40d22a51116-comps-ol6-Server.xml /var/ftp/pub/Packages/
Spawning worker 0 with 3720 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
註:我這裡沒有做此步驟,最後也可以。不知道這步驟是不是必須的。
2. 編輯yum倉庫設定檔
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# vi local.repo
[myyum]
name=olinux Myyum
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
3. 至此本地yum安裝完畢,測試下是否能夠正常使用
[[email protected] yum.repos.d]# yum grouplist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Group Process
myyum | 3.8 kB 00:00 ...
myyum/primary_db | 3.1 MB 00:00 ...
myyum/group_gz | 204 kB 00:00 ...
Installed Groups:
Additional Development
Base
Debugging Tools
Desktop
Desktop Debugging and Performance Tools
Desktop Platform
Dial-up Networking Support
Directory Client
Network file system client
Assamese Support [as]
Available Language Groups:
Afrikaans Support [af]
Albanian Support [sq]
Amazigh Support [ber]
Azerbaijani Support [az]
Ukrainian Support [uk]
Upper Sorbian Support [hsb]
Uzbek Support [uz]
Vietnamese Support [vi]
Walloon Support [wa]
Welsh Support [cy]
Xhosa Support [xh]
Zulu Support [zu]
Done
[[email protected] yum.repos.d]#
OK !!!
推薦閱讀:
RedHat Linux 本地yum源的配置 http://www.linuxidc.com/Linux/2013-08/88217.htm
RedHat 6.2 Linux修改yum源免費使用CentOS源 http://www.linuxidc.com/Linux/2013-07/87383.htm
配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm
Redhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htm
yum的設定檔說明 http://www.linuxidc.com/Linux/2013-04/83298.htm
RedHat 6.1下安裝yum(圖文) http://www.linuxidc.com/Linux/2013-06/86535.htm
YUM 安裝及清理 http://www.linuxidc.com/Linux/2013-07/87163.htm
Oracle linux6.1配置yum本地源