由于服務(wù)器不允許內(nèi)網(wǎng)訪問(wèn),在Linux上安裝軟件很不方便,需要尋找各種依賴。所以,就在服務(wù)器上配置本地yum源。
首先先上傳一個(gè)CentOS鏡像到服務(wù)器,我們使用的是CentOS-7-x86_64-DVD-1611.iso 。
將鏡像mount 到/mnt
sudo mount -o loop /ztmp/CentOS-7-x86_64-DVD-1611.iso /mnt
修改yum源 在/etc/yum.repos.d/目錄下 拷貝一份.rep文件 將原有文件?
sudo cp /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/CentOS-Base.repo
sudo mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.bak
sudo mv /etc/yum.repos.d/cobbler-config.repo /etc/yum.repos.d/cobbler-config.repo.bak
修改新配置文件的內(nèi)容
sudo vim /etc/yum.repos.d/CentOS-Base.repo
將CentOS-Base.repo內(nèi)容改為以下內(nèi)容
[base]?
name=rhel_dvd?
baseurl=file:///mnt/?
enabled=1
gpgcheck=0
清空yum緩存
sudo yum clean all
這樣本地yum源就裝好了
yum源安裝的時(shí)候,使用 yum install ... 或者 yum localinstall ...