12 简单源码安装和yum安装的区别
12 简单源码安装和yum安装的区别
12.1 安装对比
./nginx -V 命令可以查看到所安装 nginx 的版本及相关配置信息
源码简单安装
[root@nginx-100 /usr/local/nginx/sbin]# ./nginx -V nginx version: nginx/1.16.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) configure arguments:
yum 安装
[root@nginx-120 /usr/sbin]# nginx -V nginx version: nginx/1.26.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules \ --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp \ --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx \ --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module \ --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module \ --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module \ --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream \ --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module \ --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong \ --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' \ --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
结论:上述中 两个的 configure arguments 差异最大,通过 yum 源在线安装,添加的配置有很多,后续会详细介绍
12.2 编译目录
[root@nginx-100 ~]# cd nginx/core/nginx-1.16.1/ [root@nginx-100 ~/nginx/core/nginx-1.16.1]# ll total 752 drwxr-xr-x 6 1001 1001 326 Mar 10 23:14 auto -rw-r--r-- 1 1001 1001 296463 Aug 13 2019 CHANGES -rw-r--r-- 1 1001 1001 452171 Aug 13 2019 CHANGES.ru drwxr-xr-x 2 1001 1001 168 Mar 10 23:14 conf -rwxr-xr-x 1 1001 1001 2502 Aug 13 2019 configure drwxr-xr-x 4 1001 1001 72 Mar 12 22:17 contrib drwxr-xr-x 2 1001 1001 40 Mar 10 23:14 html -rw-r--r-- 1 1001 1001 1397 Aug 13 2019 LICENSE -rw-r--r-- 1 root root 376 Mar 10 23:18 Makefile drwxr-xr-x 2 1001 1001 21 Mar 10 23:14 man drwxr-xr-x 3 root root 174 Mar 10 23:21 objs -rw-r--r-- 1 1001 1001 49 Aug 13 2019 README drwxr-xr-x 9 1001 1001 91 Mar 10 23:14 src
auto:编译相关的脚本文件 CHANGES:nginx 不同版本的变更记录 CHANGES.ru:nginx 不同版本的变更记录(俄文) conf:配置文件 configure:nginx 软件的自动脚本程序( C语言编写都会用到编译脚本,作用: 1.检测环境,根据检测环境的结果,生成C语言代码 2.生成编译代码需要的 Makefile 文件) contrib:源码包的辅助工具目录 html:包含默认正确 index.html 页面和错误 50x.html 页面 LICENSE:许可证的相关描述文件 Makefile:编译安装的 “自动化脚本”,configure编译后生成 man:nginx 的帮助文档 objs:编译过程中自动生成的临时/产物目录,configure编译后生成 README:nginx 阅读指南 src:nginx 源代码
12.3 configure
# 查看configure 信息,通过配置 configure 完成 nginx 源码复杂安装 [root@nginx-100 ~/nginx/core/nginx-1.16.1]# ./configure --help --help print this message --prefix=PATH set installation prefix --sbin-path=PATH set nginx binary pathname --modules-path=PATH set modules path --conf-path=PATH set nginx.conf pathname --error-log-path=PATH set error log pathname --pid-path=PATH set nginx.pid pathname --lock-path=PATH set nginx.lock pathname ..........
———————————————————————————————————————————————————————————————————————————
无敌小马爱学习
浙公网安备 33010602011771号