九、源码安装软件

wangzhaoyang 发布于 13 天前 21 次阅读 网络工程中的Linux系统 无~ 327 字


源码包安装应用场景:

  1. 所需要的软件包没有对应的二进制版本(RPM版本。如果是 ubuntu deb 版本)
  2. 定制化(需要定制功能或者自定义安装的路径)
  3. 源码包安装可以在必要时刻修补漏洞,可以将软件包安裝到最新的版本

源码包卸载 停止服务,删除安装目录

编译工具套件安装

[root@localhost ~]# dnf -y install gcc
[root@localhost ~]# dnf -y install gcc-c++
[root@localhost ~]# dnf -y install make

nginx安装示例

[root@localhost opt]# wget https://nginx.org/download/nginx-1.27.1.tar.gz
[root@localhost opt]# tar -xzf nginx-1.27.1.tar.gz 
[root@localhost opt]# cd nginx-1.27.1

源码安装三部曲

  1. 预配置
[root@localhost opt]# ./configure --prefix=/usr/local/nginx   --with-http.ssLmodule    # --prefix 是指定安装的路径 --with 指定模块

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.


[root@localhost nginx-1.27.1]# dnf -y install pcre
[root@localhost nginx-1.27.1]# dnf -y install pcre-devel
[root@localhost nginx-1.27.1]# dnf -y install zlib-devel
[root@localhost opt]# make &8/ make install
  1. 预编译
[root@localhost nginx-1.27.1]# make

3.编译安装

[root@localhost nginx-1.27.1]# make install