二进制安装
1、rpm工具安装 http
局限性:不能解决依赖关系,例如你需要安装一个A包,但是用rpm工具安装的时候,会提示依赖B包,这时你需要去先安装B包,然后你就去安装B包,但可能又会提示你依赖于C包,这时你又得先去安装C包,以此类推,过程比较繁琐,如果你要安装的包没有依赖其他的包,装的时候也就不会提示了,也很快捷。
[root@xiaoxizi ~]# rpm -qa |grep http:查看已经安装的关于http的包(-qa表示所有的),看到当前系统已经安装过了,先卸载,再安装
httpd-tools-2.2.15-26.el6.centos.x86_64
httpd-2.2.15-26.el6.centos.x86_64
[root@xiaoxizi ~]# rpm -e httpd:卸载http
[root@xiaoxizi ~]# mkdir /media/cdrom/:建立挂载点
[root@xiaoxizi ~]# mount /dev/cdrom /media/cdrom/:挂载光驱到挂载点
[root@xiaoxizi ~]# cd /media/cdrom/Packages/:进入这个目录(包都存放在Packages目录下)
[root@xiaoxizi Packages]# ll http*:查看该目录下以http开头的包
[root@xiaoxizi Packages]# rpm -ivh httpd-2.2.15-26.el6.centos.x86_64.rpm:安装http时,会提示有依赖关系,先得把依赖的包httpd-tools给装上去
error: Failed dependencies:
httpd-tools = 2.2.15-26.el6.centos is needed by httpd-2.2.15-26.el6.centos.x86_64
[root@xiaoxizi Packages]# rpm -ivh httpd-tools-2.2.15-26.el6.centos.x86_64.rpm:所以先装httpd所以来的包
Preparing... ########################################### [100%]
1:httpd-tools ########################################### [100%]
[root@xiaoxizi Packages]# rpm -ivh httpd-tools-2.2.15-26.el6.centos.x86_64.rpm:再装httpd这个包
Preparing... ########################################### [100%]
1:httpd-tools ########################################### [100%]
[root@xiaoxizi Packages]# rpm -ivh httpd-2.2.15-26.el6.centos.x86_64.rpm
Preparing... ########################################### [100%]
1:httpd ########################################### [100%]
这样就把http给装上了
2、yum工具安装 http
优点:能够解决依赖关系
[root@xiaoxizi ~]# mkdir /media/cdrom/:建立挂载点
[root@xiaoxizi ~]# mount /dev/cdrom /media/cdrom/:挂载光驱到挂载点
[root@xiaoxizi ~]# cd /media/cdrom/Packages/:进入这个目录(包都存放在Packages目录下)
[root@xiaoxizi ~]# mount:查看是否挂载成功(成功的标志是出现iso9660文件系统)
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sr0 on /media/cdrom type iso9660 (ro)
[root@xiaoxizi ~]# cd /media/cdrom/Packages/:进入这个目录(包都存放在Packages目录下)
yum --disablerepo=\* --enablerepo=c6-media install httpd:安装http,接下来会出现依赖关系的解析,输入y,依赖的包就自动安装了,如下所示:
Dependencies Resolved
=================================================================
Package Arch Version Repository Size
=================================================================
Installing:
httpd x86_64 2.2.15-26.el6.centos c6-media 821 k
Installing for dependencies:
httpd-tools x86_64 2.2.15-26.el6.centos c6-media 72 k
Transaction Summary
=================================================================
Install 2 Package(s)
Total download size: 893 k
Installed size: 3.1 M
Is this ok [y/N]:
这样就安装成功了