RHEL 安装软件包有两种安装方式

  1. 源码包安装软件复杂

安装的第一步就是将软件包的源代码编译成机器语言

优点是如果你想要哪些功能 你可以在代码上做出修改

源码包安装速度非常慢

  1. 二进制包的安装(rpm包安装)—早期redhat package manager,现在叫做rpm package manager

rpm包是已经组建好的系统可以直接识别二进制类型的包,所以安装速度非常快

缺点是软件包的安装位置在rpm 包组建好的时候就已经固定了,而且功能也已经固定了。

RHEL是通过rpm安装的。

 

如果安装软件,需要先下载软件

在RHEL7系统中 光盘里有软件

在LINUX系统中如果你想使用外部存储,就必须要挂载 mount 才可以使用。

 

mount /dev/sr0 /mnt

df -Th 查看挂载情况

umount /dev/sr0   或者 umount /mnt 挂载点

 

安装命令:

rpm -ivh  vsftpdXXXX

-i 表示安装 install

-v表示具体信息

-h 表示显示安装进度条

 

安装包必须是全名,必须指定安装路径

如果不在packages目录下需要在安装的时候指定绝对路径或者相对路径

比如在/root 下, 安装时候 rpm -ivh /mnt/Packages 包全名

 

卸载命令:

rpm -evh vsftp

卸载时候需要指定包名即可,不能全名

 

rpm -qi vsftpd 查看安装软件包的信息

rpm -qa | grep XXX 查看系统安装所有的软件包 并查询过滤你需要查的软件包

rpm -ql 包名  查询某个软件包的安装路径

rpm -qf 某个文件    该命令能查看到某个文件是从哪个软件包安装过来的

 

[root@rhce7-0 ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

 

[root@rhce7-0 ~]# rpm -qf /bin/passwd

passwd-0.79-4.el7.x86_64

[root@rhce7-0 ~]# rm -rf /bin/passwd

[root@rhce7-0 ~]# passwd

bash: passwd: command not found…

[root@rhce7-0 ~]# rpm -ivh passwd-0.79-4.el7.x86_64.rpm

警告:passwd-0.79-4.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID fd431d51: NOKEY

准备中…                          ################################# [100%]

软件包 passwd-0.79-4.el7.x86_64 已经安装

[root@station108 Packages]# passwd

bash: passwd: 未找到命令…

[root@rhce7-0 ~]# rpm -ivh passwd-0.79-4.el7.x86_64.rpm –force

[root@station108 Packages]# rpm -ivh passwd-0.79-4.el7.x86_64.rpm –force

警告:passwd-0.79-4.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID fd431d51: NOKEY

准备中…                          ################################# [100%]

正在升级/安装…

1:passwd-0.79-4.el7                ################################# [100%]

[root@rhce7-0 ~]# passwd

[root@station108 Packages]# passwd

更改用户 root 的密码 。

新的 密码:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

==================================

rpm包有一个致命的缺点, 使用rpm包安装软件会有依赖性

树形依赖

环形依赖

模块依赖

.so.0 表示是模块。         搜寻网站: www.rpmfind.net

 

[root@rhce7-0 Packages]# rpm -ivh httpd-2.4.6-17.el7.x86_64.rpm

warning: httpd-2.4.6-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

error: Failed dependencies:

/etc/mime.types is needed by httpd-2.4.6-17.el7.x86_64

httpd-tools = 2.4.6-17.el7 is needed by httpd-2.4.6-17.el7.x86_64

libapr-1.so.0()(64bit) is needed by httpd-2.4.6-17.el7.x86_64

libaprutil-1.so.0()(64bit) is needed by httpd-2.4.6-17.el7.x86_64

[root@rhce7-0 Packages]# rpm -ivh httpd-tools-2.4.6-17.el7.x86_64.rpm

warning: httpd-tools-2.4.6-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

error: Failed dependencies:

libapr-1.so.0()(64bit) is needed by httpd-tools-2.4.6-17.el7.x86_64

libaprutil-1.so.0()(64bit) is needed by httpd-tools-2.4.6-17.el7.x86_64

[root@rhce7-0 Packages]# rpm -ivh apr-

apr-1.4.8-3.el7.i686.rpm               apr-util-1.5.2-6.el7.i686.rpm

apr-1.4.8-3.el7.x86_64.rpm             apr-util-1.5.2-6.el7.x86_64.rpm

apr-devel-1.4.8-3.el7.i686.rpm         apr-util-devel-1.5.2-6.el7.i686.rpm

apr-devel-1.4.8-3.el7.x86_64.rpm       apr-util-devel-1.5.2-6.el7.x86_64.rpm

[root@rhce7-0 Packages]# rpm -ivh apr-1.4.8-3.el7.x86_64.rpm

warning: apr-1.4.8-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing…                          ################################# [100%]

Updating / installing…

1:apr-1.4.8-3.el7                  ################################# [100%]

[root@rhce7-0 Packages]# rpm -ivh apr-util-

apr-util-1.5.2-6.el7.i686.rpm          apr-util-devel-1.5.2-6.el7.i686.rpm

apr-util-1.5.2-6.el7.x86_64.rpm        apr-util-devel-1.5.2-6.el7.x86_64.rpm

[root@rhce7-0 Packages]# rpm -ivh apr-util-1.5.2-6.el7.x86_64.rpm

warning: apr-util-1.5.2-6.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing…                          ################################# [100%]

Updating / installing…

1:apr-util-1.5.2-6.el7             ################################# [100%]

[root@rhce7-0 Packages]# rpm -ivh httpd-2.4.6-17.el7.x86_64.rpm

warning: httpd-2.4.6-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

error: Failed dependencies:

/etc/mime.types is needed by httpd-2.4.6-17.el7.x86_64

httpd-tools = 2.4.6-17.el7 is needed by httpd-2.4.6-17.el7.x86_64

[root@rhce7-0 Packages]# rpm -ivh httpd-tools-2.4.6-17.el7.x86_64.rpm

warning: httpd-tools-2.4.6-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing…                          ################################# [100%]

Updating / installing…

1:httpd-tools-2.4.6-17.el7         ################################# [100%]

[root@rhce7-0 Packages]# rpm -ivh httpd-2.4.6-17.el7.x86_64.rpm

warning: httpd-2.4.6-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

error: Failed dependencies:

/etc/mime.types is needed by httpd-2.4.6-17.el7.x86_64

[root@rhce7-0 Packages]# rpm -ivh mailcap-2.1.41-2.el7.noarch.rpm

warning: mailcap-2.1.41-2.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing…                          ################################# [100%]

Updating / installing…

1:mailcap-2.1.41-2.el7             ################################# [100%]

[root@rhce7-0 Packages]# rpm -ivh httpd-2.4.6-17.el7.x86_64.rpm

warning: httpd-2.4.6-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing…                          ################################# [100%]

Updating / installing…

1:httpd-2.4.6-17.el7               ################################# [100%]

[root@rhce7-0 Packages]#

yum 可以更好的解决rpm包依赖性关系的方法

yum 的配置文件 /etc/yum.repos.d/

 

在/etc/yum.repos.d/下创建以.repo 结尾的文件

编辑此文件 vim

[yum-name] 表示yum 仓库的名称

name        名称 随意指定

baseurl file:///mnt        base URL 指定的是记录软件包依赖关系的目录repodata【file://表示本机/本地】

enabled = 1    表示仓库是可用的

gpgcheck = 0  软件安装不用认证

 

yum list 可以查看软件搭建的是否正确 同时下载缓存

yum repolist

yum install mariadb-server <tab>

yum remove xxxxxx 不删除依赖性软件

yum history

yum history info <ID>

yum history undo 2—– 撤销安装的所有的有依赖性的软件

 

也可以用命令创建repo 文件

 

yum-config-manager –add-repo=file:///mnt   —baseurl的位置

echo “gpgcheck=0” >> /etc/yum.repos.d/mnt.repo

cat /etc/yum.repos.d/mnt.repo

网易开源镜像站:http://mirrors.163.com/  这里面有repodata 只要满足能上网就可以用这里面的repodata

 

如何查看安装软件包组的安装

yum grouplist

yum -y groupinstall “Virtualization Host“

yum upgrade

 

yum group list

yum group install “G”

 

yum group install “virt*”   virt-manager

 

切换字符界面

yum -y groupinstall “Server with GUI”

systemctl isolate   启动目标   临时修改

systemctl set-default graphical.target       表示下次设置开启为图形化界面

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

© 2018 Mr. Xiao's Blog Suffusion theme by Sayontan Sinha