- 配置本地yum源的方法
- 1.利用光驱挂载镜像配置
- 1.1首先把光盘放在光驱中,若此时光驱已经挂载请用umount命令先把光驱umount掉
- 1.2建立相关目录,创建local.repo 文件
- [root@tip01 ~]# mkdir /yum/Server/
- [root@tip01 ~]# mount /dev/hdc /yum/
- [root@tip01 ~]# vi /etc/yum.repos.d/local.repo
- #添加以下内容
- [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 ~]# 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:/// “三个斜杠”
redhat5设置本地yum源
最新推荐文章于 2024-07-16 16:58:48 发布