Home > Operation and Maintenance > Linux Operation and Maintenance > Detailed explanation of CentOS system compilation and installation examples

Detailed explanation of CentOS system compilation and installation examples

零下一度
Release: 2017-07-19 09:32:42
Original
1278 people have browsed it

CentOS system compilation and installation of the LNMP environment is something that needs to be done every time a new server or computer is changed. Only one record is made here. Give beginners a reference!

1. Pre-installation environment

The CentOS 7 system is used here.

By default, we place the downloaded software in /data/soft (can be set according to personal preferences)

By default, the server application is installed under /data/apps (can be set according to personal preferences) )

Get nginx package

configure --sbin-path=/user/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid -path=/usr/local/nginx/nginx.pid

Error reporting

./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= option

Get pcre package

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

Install pcre

cd /usr/local/src

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar. gz

tar -zxvf pcre-8.37.tar.gz

cd pcre-8.34

./configure --prefix=/usr/local/pcre

make

make install

Error reporting

configure: error: You need a C++ compiler for C++ support.

Install gcc

yum install gcc gcc-c++

Install pcre again, successfully installed pcre

Reinstall nginx

./configure --sbin-path=/user/local/nginx /nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid

Error reporting

./configure : error: the HTTP gzip module requires the zlib library.

You can either disable the module by using --without-http_gzip_module

option, or install the zlib library into the system, or build the zlib library

statically from the source with nginx by using --with-zlib= option.

Install zlib

Get the zlib package

[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./configure --prefix=/usr/local /zlib

make && make install

Reinstall nginx

./configure --sbin-path=/user/local/nginx/nginx --conf-path= /usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid

make && make install

Start

[ root@bogon nginx]# systemctl start nginx

Failed to start nginx.service: Unit nginx.service failed to load: No such file or directory.

Description installation failed

Is ssl not installed? I found that the system has it installed. If you don’t worry, I will install it again.

./config --prefix=/usr/local --openssldir=/usr/local/ssl

make && make install

./config shared --prefix =/usr/local --openssldir=/usr/local/ssl

make clean

make && make install

It seems that it is more reliable to install according to the tutorial

Delete zlib pcre

Go to the corresponding directory and run make uninstall

Install pcre

cd /usr/local/src

wget ftp ://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

tar -zxvf pcre-8.37.tar.gz

cd pcre-8.34

./configure --prefix=/usr/local/pcre

make

make install

Install zlib

Get zlib package

[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./configure --prefix=/usr/local/zlib

make && make install

Reinstall nginx

./configure --sbin-path =/usr/local/nginx/nginx \

--conf-path=/usr/local/nginx/nginx.conf \

--pid-path=/usr/local/ nginx/nginx.pid \

--with-http_ssl_module \

--with-pcre=/usr/local/src/pcre-8.40 \

--with -zlib=/usr/local/src/zlib-1.2.11 \

--with-openssl=/usr/local/src/openssl-1.0.2l

[root@bogon nginx-1.12.0]# ./configure --sbin-path=/usr/local/nginx/nginx \

> --conf-path=/usr/local/ nginx/nginx.conf \

> --pid-path=/usr/local/nginx/nginx.pid \

local/src/openssl-1.0.2l> --with -http_ssl_module \

> --with-pcre=/usr/local/src/pcre-8.40 \

> --with-zlib=/usr/local/src/zlib -1.2.11 \

> --with-openssl=/usr/local/src/openssl-1.0.2l

[root@bogon nginx-1.12.0]# make && make install

Modify /etc/local/nginx/nginx.conf and change the lisent product 80 to 8080

Start the service: /etc/local/nginx/nginx

Access :192.168.158.128:8080

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.

Commercial support is available at nginx.com.

Thank you for using nginx.

Start nginx service

Method one:

/usr/local/nginx/nginx

Method two (-c nginx configuration file address):

/usr/local/nginx/ nginx -c /usr/local/nginx/nginx.conf

Stop the nginx service

Method 1: Stop it calmly

View the process

[root@ bogon nginx]# ps -ef | grep nginx

root 62024 1 0 07:01 ? 00:00:00 nginx: master process /usr/local/nginx/nginx

nobody 62025 62024 0 07:01 ? 00:00:00 nginx: worker process

root 62308 18453 0 07:14 pts/1 00:00:00 grep --color=auto nginx

Kill process

[root@bogon nginx] # kill -QUIT 62024

Method 2: Quick stop

View process

[root@bogon nginx]# ps -ef | grep nginx

root 62358 1 0 07:17 ? 00:00:00 nginx: master process /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf

nobody 62359 62358 0 07:17 ? 00:00:00 nginx: worker process

root 62463 18453 0 07:20 pts/1 00:00:00 grep --color=auto nginx

Kill process

[root@bogon nginx]# kill -TERM 62358

or

[root@bogon nginx]# /usr/local/nginx/nginx -c /usr/local/nginx/ nginx.conf

[root@bogon nginx]# ps -ef | grep nginx

root 62473 1 0 07:21 ? 00:00:00 nginx: master process /usr/local/ nginx/nginx -c /usr/local/nginx/nginx.conf

nobody 62474 62473 0 07:21 ? 00:00:00 nginx: worker process

root 62476 18453 0 07: 21 pts/1 00:00:00 grep --color=auto nginx

[root@bogon nginx]# kill -INT 62473

Method 3: Force stop

[root@bogon nginx]# pkill -9 nginx

The above is the detailed content of Detailed explanation of CentOS system compilation and installation examples. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template