Redhat 6.9下搭建本地yum源

   前段时间因项目和学习需要,要在本地安装Oracle数据库,用来学习和验证有关Oracle数据库的问题,于是就在本地的VMware虚拟机上搭建了Linux操作系统,用来安装Oracle11g数据库。
   在安装一些包时,按照以前学习的知识无法安装和搭建yum源,发现网上的教程貌似有些出入,这里把自己的一些方法写出,希望能有所帮助。

1、先挂载光盘:
Redhat 6.9下搭建本地yum源

2、创建挂载路径并挂载
[root@Oracle-linux ~]# mkdir -p /mnt/cdrom/
[root@Oracle-linux ~]# mount /dev/sr1 /mnt/cdrom/
----此路径为虚拟机挂载光盘后的位置,具体位置根据自己的实际路径来做修改;

3、配置本地yum源
[root@Oracle-linux ~]# cd /etc/yum.repos.d/
[root@Oracle-linux yum.repos.d]# ls
redhat.repo rhel-source.repo
[root@Oracle-linux yum.repos.d]# cp rhel-source.repo oracle.repo
[root@Oracle-linux yum.repos.d]# vi oracle.repo
[oracle]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
退出并保存。

4、清除缓存
[root@Oracle-linux ~]# yum clean all
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Cleaning repos: oracle
Cleaning up Everything

5、获取列表,验证是否配置成功
[root@Oracle-linux ~]# yum makecache
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
oracle | 4.1 kB 00:00 ...
oracle/group_gz | 216 kB 00:00 ...
oracle/filelists_db | 3.4 MB 00:00 ...
oracle/primary_db | 3.1 MB 00:00 ...
oracle/other_db | 1.3 MB 00:00 ...
Metadata Cache Created
[root@Oracle-linux ~]#
Redhat 6.9下搭建本地yum源

[root@Oracle-linux ~]# yum grouplist|grep Server
Network Infrastructure Server
Print Server
Server Platform
Web Server
Backup Server
Directory Server
Identity Management Server
Network Storage Server
Server Platform Development
[root@Oracle-linux ~]#

以上应该可满足Redhat6以上版本,自己配置可用,如果有配置不成功,可参照次方法,有错误,还请谅解!

猜你喜欢

转载自blog.51cto.com/2600783/2435922