我们通过rpm安装软件时会出现软件依赖关系问题,但是我们可以通过配置yum来解决这些依赖问题而使得软件的安装更加便捷;同时通过配置yum还可以使得软件能够集中管理,方便配置。今天就给大家谈谈如何搭建本地yum库
1,在计算机中放入rhel5.9的光盘镜像文件,由于软件太多我们采取把光盘挂载到一个指定的目录作为本地软件库
[root@localhost ~]# mkdir /var/soft……创建光盘挂载文件夹soft
[root@localhost ~]# mount /dev/cdrom /var/soft……挂载光盘到指定文件夹
mount: block device /dev/cdrom is write-protected,mounting read-only
[root@localhost ~]#
2,编辑yum客户端信息,配置服务器软件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# cp rhel-debuginfo.reporhel-server.repo……复制文件
[root@localhost yum.repos.d]# vim rhel-server.repo
[rhel-server]……修改标题
name=Red Hat Enterprise Linux server……修改名字
baseurl=file:///var/soft/Server……软件路径
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
~
~
~
-- INSERT -- 4,10 All
验证配置是否成功
[root@localhost Server]# ls | wc -l
3339
[root@localhost Server]# yum list | wc -l
Failed to set locale, defaulting to C
3347
3,编辑yum客户端信息,配置虚拟化软件库
[root@localhost yum.repos.d]# cp rhel-server.reporhel-vt.repo
[root@localhost yum.repos.d]# ls
rhel-debuginfo.repo rhel-server.repo rhel-vt.repo
[root@localhost yum.repos.d]# vim rhel-vt.repo
[rhel-VT]
name=Red Hat Enterprise Linux VT
baseurl=file:///var/soft/VT/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
~
~
-- INSERT -- 3,29 All
验证虚拟化yum软件库是否配置成功
[root@localhost yum.repos.d]# ls /var/soft/VT/ | wc-l
61
[root@localhost yum.repos.d]# yum list | wc -l
Failed to set locale, defaulting to C
3406 =3347+61
4,编辑yum客户端信息,配置集群二进制软件库
[root@localhost yum.repos.d]# cp rhel-server.reporhel-cluster.repo
[root@localhost yum.repos.d]# vim rhel-cluster.repo
[rhel-Cluster]
name=Red Hat Enterprise Linux Cluster
baseurl=file:///var/soft/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
~
~
-- INSERT -- 3,33 All
验证是否配置成功
[root@localhost yum.repos.d]# ls /var/soft/Cluster/ |wc -l
34
[root@localhost yum.repos.d]# yum list | wc -l
Failed to set locale, defaulting to C
3441
5,编辑yum客户端信息,配置集群二进制软件库
[root@localhost yum.repos.d]# cp rhel-server.reporhel-ClusterStorage.repo
[root@localhost yum.repos.d]# vim rhel-ClusterStorage.repo
[rhel-ClusterStorage]
name=Red Hat Enterprise Linux ClusterStorage
baseurl=file:///var/soft/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
~
"rhel-ClusterStorage.repo" 6L, 186C 3,1 All
验证是否成功
[root@localhost yum.repos.d]# ls /var/soft/Cluster |wc -l
34
[root@localhost yum.repos.d]# yum list | wc -l
Failed to set locale, defaulting to C
3525
6,用窗口化工具查看
[root@localhost ~]# system-config-packages
Loaded plugins: product-id
7,把除rhel-server.repo以外三个文件导入rhel-server.repo并命名为rhel-software.repo
[root@localhost yum.repos.d]# vim rhel-server.repo
[rhel-server]
name=Red Hat Enterprise Linux server
baseurl=file:///var/soft/Server/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-VT]
name=Red Hat Enterprise Linux vt
baseurl=file:///var/soft/VT/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-Cluster]
name=Red Hat Enterprise Linux C
baseurl=file:///var/soft/Cluster/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-ClusterStorage]
name=Red Hat Enterprise Linux S2
baseurl=file:///var/soft/ClusterStorage/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
~
~
19,20 全部
[root@localhost yum.repos.d]# mv rhel-server.repo rhel-software.repo ……改名
[root@localhost yum.repos.d]# ls
rhel-ClusterStorage.repo rhel-debuginfo.repo rhel-vt.repo
rhel-cluster.repo rhel-software.repo
[root@localhost yum.repos.d]#
验证
[root@localhost yum.repos.d]# yum list | wc -l
3525
[root@localhost yum.repos.d]#
窗口化查看
[root@localhost yum.repos.d]# system-config-packages
Loaded plugins: product-id
8,到此本地yum库搭建完成