首页 > 代码库 > Linux_安装软件包
Linux_安装软件包
一、软件包:
- 源码包
- 二进制包(rpm包,编译完成)
- 依赖性 包A-->包B-->包C
一、rpm
- 挂载镜像,从镜像文件中找到要安装的rpm包
[root@hadoop09-linux ~]# mount /dev/cdrom1 /media/
mount: block device /dev/sr0 is write-protected, mounting read-only - 查询已安装的好的包
[root@hadoop09-linux ~]# rpm -qa # -a all -q query
openssh-server-5.3p1-84.1.el6.x86_64
poppler-0.12.4-3.el6_0.1.x86_64
festvox-slt-arctic-hts-0.20061229-18.el6.noarch
dejavu-fonts-common-2.30-2.el6.noarch - 来安装一个,看看bind包是否被安装
[root@hadoop09-linux Packages]# rpm -qa | grep "^bind$"
[root@hadoop09-linux Packages]# # 没有被安装
- 那么在/media/Package目录下查找到bind包,进行安装
[root@hadoop09-linux Packages]# ll | grep "bind"
-r--r--r--. 2 root root 4157992 Feb 23 2013 bind-9.8.2-0.17.rc1.el6.x86_64.rpm - 使用rpm安装bind
[root@hadoop09-linux Packages]# rpm -ivh bind-9.8.2-0.30.rc1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:bind ########################################### [100%]
- 查看安装的bind包会有那些文件(包括配置文件的目录位置)
[root@hadoop09-linux shell]# rpm -ql `rpm -qa | grep "bind-9.8.2-0.30.rc1.el6.x86_64"`
/etc/NetworkManager/dispatcher.d/13-named
/etc/logrotate.d/named
/etc/named
/etc/named.conf
/etc/named.iscdlv.key
/etc/named.rfc1912.zones
- ...
- 查看某个文件来自于那个包
[root@hadoop09-linux Packages]# rpm -qf /etc/ntp.conf
ntp-4.2.6p5-10.el6.centos.1.x86_64
8. 卸载
[root@hadoop09-linux Packages]# rpm -e 文件名 # 不用带后缀
二、yum
- 优点:方便,快捷,自动找到并安装依赖的包
- 缺点:必须联网安装,yum源一定要正确
- 查看系统安装了哪些包
[root@hadoop09-linux Packages]# yum list | grep "@" #得到结果中base为仓库名,@代表已安装
使用yum安装httpd-devel [root@hadoop09-linux Packages]# yum -y install httpd-devel
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
- ...
- 查看httpd-devel是否已经安装好了
[root@hadoop09-linux Packages]# yum list | grep "httpd-devel" | grep "@"
httpd-devel.x86_64 2.2.15-54.el6.centos @updates
- 卸载安装过的rpm包
[root@hadoop09-linux Packages]# yum -y remove httpd-devel
- yum仓库(源) :mirrors.163.com/mirrors.sohu.com
- yum仓库位置:/etc/yum.repos.d/
Linux_安装软件包