利用yum可以安装linux安装光盘包,而不需要一个一个的安装依赖包,简便了不少,但即使是这样,对于apache,或者是mysql,php等应用来说,还是应该通过编译安装才行,
实验环境
win7旗舰版 Vmare8.0Redhat6.0
1、挂载光盘
[root@localhost/]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mountingread-only
2、复制光盘中的软件包及repodata文件夹到本地/Server目录下
[root@localhost mnt]# cp -pr Packages /
[root@localhost Server]# cp -pr /mnt/repodata/ /Server/
3、检查yum的相关软件包是否装好
[root@localhost Packages]# rpm -qa | grepcreaterepo yum-3.2.27-14.el6.noarch.rpm yum-metadata-parser-1.1.2-14.1.el6.i686.rpmyum-plugin-security-1.1.26-11.el6.noarch.rpmyum-rhn-plugin-0.9.1-5.el6.noarch.rpm
安装createrepo
[root@localhost Packages]# rpm -ivh --aidcreaterepo-0.9.8-4.el6.noarch.rpm
warning: createrepo-0.9.8-4.el6.noarch.rpm:Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
deltarpm is needed by createrepo-0.9.8-4.el6.noarch
python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch
需要安装deltarpm 、python-deltarpm两个依赖包
装好这两个包
[root@localhost Packages]# rpm -ivh --aiddeltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning:deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, keyID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:deltarpm ########################################### [100%]
[root@localhost Packages]# rpm -ivh --aidpython-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning:python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature,key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-deltarpm ########################################### [100%]
再安装createrepo
[root@localhost Packages]# rpm -ivh --aidcreaterepo-0.9.8-4.el6.noarch.rpm
warning: createrepo-0.9.8-4.el6.noarch.rpm:Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
4、创建相关的yum文件
[root@localhost Server]# createrepo -g
/Server/repodata/21f8a36d9bca1b5b606702c5ce46b65017360348cace161b7910e0dfaa3cb087-comps-rhel6-Server.xml/Server/Packages/
5编辑yum配置文件
[root@localhost Server]# vim/etc/yum.repos.d/my.repo
[dvd]
baseurl=file:///Server
gpgcheck=0
enabled=1
保存后退出即可
总结:
Apache mysql等应用最好使用编译安装,一方面可以自定义编译模块,提供系统性能,另一方面,在卸载时,也可以避免出现因为卸载依赖包而卸载一些系统必要包所出现的一些不必要的麻烦。