RHEL6.X服务器本地yum源配置
1、确保安装所需软件包
yum-3.2.29-40.el6.noarch
createrepo-0.9.9-17.el6.noarch
yum配置文件为/etc/yum.conf
2、挂载本地磁盘到/media目录下
[root@jason ~]#mount /dev/cdrom /media
3、配置本地yum.
源配置文件以独立file.repo格式存放于/etc/yum.repos.d/目录中,如下配置本地yum源
[root@jason ~]# cd /etc/yum.repos.d/ [root@jason yum.repos.d]#ls rhel-source.repo [root@jason yum.repos.d]#cp -rp rhel-source.repo local.repo [root@jason yum.repos.d]#ls rhel-source.repo local.repo 修改local.repo,内容如下: [root@jason yum.repos.d]# vi local.repo [local-Server] baseurl=file:///media/Server enabled=1 gpgcheck=0 [local-HA] baseurl=file:///media/HighAvailability enabled=1 gpgcheck=0 [local-LB] baseurl=file:///media/LoadBalancer enabled=1 gpgcheck=0 [local-RS] baseurl=file:///media/ResilientStorage enabled=1 gpgcheck=0
各参数解释
[local-Server] #自定义名称 baseurl=file:///media/Server #本地组件路径 enabled=1 #启用yum源,0为不启用,1为启用 gpgcheck=0 #检查GPG-KEY,0为不检查,1为检查 gpgkey=file:///media/rhel/RPM-GPG-KEY-redhat-release #GPG-KEY路径,可以不写。
4、清除yum缓存。
yum clean all #清除yum缓存
5、使用yum install自动安装软件
[root@jason yum.repos.d]# yum install samba Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id, refresh-packagekit, security, subscription-manager, tmprepo, verify, versionlock This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Loading support for Red Hat kernel ABI Repository 'local-Server' is missing name in configuration, using id Repository 'local-HA' is missing name in configuration, using id Bad id for repo: local=LB, byte = = 5 Repository 'local-RS' is missing name in configuration, using id Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package samba.x86_64 0:3.6.9-151.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================================================================================= Installing: samba x86_64 3.6.9-151.el6 local-Server 5.0 M Transaction Summary ========================================================================================================================================================================================================= Install 1 Package(s) Total download size: 5.0 M Installed size: 18 M Is this ok [y/N]: y Downloading Packages: Setting up and reading Presto delta metadata Processing delta metadata Package(s) data still to download: 5.0 M Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : samba-3.6.9-151.el6.x86_64 1/1 Verifying : samba-3.6.9-151.el6.x86_64 1/1 Installed: samba.x86_64 0:3.6.9-151.el6 Complete! [root@jason yum.repos.d]#