In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article editor for you detailed introduction of "CentOS how to install Tengine", the content is detailed, the steps are clear, the details are handled properly, I hope this "CentOS how to install Tengine" article can help you solve your doubts, following the editor's ideas slowly in-depth, let's learn new knowledge together.
1. Install the necessary compilation environment.
Because the tengine installation requires self-compilation using the source code, you need to install the necessary compilation tools before installation:
The copy code is as follows:
# yum update
# yum install gcc gcc-c++ autoconf automake
2. Install the required components
A 、 pcre
Pcre (perl compatible regular expressions) is a perl library, including a perl-compatible library of regular expressions. Nginx rewrite depends on the pcre library, so be sure to install pcre before installing tengine. The latest version of pcre is available on the official website (). The specific installation process is as follows:
The copy code is as follows:
Cd / usr/local/src
Wget
Tar zxvf pcre-8.36.tar.gz
Cd pcre-8.36
. / configure-- prefix=/usr/local/pcre
Make & & make install
The copy code is as follows:
The installation of source code generally consists of three steps: configure, make, and make install.
Configure is an executable script that has many options. Use the command. / configure-help to output a detailed list of options under the source path to be installed. The-prefix option is the path to configure the installation. If this option is not configured, the executable file is placed at / usr/local/ bin by default, the library file is placed at / usr/local/lib by default, the configuration file is placed at / usr/local/etc by default, and other resource files are placed at / usr/local/ share, which is messy.
If you configure-prefix, such as:. / configure-prefix=/usr/local/test, you can put all resource files in the path of / usr/local/test without clutter.
Another benefit of using the-prefix option is to uninstall or migrate the software. When an installed software is no longer needed, simply delete the installation directory and uninstall the software cleanly; migrate the software simply by copying the entire directory to another machine (the same operating system). Of course, to uninstall the program, you can also use make uninstall once in the original make directory, but only if the make file has specified uninstall.
B 、 openssl
Openssl is a powerful secure socket layer cipher library that includes major cryptographic algorithms, commonly used key and certificate encapsulation management functions, and ssl protocols, and provides rich applications for testing or other purposes. The main purpose of installing openssl () is to enable tengine to support access requests from https. Whether to install or not depends on the demand.
The copy code is as follows:
Cd / usr/local/src
Wget
Tar zxvf openssl-1.0.2.tar.gz
Cd openssl-1.0.2.tar.gz
. / configure-- prefix=/usr/local/openssl
Make & & make install
C 、 zlib
Zlib is a library that provides data compression, and zlib () is needed when tengine wants to enable gzip compression.
The copy code is as follows:
Cd / usr/local/src
Wget
Tar zxvf zlib-1.2.8.tar.gz
Cd zlib-1.2.8.tar.gz
. / configure-- prefix=/usr/local/zlib
Make & & make install
D 、 jemalloc
Jemalloc () is a better memory management tool, and using jemalloc can better optimize the memory management of tengine.
The copy code is as follows:
Cd / usr/local/src
Wget
Tar jxvf jemalloc-3.6.0.tar.bz2
Cd jemalloc-3.6.0.tar.bz2
. / configure-- prefix=/usr/local/jemalloc
Make & & make install
3. Install tengine
Tegine can be installed after the main core components are installed, and the latest version of tegine is available on the official website ().
One more thing you need to do before compiling and installing is to add a dedicated user to execute tengine. Of course you can also use root (not recommended).
The copy code is as follows:
Groupadd www-data
Useradd-s / sbin/nologin-g www-data www-data
The next step is to install:
The copy code is as follows:
Cd / usr/local/src
Wget
Tar-zxvf tengine-2.1.0.tar.gz
Cd tengine-2.1.0
. / configure-- prefix=/usr/local/nginx\
-- user=www-data\
-- group=www-data\
-- with-pcre=/usr/local/src/pcre-8.36\
-- with-openssl=/usr/local/src/openssl-1.0.2\
-- with-jemalloc=/usr/local/src/jemalloc-3.6.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.8
Make & & make install
Note that when configuring-with-pcre,-with-openssl,-with-jemalloc,-with-zlib, the path is the path of the source file.
4. Configure tengine and set tengine to start automatically
The copy code is as follows:
# vim / etc/rc.d/init.d/nginx
# Edit startup file to add the following
#! / bin/bash
# nginx startup script for the nginx http server
# it is v.0.0.2 version.
# chkconfig:-85 15
# description: nginx is a high-performance web and proxy server.
# it has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: / var/run/nginx.pid
# config: / usr/local/nginx/conf/nginx.conf
Nginxd=/usr/local/nginx/sbin/nginx
Nginx_config=/usr/local/nginx/conf/nginx.conf
Nginx_pid=/usr/local/nginx/logs/nginx.pid
Retval=0
Prog= "nginx"
# source function library.
. / etc/rc.d/init.d/functions
# source networking configuration.
. / etc/sysconfig/network
# check that networking is up.
[${networking} = "no"] & & exit 0
[- x $nginxd] | | exit 0
# start nginx daemons functions.
Start () {
If [- e $nginx_pid]; then
Echo "nginx already running...."
Exit 1
Fi
Echo-n $"starting $prog:"
Daemon $nginxd-c ${nginx_config}
Retval=$?
Echo
[$retval = 0] & & touch / var/lock/subsys/nginx
Return $retval
}
# stop nginx daemons functions.
Stop () {
Echo-n $"stopping $prog:"
Killproc $nginxd
Retval=$?
Echo
[$retval = 0] & & rm-f / var/lock/subsys/nginx / usr/local/nginx/logs/nginx.pid
}
Reload () {
Echo-n $"reloading $prog:"
# kill-hup `cat ${nginx_pid} `
Killproc $nginxd-hup
Retval=$?
Echo
}
# see how we were called.
Case "$1" in
Start)
Start
Stop)
Stop
Reload)
Reload
Restart)
Stop
Start
Status)
Status $prog
Retval=$?
*)
Echo $"usage: $prog {start | stop | restart | reload | status | help}"
Exit 1
Esac
Exit $retval
Save exit
The copy code is as follows:
Chmod 775 / etc/rc.d/init.d/nginx # gives file execution permissions
Chkconfig nginx on # set boot up
Service nginx restart # start the service
Read here, this "CentOS how to install Tengine" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more about the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.