使用光盘或者iso(一般用于没有通外网时)
挂载光盘
1
2
|
mount -t iso9660 -o loop /dev/cdrom /media/cdrom #光盘插入光驱后操作
mount -o loop /CentOS_6.4_Final.iso /media/cdrom #挂载本地iso到cdrom
|
删除/etc/yum.repos.d目录所有的repo文件
rm -rf /etc/yum.repos.d/*
创建新文件dvd.repo
1
2
3
4
5
6
7
|
vim /etc/yum.repos.d/dvd.repo
加入以下内容:
[dvd]
name=install dvd
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
|
刷新repos,生成缓存
1
2
3
4
|
yum makecache
或者yum clean all #清除yum缓存
yum list
然后就可以使用yum命令安装你所需要的软件包了
|
没有光盘时
或者机器在机房,又不好通知机房的工作人员放光盘,可用以下的yum源(有网络的情况下操作)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
[root@fortest ~]# rm -rf /etc/yum.repos.d/*
新建一个AS4-Update.repo文件,
[root@fortest ~]#vim /etc/yum.repos.d/AS4-Update.repo
插入以下内容:
[base]
name=Red Hat Enterprise As release 4 base
baseurl=http://211.151.61.116/centos/4/os/x86_64/
gpgcheck=1
gpgkey=http://211.151.61.116/centos/4/RPM-GPG-KEY-centos4
[update]
name=Red Hat Enterprise As release 4 updates
baseurl=http://211.151.61.116/centos/4/updates/x86_64/
gpgcheck=1
gpgkey=http://211.151.61.116/centos/4/RPM-GPG-KEY-centos4
[extras]
name=Red Hat Enterprise As release 4 extras
baseurl=http://211.151.61.116/centos/4/extras/x86_64/
gpgcheck=1
gpgkey=http://211.151.61.116/centos/4/RPM-GPG-KEY-centos4
[root@fortest ~]#yum makecache
这样就可以使用http协议的yum源了
|