Linux_安装软件包
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux_安装软件包相关的知识,希望对你有一定的参考价值。
一、软件包:
- 源码包
- 二进制包(rpm包,编译完成)
- 依赖性 包A-->包B-->包C
一、rpm
- 挂载镜像,从镜像文件中找到要安装的rpm包
[[email protected] ~]# mount /dev/cdrom1 /media/
mount: block device /dev/sr0 is write-protected, mounting read-only - 查询已安装的好的包
[[email protected] ~]# 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包是否被安装
[[email protected] Packages]# rpm -qa | grep "^bind$"
[[email protected] Packages]# # 没有被安装
- 那么在/media/Package目录下查找到bind包,进行安装
[[email protected] 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
[[email protected]-linux Packages]# rpm -ivh bind-9.8.2-0.30.rc1.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:bind ########################################### [100%]
- 查看安装的bind包会有那些文件(包括配置文件的目录位置)
[[email protected]-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
- ...
- 查看某个文件来自于那个包
[[email protected] Packages]# rpm -qf /etc/ntp.conf
ntp-4.2.6p5-10.el6.centos.1.x86_64
8. 卸载
[[email protected] Packages]# rpm -e 文件名 # 不用带后缀
二、yum
- 优点:方便,快捷,自动找到并安装依赖的包
- 缺点:必须联网安装,yum源一定要正确
- 查看系统安装了哪些包
[[email protected] Packages]# yum list | grep "@" #得到结果中base为仓库名,@代表已安装
使用yum安装httpd-devel
[[email protected]-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是否已经安装好了
[[email protected]-linux Packages]# yum list | grep "httpd-devel" | grep "@"
httpd-devel.x86_64 2.2.15-54.el6.centos @updates
- 卸载安装过的rpm包
[[email protected] Packages]# yum -y remove httpd-devel
- yum仓库(源) :mirrors.163.com/mirrors.sohu.com
- yum仓库位置:/etc/yum.repos.d/
以上是关于Linux_安装软件包的主要内容,如果未能解决你的问题,请参考以下文章