RHEL5.5配置本地源

RHEL 5配置本地源相对来说比较简单,只需要将对应的文件路径挂载到对应的目录下,并且在

/etc/yum.repos.d/文件夹下创建一个local.repo 文件即可。

实验环境:VMware 8.0 +Red Hat Enterprise Linux Server release 5.5

操作步骤:

1、挂载ISO镜像文件至系统某目录文件夹

2、创建local.repo文件,并编辑local.repo内容

打开VMware,选中Linux主机,右键选择虚拟机配置,在Options里面选择Shared Folders,并且浏览本地计算机上的镜像文件位置。如图1

配置虚拟机

打开Linux,查看已经共享的文件目录文件夹。

运行终端,打开已经挂载的文件目录,就可查看到已经挂载的文件。

[root@localhost RHEL5.5]# cd /mnt/hgfs/system/RHEL5.5
[root@localhost RHEL5.5]# pwd
/mnt/hgfs/system/RHEL5.5
[root@localhost RHEL5.5]# ls
06B0B2BD021789244001EA62834EB3C3EFBF6639.torrent
rhel-server-5.5-i386-dvd.iso
rhel-server-5.5-x86_64-dvd.iso
[root@localhost RHEL5.5]# 

我们可以看到我们映射的共享文件夹下存在两个iso文件,现在我们将rhel-server-5.5-x86_64-dvd.iso
文件挂载到/media/CentOS/文件夹下。

[root@localhost media]# cd /media/
[root@localhost media]# mkdir CentOS
[root@localhost media]# ls
CentOS  RHEL_5.5 i386 DVD
[root@localhost media]# mount -o loop /mnt/hgfs/system/RHEL5.5/rhel-server-5.5-x86_64-dvd.iso /media/CentOS/

接下来,我们编辑/etc/yum.repos.d/文件夹下的local.repo文件,由于默认该文件是不存在的,我们可以通过touch
或者vi 命令直接创建。命令如下:

[root@localhost yum.repos.d]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
local.repo  rhel-debuginfo.repo 
[root@localhost yum.repos.d]# vi local.repo

在local.repo文件中输入以下内容

[Local]
name=Local
baseurl=file:///media/CentOS/Server
enable=1
gpgcheck=0

上面的baseurl是我们挂载的文件路径,我们挂载的是media/CentOS/目录,为什么还需要加/Server路径,缘由是iso文件夹下的rpm包都存放
在Server目录夹下。如不添加,在使用命令时会提示找不到对应的包依赖列表。错误信息如下:

[root@localhost media]# yum install php
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
file:///media/CentOS/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] 没有那个文件或目录: '/media/CentOS/repodata/repomd.xml'
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.1.6-27.el5 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5 for package: php
--> Processing Dependency: httpd-mmn = 20051115 for package: php
--> Processing Dependency: php-cli = 5.1.6-27.el5 for package: php
--> Processing Dependency: libgmp.so.3()(64bit) for package: php
--> Running transaction check
---> Package gmp.x86_64 0:4.1.4-10.el5 set to be updated
---> Package httpd.x86_64 0:2.2.3-43.el5 set to be updated
file:///media/CentOS/repodata/filelists.xml.gz: [Errno 5] OSError: [Errno 2] 没有那个文件或目录: '/media/CentOS/repodata/filelists.xml.gz'
Trying other mirror.
Error: failure: repodata/filelists.xml.gz from Local: [Errno 256] No more mirrors to try.
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.
[root@localhost media]# 

接下来,我们就完成了RHEL 本地源的配置,我们来测试安装MySQL数据库。

[root@localhost media]# yum -y install mysql
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql.i386 0:5.0.77-4.el5_4.2 set to be updated
--> Processing Dependency: perl(DBI) for package: mysql
---> Package mysql.x86_64 0:5.0.77-4.el5_4.2 set to be updated
--> Running transaction check
---> Package perl-DBI.x86_64 0:1.52-2.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch           Version                    Repository     Size
================================================================================
Installing:
 mysql            i386           5.0.77-4.el5_4.2           Local         4.8 M
 mysql            x86_64         5.0.77-4.el5_4.2           Local         4.8 M
Installing for dependencies:
 perl-DBI         x86_64         1.52-2.el5                 Local         605 k

Transaction Summary
================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 10 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           4.7 GB/s |  10 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-DBI                                                 1/3 
  Installing     : mysql                                                    2/3 
  Installing     : mysql                                                    3/3 

Installed:
  mysql.i386 0:5.0.77-4.el5_4.2         mysql.x86_64 0:5.0.77-4.el5_4.2        

Dependency Installed:
  perl-DBI.x86_64 0:1.52-2.el5                                                  

Complete!
[root@localhost media]# 

我们顺利的使用本地源安装了MySQL数据库。

–ENDOF–

Comments are closed.