[root@oracledb2 ~]# cd /etc/yum.repos.d/
[root@oracledb2 yum.repos.d]# pwd
/etc/yum.repos.d
[root@oracledb2 yum.repos.d]# cat CentOS-Media.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
上面就是yun源相关的配置,在路径/etc/yum.repos.d/目录下,一共4个文件,说下两个常用的。
CentOS-Base.repo:有网的环境下默认使用这个,这个是第一优先级。因为没网,所以修改文件名,设置成备份文件。这样系统就会使用第二优先级的文件。
[root@oracledb2 yum.repos.d]mv CentOS-Base.repo CentOS-Base.repo_bak
CentOS-Media.repo:没网的环境下使用这个,在上图中会发现他默认配置了4个路径,第4个yumsource是我自己加的。意思是说,如果系统检测yum使用了离线安装,那么会从上到下从这4个路径中查找安装软件。所以我们只要把光盘挂载在这四个目录下的任意一个目录即可。同时,该配置文件默认是不启用的,如果想使用需要修改倒数第二行的enabled为1,否则该文件无效。
我的光盘挂载地址是:
[root@oracledb2 CentOS_6.5_Final]# pwd
/media/CentOS_6.5_Final
下面修改yum 源。
[root@oracledb2 yum.repos.d]# cd /etc/yum.repos.d
[root@oracledb2 yum.repos.d]# pwd
/etc/yum.repos.d
[root@oracledb2 yum.repos.d]# ls
CentOS-Base.repo_bak CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[root@oracledb2 yum.repos.d]# cp CentOS-Media.repo CentOS-Media.repo_bak
[root@oracledb2 yum.repos.d]# vim CentOS-Media.repo
把其它的3个file:///删了去只留一个
(图一1)
8.测试yum,
[root@oracledb2 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: c6-media
Cleaning up Everything
清缓存
[root@oracledb2 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
c6-media | 4.0 kB 00:00 ...
c6-media/primary_db | 4.4 MB 00:00 ...
repo id repo name status
c6-media CentOS-6 - Media 6,367
repolist: 6,367
9.安装gcc
root@oracledb2 yum.repos.d]# yum install gcc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Package gcc-4.4.7-4.el6.x86_64 already installed and latest version
Nothing to do
转:原文链接:https://blog.csdn.net/xtggbmdk/article/details/80857376
阅读(1272) | 评论(0) | 转发(0) |