使用rpm安裝最大的問題是依賴的問題,不管是安裝還是卸載,都存在依賴安裝的問題,所以在centos中提供了yum的方式來安裝,這種方式第一種方案是基于網(wǎng)絡(luò)的方式,只要通過yum install 命令就可以幫助我們完成這個(gè)軟件的安裝,會(huì)自動(dòng)幫助開發(fā)人員安裝軟件包和依賴包,使用yum erase命令可以完成軟件的刪除。并且附帶刪除不使用的依賴包,使用yum update自動(dòng)幫你完成更新操作,所有的安裝都是自動(dòng)的,目錄也是自動(dòng)的,可以通過rpm的方式來查詢
安裝gcc,此時(shí)由于沒有網(wǎng)絡(luò),需要將光盤設(shè)置為yum的源
????????加載cdrom? ? (mount /dev/cdrom /mnt/cdrom)
????????進(jìn)入cdrom的Packages安裝createrepo
????????創(chuàng)建repo,此時(shí)由于光盤加載在/mnt/cdrom,所以需要/mnt的目錄下創(chuàng)建
????????????createrepo .
????????備份/etc/yum.repo.d/文件夾中的CentOS-Base.repo文件,修改CentOS-Media.repo文件? (cp CentOS-Base.repo bak_CentOS-Base )
?????????# CentOS-Media.repo
????????#
????????#? This repo can be used with mounted DVD media, verify the mount point for
????????#? CentOS-7.? You can use this repo and yum to install items directly off the
????????#? DVD ISO that we release.
????????#
????????# To use this repo, put in your DVD and use it with the other repos too:
????????#? yum --enablerepo=c7-media [command]
????????# ?
????????# or for ONLY the media repo, do this:
????????#
????????#? yum --disablerepo=\* --enablerepo=c7-media [command]
?
????????[c7-media]
????????name=CentOS-$releasever-Media
????????baseurl=file:///mnt/##設(shè)置為mnt
????????gpgcheck=1
????????enabled=1##啟動(dòng)光盤的yum源
????????gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
最后一步使用
? ??? ??yum clean all 清空原有的緩存信息
? ??? ??yum list 更新新的信息
? ??? ??使用yum repolist 查詢所有的工廠源