Linux软件安装,常见的有三种方式,rpm方式、yum方式、源码编译安装方式。其中rpm方式可能存在依赖方式,可能会比较麻烦;源码编译安装同样可能会缺少一些编译需要的软件需要安装,也会比较麻烦;相对比较好的方式是yum方式,只要源仓库软件包齐全,安装时,缺少的依赖,会自动进行安装,简单方便。推荐使用yum方式。
注:除以上三种方式外,也有其他的一些安装方式,比如有一些应用软件,解压安装包后,里面可能有install的shell脚本或者python脚本,执行这些脚本进行安装。
1.rpm方式安装
1.1.rpm软件包下载上传
1.双击iso文件,使用DVD驱动器加载iso文件,Packages目录下找httpd的软件包。
注:也可以去网络上找对应Linux系统版本的rpm包

2.左上角的搜索框,填写httpd-搜索,找到httpd-后紧接版本号的文件,鼠标选中推出到本地。

3.通过SFTP协议工具(如Xftp)上传httpd软件包,上传到Downloads目录。
[root@localhost ~]# cd Downloads/
[root@localhost Downloads]# ll
total 2780
-rw-r--r--. 1 root root 2844028 Dec 24 16:18 httpd-2.4.6-88.el7.centos.x86_64.rpm
[root@localhost Downloads]#
1.2.rpm方式安装软件包
1.rpm方式安装软件包,可能会出现如下情况,错误信息提示:Failed dependencies(错误的依赖),代表安装httpd需要提前安装httpd-tools、libapr-1.so.0相关的软件包、libaprutil-1.so.0相关软件包。
注:这里需要注意,httpd-tools是明确直到缺少什么软件包,可以去镜像或者网络上下载;但是下面两个提示有一些是无法确认具体缺什么,只能找apr相关的软件包,安装后再安装httpd服务,软件包的查找、下载、上传、安装、确认等步骤都很麻烦。像这类软件依赖多的情况,建议使用yum方式安装。
[root@localhost Downloads]# rpm -ivh httpd-2.4.6-88.el7.centos.x86_64.rpm
error: Failed dependencies:
/etc/mime.types is needed by httpd-2.4.6-88.el7.centos.x86_64
httpd-tools = 2.4.6-88.el7.centos is needed by httpd-2.4.6-88.el7.centos.x86_64
libapr-1.so.0()(64bit) is needed by httpd-2.4.6-88.el7.centos.x86_64
libaprutil-1.so.0()(64bit) is needed by httpd-2.4.6-88.el7.centos.x86_64
2.部分简单的软件是可以直接使用rpm方式安装的;如free软件包,上传free软件包,直接使用rpm -ivh 软件包文件的名称即可安装,提示already installed即安装完成。
rpm -ivh中,i代表install(安装),v代表verbose(详细信息),h代表hash(打印散列标记)
[root@localhost Downloads]# ll
total 2828
-rw-r--r--. 1 root root 2844028 Dec 24 16:18 httpd-2.4.6-88.el7.centos.x86_64.rpm
-rw-r--r--. 1 root root 47508 Dec 24 16:39 tree-1.6.0-10.el7.x86_64.rpm
[root@localhost Downloads]# rpm -ivh tree-1.6.0-10.el7.x86_64.rpm
Preparing... ################################# [100%]
package tree-1.6.0-10.el7.x86_64 is already installed
[root@localhost Downloads]# rpm -qa | grep tree
tree-1.6.0-10.el7.x86_64
[root@localhost Downloads]#
2.yum方式安装
2.1.yum源配置
yum详细的配置步骤见Linux(Centos 7.6)yum源配置
2.2.yum源方式安装软件包
yum方式安装,直接执行yum install 软件包名称(不是文件名称,不带版本号);安装过程可以看到具体还需要安装哪些依赖的软件包(依赖软件包包括apr、apr-util、httpd-tools、mailcap),最后看到Complete!提示即安装完成。
[root@localhost Downloads]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-99.el7.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-99.el7.centos.1 for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.


2557

被折叠的 条评论
为什么被折叠?



