Aliyun Linux 編譯安裝 php7.3 tengine2.3.2 mysql8.0 redis5的過程詳解
介紹
之前寫過 CentOS 安裝 PHP,MySQL,Nginx 的相關(guān)文章,具體介紹這里就不寫了,直接上操作步驟.
安裝 Tengine
1. 安裝必要的編譯環(huán)境
yum update yum install gcc gcc-c++ autoconf automake
2. 安裝需要的組件 PCRE
PCRE(Perl Compatible Regular Expressions) http://www.pcre.org 是一個Perl庫,包括 perl 兼容的正則表達式庫。nginx rewrite依賴于PCRE庫,所以在安裝Tengine前一定要先安裝PCRE,最新版本的PCRE可在官網(wǎng)獲取。具體安裝流程為:
cd /usr/local/src wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz tar zxvf pcre-8.43.tar.gz cd pcre-8.43 ./configure --prefix=/usr/local/pcre make && make install
OpenSSL
OpenSSL http://www.openssl.org/source 是一個強大的安全套接字層密碼庫,囊括主要的密碼算法、常用的密鑰和證書封裝管理功能及SSL協(xié)議,并提供豐富的應(yīng)用程序供測試或其它目的使用。安裝OpenSSL 主要是為了讓tengine支持Https的訪問請求。具體是否安裝看需求。安裝流程為:
cd /usr/local/src wget http://www.openssl.org/source/openssl-1.0.2s.tar.gz tar zxvf openssl-1.0.2s.tar.gz cd openssl-1.0.2s ./config --prefix=/usr/local/openssl make && make install
Zlib
Zlib http://www.zlib.net 是提供資料壓縮之用的函式庫,當Tengine想啟用GZIP壓縮的時候就需要使用到Zli。安裝流程為:
cd /usr/local/src wget http://zlib.net/zlib-1.2.11.tar.gz tar zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure --prefix=/usr/local/zlib make && make install
jemalloc
jemalloc http://www.canonware.com/jemalloc 是一個更好的內(nèi)存管理工具,使用jemalloc可以更好的優(yōu)化Tengine的內(nèi)存管理。安裝流程為:
cd /usr/local/src wget https://src.fedoraproject.org/lookaside/pkgs/jemalloc/jemalloc-5.2.1.tar.bz2/sha512/0bbb77564d767cef0c6fe1b97b705d368ddb360d55596945aea8c3ba5889fbce10479d85ad492c91d987caacdbbdccc706aa3688e321460069f00c05814fae02/jemalloc-5.2.1.tar.bz2 tar jxvf jemalloc-5.2.1.tar.bz2 cd jemalloc-5.2.1 ./configure --prefix=/usr/local/jemalloc make && make install
3. 安裝Tengine
在主要核心的組件安裝完畢以后就可以安裝Tegine了,最新版本的Tegine可從官網(wǎng) http://tengine.taobao.org 獲取。在編譯安裝前還需要做的一件事是添加一個專門的用戶來執(zhí)行Tengine。當然你也可以用root(不建議)。
添加用戶及用戶組:
# 添加www組 groupadd -r www # 創(chuàng)建www運行賬戶nginx并加入到www組,不允許www用戶直接登錄系統(tǒng) useradd -s /sbin/nologin -g www -r www
編譯安裝Tengine TODO
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.40 \ --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.11 make && make install
注意配置的時候 –with-pcre 、–with-openssl、–with-jemalloc、–with-zlib的路徑為源文件的路徑。
4. CentOS 7 配置Tengine,設(shè)置tengine開機自啟
# 系統(tǒng)用戶登錄系統(tǒng)后啟動的服務(wù)的目錄 /usr/lib/systemd/system # 如需要開機沒有登陸情況下就能運行的程序在系統(tǒng)目錄內(nèi) /usr/lib/systemd/system # 我希望系統(tǒng)開機就啟動目錄,所以我把文件放在系統(tǒng)目錄內(nèi)。 vim /lib/systemd/system/nginx.service [Unit] Description=The nginx HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
# 修改文件權(quán)限 chmod 745 nginx.service # 設(shè)置為開機啟動 systemctl enable nginx.service # 其它命令 # 啟動nginx服務(wù) systemctl start nginx.service # 設(shè)置開機自啟動 systemctl enable nginx.service # 停止開機自啟動 systemctl disable nginx.service # 查看服務(wù)當前狀態(tài) systemctl status nginx.service # 重新啟動服務(wù) systemctl restart nginx.service # 查看所有已啟動的服務(wù) systemctl list-units --type=service
編輯Tengine操作腳本
vi /etc/rc.d/init.d/nginx #編輯啟動文件添加下面內(nèi)容
############################################################
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: NGINX is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
if [ -n "$user" ]; then
if [ -z "`grep $user /etc/passwd`" ]; then
useradd -M -s /bin/nologin $user
fi
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
fi
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
############################################################
配置權(quán)限及開機啟動
chmod 745 /etc/rc.d/init.d/nginx # 設(shè)置權(quán)限 chkconfig nginx on # 開機啟動
操作指令
# 開啟服務(wù) /etc/init.d/nginx start # 重啟服務(wù) /etc/init.d/nginx restart # 停止服務(wù) /etc/init.d/nginx stop # 查看服務(wù)狀態(tài) /etc/init.d/nginx status
到此這篇關(guān)于Aliyun Linux 編譯安裝 php7.3 tengine2.3.2 mysql8.0 redis5的文章就介紹到這了,更多相關(guān)Linux 編譯安裝 php7.3內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- 虛擬機linux安裝redis實現(xiàn)過程解析
- Linux安裝Redis實現(xiàn)過程及報錯解決方案
- Linux下redis5.0.5的安裝過程與配置方法
- 關(guān)于linux redis安裝及安裝遇到的問題
- Linux系統(tǒng)下安裝Redis數(shù)據(jù)庫過程
- Linux中Redis安裝部署的操作步驟
- Linux上安裝Redis詳細教程
- Linux服務(wù)器快速安裝Redis6.0步驟示例詳解
- Linux安裝redis后沒有redis-server的問題
- Linux(Centos7)安裝Mysql/Redis/MinIO方式
- Linux下安裝Redis 6.0.5的實現(xiàn)
相關(guān)文章
PHP版本升級到7.x后wordpress的一些修改及wordpress技巧
這篇文章主要介紹了PHP版本升級到7.x后wordpress的一些修改及wordpress技巧的相關(guān)資料,需要的朋友可以參考下2015-12-12
php+mysql實現(xiàn)簡單登錄注冊修改密碼網(wǎng)頁
這篇文章主要為大家詳細介紹了php+mysql實現(xiàn)簡單登錄注冊修改密碼系統(tǒng),具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-11-11

