rhel6配置在线yum源与本地yum源
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Red Hat Linux下配置yum源
测试环境:Vmware Workstation 10.0.4
OS:Red Hat Enterprise Linux 6.5 64位
Kernel:2.6.32-431.el6.x86_64
目录:
一.配置为centos yum源
二.配置为本地yum源
一.配置为centos yum源
步骤:
1.修改配置文件/etc/yum.repos.d/rhel-source.repo(更改配置文件前务必备份)
2.修改配置文件/etc/hosts
3,使用yum做测试:根据查询结果可知,yum源配置成功,可以在线搜索安装包;
二,配置为本地yum源
参考博客:/evils798/article/details/7581670
1.配置本地yum源的方法
2.
3. 1.利用光驱挂载镜像配置
4.
5. 1.1首先把光盘放在光驱中,若此时光驱已经挂载请用umount命令先把光驱umount掉
6.
7. 1.2建立相关目录,创建local.repo 文件
8.[root@tip01 ~]# mkdir /yum/Server/
9.[root@tip01 ~]# mount /dev/hdc /yum/
10.[root@tip01 ~]# vi /etc/yum.repos.d/local.repo
11.
12.#添加以下内容
13.
14.[base]
=local
16.baseurl=file:///yum/Server
17.gpgcheck=0
18.enabled=1
19.
20.1.3 查看配置的yum源
21.[root@tip01 ~]# yum list
22.Loaded plugins: rhnplugin, security
23.This system is not registered with RHN.
24.RHN support will be disabled.
25.base
| 1.3 kB 00:00
26.base/primary ####################################
27.
28.
29.这样 yum仓库就建好了
30.
31.
32.
33.2.利用本地文件目录建立yum 仓库
34.
35.2.1把光盘放入光驱
36.mount /dev/hdc /mnt
37.[root@tip01 ~]# mount /dev/hdc /mnt/
38.mount: block device /dev/hdc is write-protected, mounting read-only
39.
40.注意:存放YUM源的目录必须有可写权限,不然在createrepo时会报错。
41.
42.2.2将光盘文件复制到YUM目录
43.[root@tip01 ~]# umount /dev/hdc
44.[root@tip01 ~]# mount /dev/hdc /mnt/
45.mount: block device /dev/hdc is write-protected, mounting read-only
46.[root@tip01 ~]# mount
47./dev/sda1 on / type ext3 (rw)
48.proc on /proc type proc (rw)
49.sysfs on /sys type sysfs (rw)
50.devpts on /dev/pts type devpts (rw,gid=5,mode=620)
51./dev/sda2 on /home type ext3 (rw)
52.tmpfs on /dev/shm type tmpfs (rw)
53.none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
54.sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
55./dev/hdc on /mnt type iso9660 (ro)
56.
57.[root@tip01 ~]# cd /mnt/
58.[root@tip01 mnt]# ls -ld Server/
59.dr-xr-xr-x 3 root root 217088 05-19 05:11 Server/
60.
61.2.2 拷贝Server目录
62.[root@tip01 mnt]# cp -r Server/ /yum/
63.
64.2.3安装createrepo
65.[root@tip01 ~]# cd /yum/Server/
66.[root@tip01 Server]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
67.warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOK
EY, key ID 37017186
68.Preparing... ########################################### [
100%]
69. package createrepo-0.4.11-3.el5.noarch is installed
70.
71.2.4创建本地源
72.# createrepo -g /yum/Server/repodata/comps-rhel5-server-core.xml /yum/
Server
73.
74.[root@tip01 ~]# vi /etc/yum.repos.d/local.repo
75.
76.[base]
=local
78.baseurl=file:///yum/Server
79.gpgcheck=0
80.enabled=1
81.
82.
83.[root@tip01 ~]# yum list
84.Loaded plugins: rhnplugin, security
85.This system is not registered with RHN.
86.RHN support will be disabled.
87.base
| 1.3 kB 00:00
88.base/primary ####################################
89.
90.以同样的方式建立VT,CLUSTER,CLUSTERSTORAGE的yum源
91.要注意baseurl后为file:/// “三个斜杠”。