來自CSDN 小魔 的linux 日誌
linux
配置本地yum源的方法 1.利用光驅掛載鏡像配置 1.1首先把光盤放在光驅中,若此時光驅已經掛載請用umount命令先把光驅umount掉 1.2創建相關目錄,建立local.repo 文件 [root@tip01 ~]# mkdir /yum/Server/ [root@tip01 ~]# mount /dev/cdrom /yum/ [root@tip01 ~]# vi /etc/yum.repos.d/local.repo ##若是提示specify filesystem 使用如下命令 mount -o loop /dev/cdrom /mnt/iso/ 或者 mount -o loop /xxx/xxx.iso /mnt/iso/ #添加如下內容 [base] name=local baseurl=file:///yum/Server gpgcheck=0 enabled=1 1.3 查看配置的yum源 [root@tip01 ~]# yum list Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disabled. base | 1.3 kB 00:00 base/primary #################################### 這樣 yum倉庫就建好了 2.利用本地文件目錄創建yum 倉庫 2.1把光盤放入光驅 mount /dev/hdc /mnt [root@tip01 ~]# mount /dev/hdc /mnt/ mount: block device /dev/hdc is write-protected, mounting read-only 注意:存放YUM源的目錄必須有可寫權限,否則在createrepo時會報錯。 2.2將光盤文件複製到YUM目錄 [root@tip01 ~]# umount /dev/hdc [root@tip01 ~]# mount /dev/hdc /mnt/ mount: block device /dev/hdc is write-protected, mounting read-only [root@tip01 ~]# mount /dev/sda1 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda2 on /home type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /dev/hdc on /mnt type iso9660 (ro) [root@tip01 ~]# cd /mnt/ [root@tip01 mnt]# ls -ld Server/ dr-xr-xr-x 3 root root 217088 05-19 05:11 Server/ 2.2 拷貝Server目錄 [root@tip01 mnt]# cp -r Server/ /yum/ 2.3安裝createrepo [root@tip01 ~]# cd /yum/Server/ [root@tip01 Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] package createrepo-0.4.11-3.el5.noarch is installed 2.4建立本地源 # createrepo -g /yum/Server/repodata/comps-rhel5-server-core.xml /yum/Server [root@tip01 ~]# vi /etc/yum.repos.d/local.repo [base] name=local baseurl=file:///yum/Server gpgcheck=0 enabled=1 [root@tip01 ~]# yum list Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disabled. base | 1.3 kB 00:00 base/primary #################################### 以一樣的方式創建VT,CLUSTER,CLUSTERSTORAGE的yum源 要注意baseurl後爲file:/// 「三個斜槓」