源码包管理

源码包管理

./configure 		#我想做什么菜,给哪个客人 -->  弄成一份清单
make			#按照清单做成对应的食物
make install		#将食物端到客人的桌上

1.下载一个源码包到本地

[root@container ~]# wget http://nginx.org/download/nginx-1.16.1.tar.gz        

2.创建个目录存放

[root@container ~]# mkdir  /soft                      					       

#将下载的源码包解压,移动到上面创建的目录
[root@container ~]# tar xf nginx-1.16.1.tar.gz  -C /soft/					

#进入解压后存放文件的目录
[root@container ~]# cd /soft/nginx-1.16.1/							

3.开始编译

#指定路径生成一个makefile。   执行命令开始检查,后出现了下面报错信息把报错解决
[root@container nginx-1.16.1]# ./configure --prefix=/usr/local/nginx-1.16	

#报错信息
报错一:
./configure: error: the HTTP rewrite module requires the PCRE library.
[root@container nginx-1.16.1]# yum install pcre-devel -y
报错二:
./configure: error: the HTTP gzip module requires the zlib library.
[root@container nginx-1.16.1]# yum install zlib-devel -y



#解决完报错执行make把c语言转换成二进制文件
[root@container nginx-1.16.1]# make							

#上传到之前指定的路径中
[root@container nginx-1.16.1]# make install			

#为了后期好升级设置软连接
[root@container nginx-1.16.1]# ln -s /usr/local/nginx-1.16/ /usr/local/nginx    

4.启动服务

#停止此前的httpd服务,避免端口被占用造成nginx无法启动
[root@container nginx-1.16.1]# systemctl stop httpd

#启动nginx
[root@container nginx-1.16.1]# /usr/local/nginx/sbin/nginx
posted @ 2022-04-19 00:58  小迷茫c  阅读(49)  评论(0)    收藏  举报