如果服务器部署在内网而无法联网yum安装或更新软件,就非常有必要自己制作一个本地yum软件源。
一、将RedHat或CentOS系统DVD ISO镜像上传到服务器: 二、挂载系统ISO镜像 # mkdir -p /mnt/cdrom # mount -o loop /usr/local/rhel-server-6.4-x86_64-dvd.iso /mnt/cdrom # PS:如果是挂载DVD光驱做软件源,则用下面这条命令: # mount -t iso9660 /dev/cdrom /mnt/cdrom/
注意: 三、修改yum配置: # cd /etc/yum.repos.d/ # mkdir -p bak # 接下来将之前的yum配置文件移动到上面创建的bak文件夹中 # mv *.repo bak/ # 接下来添加一个新的yum源配置文件 # vi /etc/yum.repos.d/redhat.repo # 按“Insert”键进入编辑模式,复制下面的内容到配置文件 [RHEL] name=RHEL6.4 baseurl=file:///mnt/cdrom gpgcheck=0 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release enabled=1 然后保存修改并退出。 四、清理yum: # yum clean all 五、更新源,安装软件: # yum update # yum install 你要安装的软件包名
六、其他说明: [rhel-debuginfo] name=Red Hat Enterprise Linux $releasever - $basearch - Debug baseurl=file:///mnt/cdrom/Server enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [Cluster] name=Red Hat Enterprise Linux $releasever - $basearch - Cluster baseurl= file:///mnt/cdrom/Cluster enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [ClusterStorage] name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStorage baseurl= file:///mnt/cdrom/ClusterStorage enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [Server] name=Red Hat Enterprise Linux $releasever - $basearch - Server baseurl= file:///mnt/cdrom/Server enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [VT] name=Red Hat Enterprise Linux $releasever - $basearch - VT baseurl= file:///mnt/cdrom/VT enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release(责任编辑:IT) |