Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ CentOS7 compile and install Tengine + PHP + MariaDB notes     - MySQL optimization resulting order by using filesort (Database)

- CentOS 6.6 x64 Oracle Database 11gR2 RAC automated installation scripts (Database)

- Simple and fast sorting (Programming)

- Redhat 5 prohibit IPv6 (Linux)

- The YUM package management under Linux (Linux)

- CentOS cross compiler core Raspberry Pi 2 (Linux)

- Android custom controls create the simplest skid menu in the history (Programming)

- Sudo and Root Account in Ubuntu related (Linux)

- Java reflection by calling the class method (Programming)

- 3 ways to create a lightweight, durable system of Ubuntu Linux USB disk (Linux)

- CentOS source installation GitLab Chinese Version (Server)

- Ubuntu 14.04 LTS to compile the source code Android4.4.2 (Linux)

- OpenSUSE GPG Comments (Linux)

- How to set the default Fedora from the command line (Linux)

- Ubuntu users to install Xtreme Download Manager (Linux)

- How to avoid two Chrome icon appears in ELementary OS Freya (Linux)

- Linux IO redirection (Linux)

- By creating a personal technology blog Detailed GitHub (Linux)

- Ubuntu download install and configure Plank Dock (Linux)

- Processor in protected mode of protection (Linux)

 
         
  CentOS7 compile and install Tengine + PHP + MariaDB notes
     
  Add Date : 2017-08-31      
         
       
         
  Environment is CentOS 7 64bit, Updated 9 July 2014.512M virtual machine memory.
To update the system:

[Root @ abctest ~] # yum update -y
Install the necessary software:

[Root @ abctest ~] # yum install gcc automake autoconf libtool make gcc-c ++ zlib-devel openssl-devel vim which bzip2 -y
Compile and install pcre:

[Root @ abctest ~] # cd / usr / local / src /
[Root @ abctest src] # wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
[Root @ abctest src] # tar zvxf pcre-8.35.tar.gz
[Root @ abctest src] # cd pcre-8.35
[Root @ abctest pcre-8.35] #. / Configure
[Root @ abctest pcre-8.35] # make && make install
Compile and install openssl:

[Root @ abctest pcre-8.35] # cd / usr / local / src /
[Root @ abctest src] # wget http://www.openssl.org/source/openssl-1.0.1h.tar.gz
[Root @ abctest src] # tar zvxf openssl-1.0.1h.tar.gz
[Root @ abctest src] # cd openssl-1.0.1h
[Root @ abctest openssl-1.0.1h] #. / Config
[Root @ abctest openssl-1.0.1h] # make && make install
Compile and install zlib

[Root @ abctest openssl-1.0.1h] # cd / usr / local / src /
[Root @ abctest src] # wget http://zlib.net/zlib-1.2.8.tar.gz
[Root @ abctest src] # tar zvxf zlib-1.2.8.tar.gz
[Root @ abctest src] # cd zlib-1.2.8
[Root @ abctest zlib-1.2.8] #. / Configure
[Root @ abctest zlib-1.2.8] # make && make install
Compile and install jemalloc:

[Root @ abctest zlib-1.2.8] # cd / usr / local / src /
[Root @ abctest src] # wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2
[Root @ abctest src] # tar jxvf jemalloc-3.6.0.tar.bz2
[Root @ abctest src] # cd jemalloc-3.6.0
[Root @ abctest jemalloc-3.6.0] #. / Configure
[Root @ abctest jemalloc-3.6.0] # make && make install
[Root @ abctest jemalloc-3.6.0] # echo '/usr/local/lib'>/etc/ld.so.conf.d/local.conf
[Root @ abctest jemalloc-3.6.0] # ldconfig
Www establish user groups and users, prohibit www login shell:
[Root @ abctest jemalloc-3.6.0] # groupadd www
[Root @ abctest jemalloc-3.6.0] # useradd -g www www
[Root @ abctest jemalloc-3.6.0] # usermod -s / sbin / nologin www
Create a virtual host directory, and given the appropriate permissions:

[Root @ abctest jemalloc-3.6.0] # mkdir -p /usr/www/example.com/{public_html,logs}
[Root @ abctest jemalloc-3.6.0] # chmod -R + w / usr / www /
[Root @ abctest jemalloc-3.6.0] # chown -R www: www / usr / www /
Compile and install Tengine:

[Root @ abctest jemalloc-3.6.0] # cd / usr / local / src /
[Root @ abctest src] # wget http://tengine.taobao.org/download/tengine-2.0.3.tar.gz
[Root @ abctest src] # tar zvxf tengine-2.0.3.tar.gz
[Root @ abctest src] # cd tengine-2.0.3
[Root @ abctest tengine-2.0.3] #. / Configure --prefix = / usr / local / 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
[Root @ abctest tengine-2.0.3] # make && make install
Modify nginx.conf file:

[Root @ abctest tengine-2.0.3] # mkdir / usr / local / nginx / conf / domains
[Root @ abctest tengine-2.0.3] # vim /usr/local/nginx/conf/nginx.conf
modify

#user nobody;
worker_processes 1;
#error_log logs / error.log;
#error_log logs / error.log notice;
#error_log logs / error.log info;
#pid logs / nginx.pid;
events {
worker_connections 1024;
}
for

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

http {
include mime.types;
default_type application / octet-stream;
for

http {
include mime.types;
. Include domains / * conf;
default_type application / octet-stream;
: Wq Save
Test Nginx:

[Root @ abctest tengine-2.0.3] # cd / usr / local / nginx
[Root @ abctest nginx] # ldconfig
[Root @ abctest nginx] #. / Sbin / nginx -t
Export

the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
The test is successful
Add Nginx to start automatically at boot:

[Root @ abctest nginx] # vim /usr/lib/systemd/system/nginx.service
Join
[

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
ExecReload = / bin / kill -s HUP $ MAINPID
ExecStop = / bin / kill -s QUIT $ MAINPID
PrivateTmp = true
[Install]
WantedBy = multi-user.target
: Wq Save

[Root @ abctest nginx] # systemctl enable nginx
Close the default firewall:

[Root @ abctest nginx] # systemctl stop firewalld.service
[Root @ abctest nginx] # systemctl disable firewalld.service
Install iptables and open port 80

[Root @ abctest nginx] # yum install iptables-services -y
[Root @ abctest nginx] # vim / etc / sysconfig / iptables
increase

-A INPUT -p tcp -m state --state NEW -m tcp --dport 80-j ACCEPT
Because this VPS SSH port 60000, modify

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22-j ACCEPT
for

-A INPUT -p tcp -m state --state NEW -m tcp --dport 60000-j ACCEPT
: Wq Save
Restart iptables and set at startup:

[Root @ abctest nginx] # systemctl restart iptables.service
[Root @ abctest nginx] # systemctl enable iptables.service
Install MariaDB:

[Root @ abctest nginx] # cd /etc/yum.repos.d/
[Root @ abctest yum.repos.d] # vim MariaDB.repo
enter

# MariaDB 10.0 CentOS repository list - created 2014-09-30 09:33 UTC
# Http://mariadb.org/mariadb/repositories/
[Mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey = https: //yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck = 1
: Wq Save

[Root @ abctest yum.repos.d] # yum install MariaDB-server MariaDB-client -y
Error, there is a conflict package, deleted

[Root @ abctest yum.repos.d] # rpm -ev net-snmp-1: 5.7.2-18.el7.x86_64
[Root @ abctest yum.repos.d] # rpm -ev mariadb-libs-1: 5.5.37-1.el7_0.x86_64
Install

[Root @ abctest yum.repos.d] # yum install MariaDB-server MariaDB-client -y
success
MariaDB start the service and add at startup:

[Root @ abctest yum.repos.d] # service start mysql
[Root @ abctest yum.repos.d] # chkconfig mysql on
Install the necessary applications to compile PHP:

[Root @ abctest yum.repos.d] # yum install -y gcc gcc-c ++ autoconf libjpeg libjpeg-devel libpng
libpng-devel freetype freetype-devel libpng libpng-devel
libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel
glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel
gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel
gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel file
Compile and install libmcrypt:

[Root @ abctest yum.repos.d] # cd / usr / local / src /
[Root @ abctest src] # wget https://vps.googlecode.com/files/libmcrypt-2.5.8.tar.gz
[Root @ abctest src] # tar zxvf libmcrypt-2.5.8.tar.gz
[Root @ abctest src] # cd libmcrypt-2.5.8
[Root @ abctest libmcrypt-2.5.8] #. / Configure
[Root @ abctest libmcrypt-2.5.8] # make && make install
Compile and install PHP:

[Root @ abctest libmcrypt-2.5.8] # cd / usr / local / src /
[Root @ abctest src] # wget http://cn2.php.net/distributions/php-5.6.0.tar.gz
[Root @ abctest src] # tar zxvf php-5.6.0.tar.gz
[Root @ abctest src] # cd php-5.6.0
[Root @ abctest php-5.6.0] #. / Configure --prefix = / usr / local / php-5.6.0
--with-mysql --with-mysql-sock
--with-mysqli --enable-fpm --enable-soap
--with-libxml-dir --with-openssl --with-mcrypt
--with-mhash --with-pcre-regex --with-sqlite3
--with-zlib --enable-bcmath
--with-iconv --with-bz2 --enable-calendar
--with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter
--with-pcre-dir --enable-ftp --with-gd --with-openssl-dir
--with-jpeg-dir --with-png-dir --with-zlib-dir
--with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv
--with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring
--disable-mbregex --disable-mbregex-backtrack --with-libmbfl
--with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir
--with-pdo-sqlite --with-readline --enable-session --enable-shmop
--enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem
--enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip
--enable-mysqlnd-compression-support --with-pear --disable-fileinfo
Because only 512M of memory so the addition --disable-fileinfo, otherwise the compilation error

[Root @ abctest php-5.6.0] # make && make install
Copy the configuration file:

[Root @ abctest php-5.6.0] # cp /usr/local/php-5.6.0/etc/php-fpm.conf.default/usr/local/php-5.6.0/etc/php-fpm.conf
[Root @ abctest php-5.6.0] # cp /usr/local/src/php-5.6.0/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[Root @ abctest php-5.6.0] # cp /usr/local/src/php-5.6.0/php.ini-production /usr/local/php-5.6.0/lib/php.ini
Modify the configuration file:

[Root @ abctest php-5.6.0] # vim /usr/local/php-5.6.0/etc/php-fpm.conf
These values find modifications

pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
Remove

; Pm.max_requests = 500
Comment and
: Wq Save
Setting php-fpm at startup

[Root @ abctest php-5.6.0] # chmod a + x /etc/init.d/php-fpm
[Root @ abctest php-5.6.0] # chkconfig php-fpm on
The PHP environment variable added to the bin directory:

[Root @ abctest php-5.6.0] # chmod + x / etc / profile
[Root @ abctest php-5.6.0] # vim /etc/profile.d/php.sh
Join

PATH = $ PATH: /usr/local/php5.6.0/bin
export PATH
: Wq Save

[Root @ abctest php-5.6.0] # chmod + x /etc/profile.d/php.sh
[Root @ abctest php-5.6.0] # source / etc / profile
[Root @ abctest php-5.6.0] # ln -s /usr/local/php-5.6.0/sbin/php-fpm / bin / php-fpm
Create a site profile:

[Root @ abctest php-5.6.0] # vim /usr/local/nginx/conf/domains/example.com.conf
enter

server {
server_name example.com;
listen 80;
root /usr/www/example.com/public_html;
access_log /usr/www/example.com/logs/access.log;
error_log /usr/www/example.com/logs/error.log;
index index.php;
location / {
try_files $ uri $ uri // index.php q = $ uri & $ args?;
}
location ~ * \. (jpg | jpeg | gif | css | png | js | ico | html) $ {
access_log off;
expires max;
}
location ~ / \. ht {
deny all;
}
location ~ \ .php $ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
include / usr / local / nginx / conf / fastcgi_params;
}
}
: Wq Save
Restart VPS:

[Root @ abctest php-5.6.0] # reboot
     
         
       
         
  More:      
 
- Linux RPM default installation path (Linux)
- How to migrate MySQL to MariaDB under linux (Database)
- To install MySQL 5.6 binary packages under CentOS 6.4 64bit (Database)
- MySQL database to open a remote connection method (Database)
- Windows 7 hard disk to install Ubuntu 14.10 (Linux)
- Android start automatically and add and delete a desktop shortcut (Programming)
- Atheros AR8161 / AR8162 network card driver problem solving in CentOS 6.4 (Linux)
- Linux System Getting Started Learning: Disable HTTP forwarding wget in (Linux)
- Oracle table space is too large processing time (Database)
- Oracle delete table space prompted ORA-00604 and ORA-38301 (Database)
- Intel Graphics Installer 1.0.3 released, support for Ubuntu (Linux)
- Installation salt-minion on RHEL5 (Linux)
- BGP routers want to play it by CentOS (Linux)
- Storm basic framework for analysis (Programming)
- Ubuntu Eclipse configuration Gtk + 2.0 libraries (Linux)
- Configuration OpenOCD + FT2232 under Ubuntu (Linux)
- Oracle conditional select statements and looping statements (Database)
- Optimized to minimize the installation of CentOS 5.8 (Linux)
- Understanding the type in C ++ bitset (Programming)
- Cryptography development environment to build under Ubuntu (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.