编译安装 Centos 7 x64 + tengine.2.0.3 (实测+笔记)

环境:

系统硬件:vmware vsphere (CPU:2*4核,内存2G)

系统版本:CentOS Linux release 7.0.1406

安装步骤:

1.系统环境

1.1 更新系统

[[email protected] ~]# yum update -y

 

1.2 查看环境

[[email protected] ~]# cat /etc/redhat-release

CentOS Linux release 7.0.1406 (Core)

[[email protected] ~]# uname -a

Linux tengine 3.10.0-123.4.2.el7.x86_64 #1 SMP Mon Jun 30 16:09:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

2.安装tengine

2.1.准备安装

[[email protected] ~]# cd /usr/local/src/

下载 pcre-8.35.tar.gz到/usr/local/src

[[email protected] ~]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz

下载zlib-1.2.8.tar.gz到/usr/local/src

[[email protected] ~]# wget http://zlib.net/zlib-1.2.8.tar.gz

下载 openssl-1.0.1h.tar.gz到/usr/local/src

[[email protected] ~]# wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz

下载jemalloc-3.6.0.tar.bz2到/usr/local/src

[[email protected] ~]#  wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2

下载 tengine-2.0.3.tar.gz到/usr/local/src

[[email protected] ~]# wget http://tengine.taobao.org/download/tengine-2.0.3.tar.gz

  

2.2 更新包

[[email protected] ~]# yum install zlib-devel openssl-devel -y

2.3 安装Pcre

[[email protected] ~]# cd /usr/local/src/

[[email protected] ~]# tar zvxf pcre-8.35.tar.gz

[[email protected] ~]# cd pcre-8.35

[[email protected] ~]# ./configure

[[email protected] ~]# make && make install

2.4 安装openssl

[[email protected] ~]# cd /usr/local/src/

[[email protected] ~]# tar zvxf openssl-1.0.1h.tar.gz

[[email protected] ~]# cd openssl-1.0.1h

[[email protected] ~]# ./config

[[email protected] ~]# make && make install

2.5 安装zlib

[[email protected] ~]# cd /usr/local/src/

[[email protected] ~]# tar zlib-1.2.8.tar.gz

[[email protected] ~]# cd zlib-1.2.8

[[email protected] ~]# ./configure

[[email protected] ~]# make && make install

2.6 安装jemalloc

[[email protected] ~]# cd /usr/local/src/

[[email protected] ~]# tar zvxf jemalloc-3.6.0

[[email protected] ~]# cd jemalloc-3.6.0

[[email protected] ~]# ./configure

[[email protected] ~]# make && make install

[[email protected] ~]# echo ‘/usr/local/lib‘ > /etc/ld.so.conf.d/local.conf

[[email protected] ~]# ldconfig

4.4 创建www用户和组,创建www虚拟主机使用的目录,以及Nginx使用的日志目录,并且赋予他们适当的权限

[[email protected] ~]# groupadd www

[[email protected] ~]# useradd -g www www

[[email protected] ~]# mkdir -p /data/www

[[email protected] ~]# chmod +w /data/www

[[email protected] ~]# chown -R www:www /data/www

4.5 安装tengine

[[email protected] ~]# cd /usr/local/src/

[[email protected] ~]# tar zvxf tengine-2.0.3.tar.gz

伪装服务器信息(可以不修改)

[[email protected] ~]# cd nginx-1.6.0/src/core

[[email protected] ~]# vim ./src/core/nginx.h

修改NGINX_VERSION为你希望显示的版号

修改NGINX_VER为你希望显示的名称

修改NGINX_VAR 为你希望显示的名称

保存

  

开始安装NGINX

./configure --prefix=/opt/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35 --with-jemalloc

[[email protected] ~]# make && make install

4.6 修改 nginx.conf

[[email protected] ~]# vim /opt/nginx/conf/nginx.conf

修改前面几行为:

user www www;
worker_processes 4;
error_log logs/error.log crit;
pid logs/nginx.pid;
events{
  use epoll;
  worker_connections 65535;
}

4.7 测试和运行

[[email protected] ~]# cd /opt/nginx

[[email protected] ~]# ldconfig

[[email protected] ~]# ./sbin/nginx -t

如果显示下面信息,即表示配置没问题

nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful

输入代码运行nginx服务

[[email protected] ~]# ./sbin/nginx 

[[email protected] ~]# ps au|grep nginx

如果显以类似下面的信息,即表示nginx已经启动

root 2013 0.0 0.0 103156 856 pts/0 S+ 03:22 0:00 grep nginx

  

输入代码检测是否支持加速

查看是否生效

[[email protected] ~]# lsof -n | grep jemalloc

ginx 2346 root mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2347 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2348 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2349 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1
nginx 2350 www mem REG 253,1 1824470 51571788 /usr/local/lib/libjemalloc.so.1

[[email protected] ~]# curl http://localhost

4.8 打开防火墙80端口

#停止firewall

[[email protected] ~]# systemctl stop firewalld.service

#禁止firewall开机启动

[[email protected] ~]# systemctl disable firewalld.service

安装 iptables

[[email protected] ~]# yum install iptables-services

设置防火墙规则 (增加80端口)

[[email protected] ~]# vim /etc/sysconfig/iptables

打开文件,增加80端口那一行

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

:wq #保存退出

#重启防火墙使配置生效

[[email protected] ~]# systemctl restart iptables.service

#设置防火墙开机启动

[[email protected] ~]# systemctl enable iptables.service

4.9 作为服务,开机后启动

[[email protected] ~]# vim /usr/lib/systemd/system/tengine.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=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

:wq 保存退出

[[email protected] ~]# systemctl stop tengine

[[email protected] ~]# systemctl start tengine

[[email protected] ~]# systemctl reload tengine

[[email protected] ~]# systemctl enable tengine

[[email protected] ~]# shutdown -r now

编译安装 Centos 7 x64 + tengine.2.0.3 (实测+笔记),布布扣,bubuko.com

时间: 2025-01-02 11:22:56

编译安装 Centos 7 x64 + tengine.2.0.3 (实测+笔记)的相关文章

Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.0 + Mariadb 10.1.9 + Nginx 1.9.9 + PHP 7.0.0)

环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1503-01.iso 安装步骤: 1.准备 1.1 设置静态IP.DNS地址(网络设备名称有可能不一样,这里是eno16780032,如使用DHCP获取动态IP,可忽略) [[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16780032 找到BOOTPROTO,并且修

CentOS安装Git服务器 Centos 7.0 + Git 2.2.0 + gitosis (实测 笔记)

环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 服务器IP:192.168.1.31 域名:www.domain.com SSH端口:8200(默认为22) 安装步骤: 1.显示服务器版本[[email protected] ~]# cat /etc/redhat-release#CentOS Linux release 7.0.1406 (Core) [[email protecte

16、编译安装bind 9.10.6及queryperf性能测试 学习笔记

1.安装开发环境 [[email protected] ~]# yum -y groupinstall "Server Platform Development" "Development tools" 2.编译安装bind [[email protected] ~]# tar xf bind-9.10.6.tar.gz [[email protected] ~]# cd bind-9.10.6 [[email protected] bind-9.10.6]# ./

CentOS 6源码编译安装 PHP 7.0.5

环境介绍: 系统版本:RHEL 6 软件仓库:yum-Base,yum-Epel PHP版本:PHP 7.0.5 安装方式:源码编译 删除原有yum安装版本php # yum remove php -y # yum remove php-* -y 2.安装开发包和依赖环境 # yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel

centos编译安装php7

环境说明 VMware 12 中搭建的CentOS 7 x64 4核 2G内存 环境中已经安装了http://blog.csdn.net/u014595668/article/details/50166277 中编译安装的MySQL5.7.9 工具下载 编译环境:libmcrypt2.5.7下载.mhash-0.9.9.9下载.mcrypt-2.6.8下载 PHP安装包:php 7下载 用xftp把所有的工具上传到/root/目录中 创建php用户和用户组 首先创建一个名为php且没有登录权限的

CentOS 6系统的 lamp (编译安装,模块或php-fpm)详解

   LAMP 是指一组通常一起使用来运行动态网站或者服务器的 自由软件 名称首字母缩写: 1.Linux:操作系统: 2.Apache:网页服务器: 3. MariaDB或MySQL,数据库管理系统(或者数据库服务器): 4.PHP.Perl或Python,脚本语言:  实验要求: (1) 三者分离于两台或三台主机: (2) 一个虚拟主机用于提供phpMyAdmin:另一个虚拟主机用于提供wordpress: (3) xcache (4) 尝试mpm为非prefork机制:    IP   系

源码编译安装vsftpd3.0.2

首先,是下载vsftpd-3.0.2.tar.gz这个源码包,由于网上提供的下载地址需要翻墙,所以,再次提供一个下载包. 源地址  https://security.appspot.com/downloads/vsftpd-3.0.2.tar.gz 360云盘 http://yunpan.cn/cHf5pXNceyuiR  访问密码 d65a 具体步骤: 1.卸载之前已经yum装的vsftpd yum remove vsftpd 2.创建ftp目录和用户 mkdir /alidata/www/

Ubuntu14.0上编译安装Hadoop

Ubuntu14.0上编译安装Hadoop 环境: hadoop-2.5.0.tar hadoop-2.5.0-src.tar jdk-7u71-linux-x64 protobuf-2.5.0.tar Maven3.0 安装步骤: 1 安装jdk ,配置环境变量 2 安装依赖包 3 安装maven 4安装protobuf-2.5.0.tar 5 编译Hadoop 6 安装hadoop 6.1 单机模式 6.2 伪分布模式 6.3 集群模式 1 安装jdk ,配置环境变量 下载jdk版本:jdk

CentOS 7 三者分离编译安装LAMP

架构: httpd 2.4.9 + mysql-5.5.3 + php-5.4.26 一:编译安装httpd 2.4.9 解决依赖关系     httpd-2.4.9需要较新的版本的apr和apr-util,因此需要事先对其进行升级.升级方式有两种:一种是通过源码编译安装,一种是直接升级rpm包.这里选择使用编译安装     它的作用是为了简化跨平台,应用程序之间的管理,例如php-fpm.mysql (1)编译安装apr # tar xf apr-1.5.0.tar.bz2# cd apr-1