RHEL6.4配置本地源

由于搭建DB实验环境,在机器配置本地源可以节省很多单独安装软件包的时间,用yum安装软件解决了软件包之间的依赖性问题。

前面有篇文章介绍了CentOS配置本地源,其实配置本地源的方法都类似,只是部分地方需要修改而已。

一般配置本地源的步骤:

  • 拷贝系统iso文件到系统某个文件目录
  • 建立挂载文件目录夹,并将iso文件挂载到当前文件目录下
  • 将挂载命令加入到启动项文件中,可以是/etc/fstab文件,也可以是/etc/rc.local文件
  • 创建local.repo文件到/etc/yum.repos.d/目录夹下
  • 配置local.repo文件

具体操作步骤如下:

1、在RHEL6下面建立/soft文件夹,把下载好在桌面的rhel-server-6.4-x86_64-dvd.iso文件移动到/soft/文件目录下

[root@localhost /]# mkdir soft/
[root@localhost Desktop]#mv rhel-server-6.4-x86_64-dvd.iso /soft/

2、在/mnt目录下建立rhel6文件夹,并将rhel-server-6.4-x86_64-dvd.iso文件夹挂载到/mnt/rhel6文件夹下

[root@localhost Desktop]# mkdir /mnt/rhel6
[root@localhost Desktop]# mount -o loop /soft/rhel-server-6.4-x86_64-dvd.iso /mnt/rhel6/
[root@localhost Desktop]# cd /mnt/rhel6/
[root@localhost rhel6]# ls
EFI               Packages                  RELEASE-NOTES-pa-IN.html
EULA              README                    RELEASE-NOTES-pt-BR.html
EULA_de           RELEASE-NOTES-as-IN.html  RELEASE-NOTES-ru-RU.html
EULA_en           RELEASE-NOTES-bn-IN.html  RELEASE-NOTES-si-LK.html
EULA_es           RELEASE-NOTES-de-DE.html  RELEASE-NOTES-ta-IN.html
EULA_fr           RELEASE-NOTES-en-US.html  RELEASE-NOTES-te-IN.html
EULA_it           RELEASE-NOTES-es-ES.html  RELEASE-NOTES-zh-CN.html
EULA_ja           RELEASE-NOTES-fr-FR.html  RELEASE-NOTES-zh-TW.html
EULA_ko           RELEASE-NOTES-gu-IN.html  repodata
EULA_pt           RELEASE-NOTES-hi-IN.html  ResilientStorage
EULA_zh           RELEASE-NOTES-it-IT.html  RPM-GPG-KEY-redhat-beta
GPL               RELEASE-NOTES-ja-JP.html  RPM-GPG-KEY-redhat-release
HighAvailability  RELEASE-NOTES-kn-IN.html  ScalableFileSystem
images            RELEASE-NOTES-ko-KR.html  Server
isolinux          RELEASE-NOTES-ml-IN.html  TRANS.TBL
LoadBalancer      RELEASE-NOTES-mr-IN.html
media.repo        RELEASE-NOTES-or-IN.html
[root@localhost rhel6]# 

3、将挂载命令加入到启动项中,这里选择加入到/etc/fstab文件中,编辑/etc/fstab文件,加入挂载iso命令

[root@localhost rhel6]# vim /etc/fstab
/soft/rhel-server-6.4-x86_64-dvd.iso /mnt/rhel6 iso9660 ro,loop         0 0   

说明:使用mount -a 命令测试,如不出现任何错误,证明测试通过,重新启动机器,就可以看到已经加载到/mnt/rhel6文件的iso镜像内容了。

4、打开/etc/yum.repos.d/文件夹下,拷贝rhel-source.repo文件到local.repo文件,并编辑local.repo文件

[root@localhost rhel6]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# cp rhel-source.repo local.repo
[root@localhost yum.repos.d]# vim local.repo 

将local.repo文件中的内容修改部分内容,并把一些不必要的内容删除,标准的local.repo内容如下

[local]
name=local
baseurl=file:///mnt/rhel6/
enabled=1
gpgcheck=0

之后保存退出,测试本地源

5、测试本地源,以安装gcc为例,如下:

[root@localhost yum.repos.d]# yum -y install gcc
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
local                                                    | 3.9 kB     00:00 ... 
local/primary_db                                         | 3.1 MB     00:00 ... 
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-3.el6 will be installed
--> Processing Dependency: cpp = 4.4.7-3.el6 for package: gcc-4.4.7-3.el6.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.7-3.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-3.el6.x86_64
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-3.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: cpp-4.4.7-3.el6.x86_64
---> Package glibc-devel.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.107.el6 for package: glibc-devel-2.12-1.107.el6.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.107.el6.x86_64
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Running transaction check
---> Package kernel-headers.x86_64 0:2.6.32-358.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch          Version                 Repository    Size
================================================================================
Installing:
 gcc                   x86_64        4.4.7-3.el6             local         10 M
Installing for dependencies:
 cloog-ppl             x86_64        0.15.7-1.2.el6          local         93 k
 cpp                   x86_64        4.4.7-3.el6             local        3.7 M
 glibc-devel           x86_64        2.12-1.107.el6          local        974 k
 glibc-headers         x86_64        2.12-1.107.el6          local        604 k
 kernel-headers        x86_64        2.6.32-358.el6          local        2.3 M
 mpfr                  x86_64        2.4.1-6.el6             local        156 k
 ppl                   x86_64        0.10.2-11.el6           local        1.3 M

Transaction Summary
================================================================================
Install       8 Package(s)

Total download size: 19 M
Installed size: 38 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                            32 MB/s |  19 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ppl-0.10.2-11.el6.x86_64                                     1/8 
  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                              2/8 
  Installing : mpfr-2.4.1-6.el6.x86_64                                      3/8 
  Installing : cpp-4.4.7-3.el6.x86_64                                       4/8 
  Installing : kernel-headers-2.6.32-358.el6.x86_64                         5/8 
  Installing : glibc-headers-2.12-1.107.el6.x86_64                          6/8 
  Installing : glibc-devel-2.12-1.107.el6.x86_64                            7/8 
  Installing : gcc-4.4.7-3.el6.x86_64                                       8/8 
local/productid                                          | 1.7 kB     00:00 ... 
  Verifying  : kernel-headers-2.6.32-358.el6.x86_64                         1/8 
  Verifying  : glibc-devel-2.12-1.107.el6.x86_64                            2/8 
  Verifying  : gcc-4.4.7-3.el6.x86_64                                       3/8 
  Verifying  : mpfr-2.4.1-6.el6.x86_64                                      4/8 
  Verifying  : cpp-4.4.7-3.el6.x86_64                                       5/8 
  Verifying  : ppl-0.10.2-11.el6.x86_64                                     6/8 
  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                              7/8 
  Verifying  : glibc-headers-2.12-1.107.el6.x86_64                          8/8 

Installed:
  gcc.x86_64 0:4.4.7-3.el6                                                      

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6       cpp.x86_64 0:4.4.7-3.el6              
  glibc-devel.x86_64 0:2.12-1.107.el6     glibc-headers.x86_64 0:2.12-1.107.el6 
  kernel-headers.x86_64 0:2.6.32-358.el6  mpfr.x86_64 0:2.4.1-6.el6             
  ppl.x86_64 0:0.10.2-11.el6             

Complete!
[root@localhost yum.repos.d]# 

至此,我们完成了rhel6.4本地源的配置与测试。

『–ENDOF–』

Comments are closed.