Tengine installation Configuration whole process

Source: Internet
Author: User

There is a very simple tutorial on the Tengine website which does not involve some common settings, so it is for reference only. An afternoon for my installation procedures and procedures.

1, install the necessary compilation environment good

Because Tengine installations require self-compiling using source code, the necessary compilation tools need to be installed before installation:

Yum Update-y
Yum Install gcc gcc-c++ bzip2-y

2, install the required components

A, PCRE

PCRE (perl Compatible Regular Expressions) is a Perl library that includes a Perl-compatible regular expression library. Nginx rewrite relies on the Pcre library, so be sure to install the tengine before installing the Pcre

cd/usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
Tar zxvf pcre-8.39.tar.gz
CD pcre-8.39
./configure--prefix=/usr/local/pcre
Make && make install

B, Zlib

Zlib is a library of functions that provide data compression, which is required when Tengine wants to enable gzip compression zlib (http://www.zlib.net/).

cd/usr/local/src
wget http://zlib.net/zlib-1.2.10.tar.gz
Tar zxvf zlib-1.2.10.tar.gz
CD zlib-1.2.10
./configure--prefix=/usr/local/zlib
Make && make install

C, Jemalloc

Jemalloc (http://www.canonware.com/jemalloc/) is a better memory management tool that uses JEMALLOC to better optimize tengine memory management.

cd/usr/local/src
wget https://github.com/jemalloc/jemalloc/releases/download/4.4.0/jemalloc-4.4.0.tar.bz2
Tar xvf jemalloc-4.4.0.tar.bz2
CD jemalloc-4.4.0
./configure--prefix=/usr/local/jemalloc
Make && make install

D, OpenSSL

OpenSSL is a strong Secure Sockets Layer cipher library that includes key cryptographic algorithms, common key and certificate encapsulation management functions, and SSL protocols, and provides a rich set of applications for testing or other purposes. , the installation of OpenSSL (http://www.openssl.org/source/) is primarily to allow Tengine to support HTTPS access requests. Whether the installation depends on the requirements.

CD/USR/LOCAL/SRC
wget http://www.openssl.org/source/openssl-1.0.2.tar.gz
Tar zxvf openssl-1.0.2.tar.gz
CD openssl-1.0.2
./configure--prefix=/usr/local/openssl
Make && make install

3, Installation Tengine

Tegine can be installed after the main core components are installed, and the latest version of Tegine can be obtained from the official website (http://tengine.taobao.org/).
One more thing to do before compiling the installation is to add a dedicated user to execute the tengine. Of course you can also use root (not recommended).

Groupadd www
useradd-s/sbin/nologin-g www www

The next step is to install:

cd/usr/local/src
wget http://tengine.taobao.org/download/tengine-2.2.0.tar.gz
TAR-ZXVF tengine-2.2.0.tar.gz
CD tengine-2.2.0
./configure--prefix=/usr/local/nginx \
--user=www \
--group=www \
--with-pcre=/usr/local/src/pcre-8.39 \
--with-openssl=/usr/local/src/openssl-1.0.2 \
--with-jemalloc=/usr/local/src/jemalloc-4.4.0 \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_concat_module \
--with-zlib=/usr/local/src/zlib-1.2.10
Make && make install

Note that the path of –with-pcre, –with-openssl, –with-jemalloc, –with-zlib is the path of the source file when configured.

4, configure Tengine, set Tengine auto start

Directory of services started after system users log on to the system/usr/lib/systemd/system
If you need to power on without logging in the case can run the program in the system directory/lib/systemd/system

I want the system to boot up the directory, so I put the file in the system directory.
Vim/lib/systemd/system/nginx.service

[Unit] Description=the nginx HTTP and reverse proxy serverafter=syslog.target network.target Remote-fs.target Nss-lookup.target [service]type=forkingpidfile=/usr/local/nginx/logs/nginx.pidexecstartpre=/usr/local/nginx/ SBIN/NGINX-TEXECSTART=/USR/LOCAL/NGINX/SBIN/NGINX-C/usr/local/nginx/conf/nginx.confexecreload=/bin/kill-s HUP $ Mainpidexecstop=/bin/kill-s QUIT $MAINPIDPrivateTmp =true [install]wantedby=multi-user.target


Modify file Permissions chmod 745 nginx.service
Set to boot Systemctl enable Nginx.service

Start Nginx service Systemctl start Nginx.service
Set boot Systemctl enable Nginx.service
Stop booting from systemctl disable Nginx.service
View service current status Systemctl status Nginx.service
Restart Service Systemctl Restart Nginx.service

View all services that have been started Systemctl list-units--type=service

Tengine installation Configuration whole process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.