在vm里安裝的虛擬機
1.選擇本地iso映像文件(就是你安裝linux環境的系統包)
2.使用root掛載
a.創建掛載點 mkdir -p /mnt/cdrom
b.掛載mount /dev/cdrom /mnt/cdrom
c.修改yum配置文件
cd /etc/yum.repos.d
一般redhat系統中會有redhat.repo文件,但是直接配置這個文件后在yum install 時會報錯,
redhat7運行yum報如下提示:
There are no enabled repos. Run "yum repolist all" to see the repos you have. To enable Red Hat Subscription Management repositories: subscription-manager repos --enable <repo> To enable custom repositories: yum-config-manager --enable <repo>
處理的方法:
mv redhat.repo redhat.repo.bak
新增一個CentOS-Base.repo 文件
vi CentOS-Base.repo
然后在其中編輯處輸入(第一行中括號里面的內容必須有,是一個標簽)
[local]
name=Red Hat Enterprise Linux 6.7
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release