简介
Tengine是由淘宝网发起的Web服务器项目,是一个Nginx优化升级版,继承Nginx-1.2.3 的所有特性,100%兼容Nginx的配置,同时又针对大量访问请求对Nginx进行了优化和修改,使Tengine能够更加高效和稳定地应付更大的访问量,这一点已经在天猫商城等得到了很好的检验。
传统环境,我们有LNMP即linux+nginx+mysql+php,由此延伸出LTMP即linux+tengine+mysql+php
我们可以单独在服务器上安装Tengine,也可以从nginx平滑升级到Tengine
LTMP环境安装
执行以下命令,可以一键安装Tengine服务器。
root@TengineRPM-Jimmyli:~# wget http://sourceforge.net/projects/tenginerpm/files/TengineRPM-LTMP-Jimmyli.sh
执行LTMP一键安装包shell脚本
root@TengineRPM-Jimmyli:~# sh TengineRPM-LTMP-Jimmyli.sh
安装会比较耗时
脚本内容:
#!/bin/bash
#install Centos5 and Centos6
grep -i "release 6" /etc/redhat-release
R6=$?
if [ $R6 == 1 ];then
# wget TengineRPM_LTMP_centos5_install.sh
#!/bin/bash
#Firewall
grep -i "dport 80 " /etc/sysconfig/iptables
if [ $? == 1 ]; then
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
fi
grep -i "dport 8080" /etc/sysconfig/iptables
if [ $? == 1 ]; then
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
fi
grep -i "dport 3306" /etc/sysconfig/iptables
if [ $? == 1 ]; then
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
fi
/etc/init.d/iptables save
service iptables restart
echo -e "#SELINUX=enforcing\n#SELINUXTYPE=targeted\nSELINUX=disabled\nSETLOCALDEFS=0" > /etc/selinux/config
#install
rpm -Uvh http://ftp.riken.jp/Linux/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
#
yum -y install gcc gcc-c++ make wget unzip autoconf
yum -y install pcre-devel zlib-devel mhash-devel openssl-devel libxml2-devel libxslt-devel gd-devel lua-devel geoip-devel glibc-devel
#install TengineRPM
if [ -s tengine-1.5.2-centos5.x86_64.rpm ]; then
echo "tengine-1.5.2-centos5.x86_64.rpm [found ok]"
else
echo "Error: tengine-1.5.2-centos5.x86_64.rpm not found!!!download now......"
wget -N -c http://sourceforge.net/projects/tenginerpm/files/tengine-1.5.2-centos5.x86_64.rpm
fi
rpm -ivh tengine-1.5.2-centos5.x86_64.rpm
#install TengineRPM
if [ -s ltmp.tgz ]; then
echo "ltmp.tgz [found ok]"
else
echo "Error: ltmp.tgz not found!!!download now......"
wget -N -c http://sourceforge.net/projects/tenginerpm/files/conf/ltmp.tgz
fi
tar -zxvf ltmp.tgz -C /
service tengine restart
echo "Jimmy Li 提醒你,Tengine安装脚本已结束"
#insatll mysql5.5
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
yum -y install mysql.`uname -i`
#升级mysql
yum -y install yum-plugin-replace
yum -y replace mysql --replace-with mysql55w
#安装mysql55
yum -y install mysql55w mysql55w-server
service mysqld start
mysqladmin -u root password "jimmyli"
chkconfig mysqld on
echo "Jimmy Li 提醒你,MySQL5.5安装脚本已结束"
#install php54w
#rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
yum --enablerepo=webtatic-el5 install -y php54w-cli php54w-common php54w-fpm php54w-gd php54w-mcrypt php54w-mysql php54w-soap php54w-xml php54w-mbstring php54w-pecl-memcache php54w-pdo php54w-odbc
service php-fpm start
#php.ini#session.auto_start = 1
mkdir -p /var/lib/php/session
chmod 777 /var/lib/php/session
chkconfig php-fpm on
#install LTMP
if [ -s tengineconf.tgz ]; then
echo "tengineconf.tgz [found ok]"
else
echo "Error: tengineconf.tgz not found!!!download now......"
wget -N -c http://sourceforge.net/projects/tenginerpm/files/conf/tengineconf.tgz
fi
tar -zxvf tengineconf.tgz -C /
#install phpMyAdmin
if [ -s phpMyAdmin-4.1.0-all-languages.zip ]; then
echo "phpMyAdmin-4.1.0-all-languages.zip [found ok]"
else
echo "Error: phpMyAdmin-4.1.0-all-languages.zip not found!!!download now......"
wget -N -c http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.0/phpMyAdmin-4.1.0-all-languages.zip
fi
unzip -o phpMyAdmin-4.1.0-all-languages.zip
if [ ! -d /home/www/phpMyAdmin ];then
mkdir -p /home/www/phpMyAdmin
fi
cp -rf phpMyAdmin-4.1.0-all-languages/* /home/www/phpMyAdmin
rm -rf ./phpMyAdmin-4.1.0-all-languages
echo "Jimmy Li 提醒你,LTMP安装脚本已结束"
rpm -qa | grep mysql
netstat -lntp
mysql -V
/usr/local/nginx/sbin/nginx -v
## info ##
echo -e " ********************************************************** "
echo -e " * TengineRPM Installer for Centos5 * "
echo -e " * Info Web:http://weibo.com/HHVM * "
echo -e " * Compiled by Jimmy Li * "
echo -e " * Blog URL http://jimmyli.blog.51cto.com * "
echo -e " * Website: http://sourceforge.net/p/tenginerpm * "
echo -e " ********************************************************** "
## END ##
echo "==========================================================================="
echo " * Jimmy Li 提醒你,LTMP安装已结束。"
echo " --------------------------------------------------------------------- "
echo " * LTMP一键安装程序"
echo " * 是由淘宝Web服务器Tengine、MySQL、PHP组合成服务器软件套件"
echo "==========================================================================="
else
# wget TengineRPM_LTMP_centos6_install.sh
#!/bin/bash
#Firewall
grep -i "dport 80 " /etc/sysconfig/iptables
if [ $? == 1 ]; then
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
fi
grep -i "dport 8080" /etc/sysconfig/iptables
if [ $? == 1 ]; then
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
fi
grep -i "dport 3306" /etc/sysconfig/iptables
if [ $? == 1 ]; then
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
fi
/etc/init.d/iptables save
service iptables restart
echo -e "#SELINUX=enforcing\n#SELINUXTYPE=targeted\nSELINUX=disabled\nSETLOCALDEFS=0" > /etc/selinux/config
yum -y install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
#wget http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
#rpm -ivh epel-release-6-8.noarch.rpm
yum -y install gcc gcc-c++ make wget unzip autoconf
yum -y install pcre-devel zlib-devel mhash-devel openssl-devel libxml2-devel libxslt-devel gd-devel lua-devel geoip-devel glibc-devel
#install TengineRPM
if [ -s tengine-1.5.2-centos6.x86_64.rpm ]; then
echo "tengine-1.5.2-centos6.x86_64.rpm [found ok]"
else
echo "Error: tengine-1.5.2-centos6.x86_64.rpm not found!!!download now......"
wget -N -c http://sourceforge.net/projects/tenginerpm/files/tengine-1.5.2-centos6.x86_64.rpm
fi
rpm -ivh tengine-1.5.2-centos6.x86_64.rpm
#install TengineRPM
if [ -s ltmp.tgz ]; then
echo "ltmp.tgz [found ok]"
else
echo "Error: ltmp.tgz not found!!!download now......"
wget -N -c http://sourceforge.net/projects/tenginerpm/files/conf/ltmp.tgz
fi
tar -zxvf ltmp.tgz -C /
service tengine restart
echo "Jimmy Li 提醒你,Tengine安装脚本已结束"
#insatll mysql5.5
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum -y install mysql.`uname -i`
#升级mysql
yum -y install yum-plugin-replace
yum -y replace mysql --replace-with mysql55w
#安装mysql55
yum -y install mysql55w mysql55w-server
service mysqld start
mysqladmin -u root password "jimmyli"
chkconfig mysqld on
echo "Jimmy Li 提醒你,MySQL5.5安装脚本已结束"
#install php54w
#rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum --enablerepo=webtatic install -y php54w-cli php54w-common php54w-fpm php54w-gd php54w-mcrypt php54w-mysql php54w-soap php54w-xml php54w-mbstring php54w-pecl-memcache php54w-pdo php54w-odbc
service php-fpm start
#php.ini#session.auto_start = 1
mkdir -p /var/lib/php/session
chmod 777 /var/lib/php/session
chkconfig php-fpm on
#install LTMP
if [ -s tengineconf.tgz ]; then
echo "tengineconf.tgz [found ok]"
else
echo "Error: tengineconf.tgz not found!!!download now......"
wget -N -c http://sourceforge.net/projects/tenginerpm/files/conf/tengineconf.tgz
fi
tar -zxvf tengineconf.tgz -C /
#install phpMyAdmin
if [ -s phpMyAdmin-4.1.0-all-languages.zip ]; then
echo "phpMyAdmin-4.1.0-all-languages.zip [found ok]"
else
echo "Error: phpMyAdmin-4.1.0-all-languages.zip not found!!!download now......"
wget -N -c http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.0/phpMyAdmin-4.1.0-all-languages.zip
fi
unzip -o phpMyAdmin-4.1.0-all-languages.zip
if [ ! -d /home/www/phpMyAdmin ];then
mkdir -p /home/www/phpMyAdmin
fi
cp -rf phpMyAdmin-4.1.0-all-languages/* /home/www/phpMyAdmin
rm -rf ./phpMyAdmin-4.1.0-all-languages
echo "Jimmy Li 提醒你,LTMP安装脚本已结束"
rpm -qa | grep mysql
netstat -lntp
mysql -V
/usr/local/nginx/sbin/nginx -v
## info ##
echo -e " ********************************************************** "
echo -e " * TengineRPM Installer for Centos6 * "
echo -e " * Info Web:http://weibo.com/HHVM * "
echo -e " * Compiled by Jimmy Li * "
echo -e " * Blog URL http://jimmyli.blog.51cto.com * "
echo -e " * Website: http://sourceforge.net/p/tenginerpm * "
echo -e " ********************************************************** "
## END ##
echo "==========================================================================="
echo " * Jimmy Li 提醒你,LTMP安装已结束。"
echo " --------------------------------------------------------------------- "
echo " * LTMP一键安装程序"
echo " * 是由淘宝Web服务器Tengine、MySQL、PHP组合成服务器软件套件"
echo "==========================================================================="
fi
管理命令
Tengine状态管理 service tengine {start|stop|restart|reload|status|help}
PHP5-FPM状态管理 service php-fpm {start|stop|status|restart|reload|force-reload|condrestart|try-restart}
MySQL5.5状态管理 service mysqld {start|stop|status|restart|condrestart|try-restart|reload|force-reload}
Tengine单独安装
下载解压,编译,安装,跟nginx安装类似
./configure
make && make install
下载地址: http://tengine.taobao.org/download.html
启动,欢迎默认80端口的欢迎页
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程