CentOS Build Lnmp+lamp Environment + (JDK+TOMCAT+MYSQL)

Source: Internet
Author: User
Tags fpm install php mcrypt openssl

CentOS Build Lnmp+lamp Environment + (JDK+TOMCAT+MYSQL)

The first part LNMP environment construction

First, compile and install nginx1.10.3

1. Preparation

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

CentOS Linux release 7.3.1611 (Core)

[Email protected] ~]# uname-a

Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 16:42:41 UTC x86_64 x86_64 x86_64 gnu/linux

[Email protected] ~]# uname-r

3.10.0-514.el7.x86_64

[Email protected] ~]# uname-mx86_64

[Email protected] ~]# Groupadd Nginx

[Email protected] ~]# useradd nginx-s/sbin/nologin-g nginx-m

[Email protected] ~]# mkdir-p/home/qiu/tools

[Email protected] ~]# mkdir/application

[Email protected] ~]# yum-y install pcre pcre-devel OpenSSL openssl-devel

[Email protected] ~]# Rpm-qa install pcre pcre-devel OpenSSL openssl-devel

2, download, decompression Nginx

[Email protected] ~]# cd/home/qiu/tools[[email protected] tools]# wget [[email protected] tools]# Tar XF nginx-1.10.3.t Ar.gz[[email protected] tools]# CD nginx-1.10.3/

3. Installing Nginx

[Email protected] nginx-1.10.3]#/configure--help

[Email protected] nginx-1.10.3]#/configure--prefix=/application/nginx-1.10.3--user=nginx--group=nginx-- With-http_stub_status_module--with-http_ssl_module

[[email protected] nginx-1.10.3]# echo $?

0

[[email protected] nginx-1.10.3]# make

[[email protected] nginx-1.10.3]# echo $?

0

[[email protected] nginx-1.10.3]# make install

[[email protected] nginx-1.10.3]# echo $?

0

[Email protected] nginx-1.10.3]# history

[Email protected] nginx-1.10.3]# ln-s/application/nginx-1.10.3//application/nginx

4. Open Nginx

[Email protected] nginx-1.10.3]#/application/nginx/sbin/nginx-t

[Email protected] nginx-1.10.3]#/application/nginx/sbin/nginx

[Email protected] nginx-1.10.3]# Netstat-luntp|grep 80

TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 8048/nginx:master [[email protected] Ngi nx-1.10.3]# lsof-i:80

COMMAND PID USER FD TYPE DEVICE size/off NODE namenginx 8048 root 6u IPv4 56025 0t0 TCP *:http (LISTEN ) Nginx 8049 nginx 6u IPv4 56025 0t0 TCP *:http (LISTEN)

[Email protected] nginx-1.10.3]# Systemctl stop Firewalld.service

[Email protected] nginx-1.10.3]# Setenforce o

5. Testing



Second, install MySQL (binary method)

1. Preparation

[[email protected] tools]# Groupadd MySQL

[Email protected] tools]# useradd mysql-s/sbin/nologin-g mysql-m

[[email protected] tools]# ID mysqluid=1002 (mysql) gid=1002 (MySQL) groups=1002 (MySQL)

2, download, verification, decompression

[Email protected] ~]# cd/home/qiu/tools/

[Email protected] tools]# wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.57-linux-glibc2.12-x86_64.tar.gz

[Email protected] tools]# Tar XF mysql-5.5.57-linux-glibc2.12-x86_64.tar.gz

[Email protected] tools]# lsmysql-5.5.57-linux-glibc2.12-x86_64 mysql-5.5.57-linux-glibc2.12-x86_64.tar.gz nginx-1.10.3 nginx-1.10.3.tar.gz

[Email protected] tools]# MV mysql-5.5.57-linux-glibc2.12-x86_64/application/mysql-5.5.57-linux-glibc2.12-x86_64

[Email protected] tools]# cd/application/

[Email protected] application]# lsmysql-5.5.57-linux-glibc2.12-x86_64 nginx nginx-1.10.3

[[email protected] application]# ln-s mysql-5.5.57-linux-glibc2.12-x86_64 MySQL

3. Installation

[Email protected] tools]# Cd/application/mysql

[Email protected] mysql]# chown-r mysql.mysql/application/mysql
[Email protected] tools]#/mysql_install_db--user=mysql--basedir=/application/mysql--datadir=/application/mysql /DATACP Mysql.server/etc/init.d/mysqld
[[email protected] tools] #chown-R mysql.mysql/application/mysql/
[Email protected] tools]# echo "Export path=/application/mysql/bin: $PATH" >>/etc/profile
[Email protected] tools]# Source/etc/profile
[Email protected] tools]# sed-i ' s#/usr/local/mysql#/applicaton/mysql#g '/etc/init.d/mysqld/application/mysql/bin/ Mysqld_safe
[[email protected] tools]#/etc/init.d/mysqld start

4. Testing

[Email protected] support-files]# Ps-ef|grep 3306

MySQL 11600 11364 0 02:58 pts/0 00:00:02/application/mysql/bin/mysqld--basedir=/application/mysql--datadir=/ap Plication/mysql/data--plugin-dir=/application/mysql/lib/plugin--user=mysql--log-error= Localhost.localdomain.err--pid-file=/application/mysql/data/localhost.localdomain.pid--socket=/tmp/mysql.sock- -port=3306root 15899 2659 0 04:24 pts/0 00:00:00 grep--color=auto 3306

[Email protected] support-files]# lsof-i:80

COMMAND PID USER FD TYPE DEVICE size/off NODE namenginx 8048 root 6u IPv4 56025 0t0 TCP *:http (LISTEN ) Nginx 8049 nginx 6u IPv4 56025 0t0 TCP *:http (LISTEN)

[Email protected] support-files]# Netstat-luntp|grep mysqltcp

0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 11600/mysqld

[Email protected] support-files]# Mysqlwelcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 4Server version:5.5.57 mysql Community Server (GPL) Copyright (c), Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql>

Third, fastcgi way to install PHP

1. Preparation

[Email protected] support-files]# cat/etc/redhat-release CentOS Linux release 7.3.1611 (Core) [[Email protected] Support -files]# uname-alinux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 16:42:41 UTC x86_64 x86_64 x86_6 4 Gnu/linux

[Email protected] support-files]# uname-r

3.10.0-514.el7.x86_64

[Email protected] support-files]# uname-m

x86_64

[Email protected] support-files]# rpm-qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel Libxslt-devel

[Email protected] support-files]# yum-y install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxsl T-devel

[Email protected] support-files]# rpm-qa freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel Libxslt-devel

[Email protected] support-files]# rpm-qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel

[Email protected] support-files]# yum-y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel Libiconv-devel

[Email protected] support-files]# rpm-qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel
Install Biconv library [[email protected] support-files]# cd/home/qiu/tools/

[Email protected] tools]# wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz

[Email protected] tools]# tar zvxf libiconv-1.15.tar.gz

[Email protected] tools]# CD libiconv-1.15/

[Email protected] tlibiconv-1.15]#/configure--prefix=/usr/local/libiconv

[[email protected] tlibiconv-1.15]# Make[[email protected] libiconv-1.15]# make Install[[email protected] libiconv-1.15 ]# Wget-o/etc/yum.repos.d/epel.repo Http://mirrors.aliyun.com/repo/epel-7.repo

[Email protected] libiconv-1.15]# yum-y install Libmcrypt-devel

[[email protected] libiconv-1.15]# yum-y install mhash[[email protected] libiconv-1.15]# yum-y install MCrypt



2. Download

[Email protected]/]# cd/home/qiu/tools/

[Email protected] tools]# wget http://mirrors.sohu.com/php/php-5.5.32.tar.gz

[Email protected] tools]# tar zxf php-5.5.32.tar.gz [[email protected] tools]# CD php-5.5.32



3. Installation

./configure \

--prefix=/application/php-5.5.32 \

--with-mysql=/application/mysql \

--WITH-PDO-MYSQL=MYSQLND \

--with-iconv-dir=/usr/local/libiconv \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--WITH-LIBXML-DIR=/USR \

--enable-xml \

--disable-rpath \

--enable-safe-mode \

--enable-bcmath \

--ENABLE-SHMOP \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--enable-mbregex \

--ENABLE-FPM \

--enable-mbstring \

--with-mcrypt \

--WITH-GD \

--ENABLE-GD-NATIVE-TTF \

--WITH-OPENSSL \

--with-mhash \

--ENABLE-PCNTL \

--enable-sockets \

--WITH-XMLRPC \

--enable-zip \

--ENABLE-SOAP \

--enable-short-tags \

--enable-static \

--with-xsl \

--ENABLE-FTP \

--with-fpm-user=nginx \

--with-fpm-group=nginx \

--enable-opcache=yes


Make

Make install

[Email protected] php]# cd/home/qiu/tools/php-5.5.32/

[email protected] php-5.5.32]# CP Php.ini-production/application/php/lib/php.ini

[Email protected] php-5.5.32]# cd/application/php/etc/

[email protected] etc]# CP Php-fpm.conf.default php-fpm.conf



4. Testing

[Email protected] etc]#/APPLICATION/PHP/SBIN/PHP-FPM

[Email protected] etc]# Ps-rf|grep PHP-FPM

[Email protected] etc]# Ps-ef|grep PHP-FPM

Root 44740 1 0 08:46?        00:00:00 Php-fpm:master Process (/application/php-5.5.32/etc/php-fpm.conf) Nginx 44741 44740 0 08:46?        00:00:00 php-fpm:pool Wwwnginx 44742 44740 0 08:46? 00:00:00 php-fpm:pool wwwroot 44747 2659 0 08:46 pts/0 00:00:00 grep--color=auto php-fpm

[Email protected] etc]# lsof-i:9000

COMMAND PID USER FD TYPE DEVICE size/off NODE namephp-fpm 44740 root 7u IPv4 251732 0t0 TCP Localhost:cs    Listener (LISTEN) php-fpm 44741 nginx 0u IPv4 251732 0t0 TCP localhost:cslistener (LISTEN) php-fpm 44742 nginx        0u IPv4 251732 0t0 TCP localhost:cslistener (LISTEN) [[email protected] etc]# Netstat-luntp|grep php-fpmtcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 44740/php-fpm:mast



The second part of lamp environment construction






Part III TOMCAT+JDK+MYSQL Environment construction


This article from "Doublelinux" blog, declined reprint!

CentOS Build Lnmp+lamp Environment + (JDK+TOMCAT+MYSQL)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.