LNMP Installation---Source installation mysql5.6--nginx--php--memached

Source: Internet
Author: User
Tags fpm mcrypt memcached openssl


LNMP---"Source package nginx mysql5.6 PHP

1. Install MySQL

#先解开mysql5.6 Source Package

#tar-ZXF mysql-5.6.25.tar.gz
#cd mysql-5.6.25/
#useradd MySQL
#yum-y Install cmake gcc
#yum Install gcc-c++
# yum-y Install Ncurses-devel
#cmake-dcmake_install_prefix=/usr/local/mysql-dsysconfdir=/etc-dmysql_datadir=/usr/local/mysql/data-dmysql_tcp _port=3306-dmysql_user=mysql-dextra_charsets=all
#make &&make Install
#cd/usr/local/mysql/
#./scripts/mysql_install_db--datadir=/usr/local/mysql/data/--user=mysql (Initialize database)
#ls/usr/local/mysql/data/
#ls-L/usr/local/mysql/data/mysql


To copy the Master profile startup script:
#ls support-files/
#cp support-files/my-default.cnf/etc/my.cnf

#cp Support-files/mysql.server/etc/init.d/mysql

#chmod +x/etc/init.d/mysql
#chkcpmfig--add MySQL (added as system service)
#chkconfig--list MySQL
#chkconfig MySQL on

#service MySQL Status

#netstat-anptu |grep:3306

#service MySQL Start


#ln-S/usr/local/mysql/*/bin Add the path of the command into the PATH variable

#echo "Export path= $PATH:/usr/local/mysql/bin" >>/etc/profile

#source/etc/profile
#echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin

#mysql-uroot-p
Mysql>quit

Set the password for the database administrator to log on from the local computer
#mysqladmin-hlocalhost-uroot Password "123456" This is the set password

#mysql-uroot-p123456

Mysql>quit

Change Password

# mysqladmin-hlocalhost-uroot-p Password "11" (New password)

Enter Password: (This fills in the old password)

#mysql-UROOT-P11

#vim/etc/ls.so.conf (library File connection system startup will read this file, will load the program's library file, third-party software will be able to find the MySQL library file location)

/usr/local/mysql/lib/

#ldconfig-v |grep-i--color MySQL

2. Install PHP

Installing PHP installs the expansion pack first
Libmcrypt-2.5.8.tar.gz
Mhash-0.9.9.9.tar.gz

# tar zxf mhash-0.9.9.9.tar.gz
# CD mhash-0.9.9.9/
#./configure
# Make &&make Install
# TAR-ZXF Libmcrypt-2.5.8.tar.gz
# CD libmcrypt-2.5.8/
#./configure
# Make &&make Install

Update the library file to the system default search directory

# ln-s/usr/local/lib/libmcrypt*/usr/lib/

# ln-vs/usr/local/lib/libmhash.*/usr/lib/

#ldconfig-V

Install PHP
# tar zxf php-5.4.24.tar.gz

# CD php-5.4.24/

#./configure--prefix=/usr/local/php5--with-mysql=/usr/local/mysql--enable-fpm--enable-mbstring--with-mcrypt-- With-mhash--with-config-file-path=/usr/local/php5/etc--with-mysqli=/usr/local/mysql/bin/mysql_config-- Enable-memached
# Yum List |grep xml2* (see above error, missing what first find reload)
# yum-y Install *xml2*
#./configure--prefix=/usr/local/php5--with-mysql=/usr/local/mysql--enable-fpm--enable-mbstring--with-mcrypt-- With-mhash--with-config-file-path=/usr/local/php5/etc--with-mysqli=/usr/local/mysql/bin/mysql_config
# Make && make install

3. Installing Nginx

Configure the Nginx service to receive a request to access PHP files, send the request to the local port 9000

Installing Nginx


#useradd Nginx

#tar-ZXF nginx-1.8.0.tar.gz

#cd nginx-1.8.0/


#yum-y install gcc gcc-c++ OpenSSL openssl-devel pcre pcre-devel

Install dependent packages, because LNMP installed on a server, some have been installed, can be used directly./configure compiled, missing what package will be error and install on the line, is generally the following dependencies:) [[#yum-y install gcc zlib-devel Openssl-devel]]


#./configure--prefix=/usr/local/nginx--with-http_ssl_module--with-http_stub_status_module


#yum List |grep Pcre
#yum-y Install pcre*

#./configure--prefix=/usr/local/nginx--with-http_ssl_module--with-http_stub_status_module

#make && make Install

#ln-S/usr/local/nginx/sbin/nginx/usr/sbin/


#netstat-anptu |grep Nginx (before the other occupied 80 port off)

#nginx (#chkconfig nginx on here Nginx does not have a startup script, can not set the boot-start write script)


# echo 1111 >/usr/local/nginx/html/test.html

# yum-y Install ELinks

# elinks--dump http://localhost/test.html
1111



#vim/usr/local/nginx/conf/nginx.conf

65-71 comments Removed

69 Line: Fastcgi_param script_filename $document _root$fastcgi_script_name;


#nginx-S Reload


Writing a PHP script file

#cat/usr/local/nginx/html/test.php

<?php

Phpinfo ();

?>


Client Access

#http://192.168.4.254/test.php (can explain PHP code)


Test if PHP program can connect to database

Open the database service first

# NETSTAT-ANPTU |grep:3306
TCP 0 0::: 3306:::* LISTEN 2634/mysqld

#mysql-hlocalhost-uroot-p123456

Mysql>grant all on bbsdb.* to [e-mail protected] "localhost" identified by "123456";

Mysql>create database Bbsdb;

Mysql>quit


#vim/usr/local/nginx/html/db.php

<?php

mysql_connect ("localhost", "WebAdmin", "123456");

if ($x) {

echo "OK";

}else{

echo "Err";

}

?>

Test

#http://192.168.4.254/db.php

Ok


(Connaught Database is not open, the test is the Err)


——————————————————————————————————————————————————————
4. Installing memcached

Install the memcached service (memcache, memory store--the package libevent,libevent and Memache to be loaded with the event trigger to be version compatible, libevent-2.0.21,memcached-1.4.24 here)

Install Libevent First

#yum-y Install gcc

#tar-xf libevent-2.0.21-stable.tar.gz (memcached service library file)

#cd libevent-2.0.21-stable

#./configure

#make && make Install


You can directly link to the library files can also be written in the library configuration file, do one of the following on the line.

1) #ln-S/usr/local/lib/libevent/*/usr/lib/

#ldconfig (//Refresh)


2) #vim/etc/ld.so.conf (configuration file for library files)

/usr/local/lib/

#ldconfig (//Refresh)


3) #vim/etc/ld.so.conf/libevent.conf

/usr/local/lib/

#ldconfig


#tar-ZXF memcached-1.4.24.tar.gz

#cd memcached-1.4.24

#./configure

#make && make Install

#ln-S/usr/local/bin/memached/bin

#memcached-H (View Help)


[[email protected] ~]# memcached-u root-m 64-vv-d start memcached

To see if the service started:

[Email protected] ~]# NETSTAT-ANPTU |grep:11211

TCP 0 0 0.0.0.0:11211 0.0.0.0:* LISTEN 6813/memcached

TCP 0 0::: 11211:::* LISTEN 6813/memcached

UDP 0 0 0.0.0.0:11211 0.0.0.0:* 6813/memcached

UDP 0 0::: 11211:::* 6813/memcached


"Memcached did not close service script, kill process pkill-9 memcached stop Service"



Test:

[[email protected] b]# yum-y install Telnet


[[Email protected] b]# telnet 192.168.4.5 11211

Trying 192.168.4.5 ...

Connected to 192.168.4.5.

Escape character is ' ^] '.


Set name 0 100 3

Tom

STORED

Get Name

VALUE Name 0 3

Tom

END

Replace name 0 200 3

Asc

STORED

Get Name

VALUE Name 0 3

Asc

END

Add set Replace Delete get

#cd/usr/lcoal/bin

#./php-m (see features Supported by PHP)

#./php-m |grep memcached (check if PHP supports memcached)


Let PHP support memcached

#cd

# TAR-ZXVF memcahce-2.2.5

# CD memcahce-2.2.5

#/usr/local/php5/bin/phpize

#./configure--with-php-config=/usr/local/php5/bin/php-config--anable-memcache

#make && make Install

#vim/usr/local/php5/etc/php.ini
Extension_dir= "/usr/local/php5nginx/lib/php/extensions/no-

debug-non-zts-20100525/"
Extension=memcache.so

#/etc/init.d/php-fpm restart

Modify the main configuration file of Nginx service, and access the 11211 port first when receiving the request. (settings are first looked up from the cache and no longer queried from the database)
#vim/usr/local/nginx/conf/nginx.conf


Writing test files
#cat/usr/local/nginx/html/mem.php

<?php$memcache=new memcache;//Creating Memcache objects


$memcache->connect (' localhost ', 11211) or die (' could not

connect!! ‘);

$memcache->set (' name ', ' Jim '); Defining variables


$get _values= $memcache->get (' name ');//Get Variable value echo

$get _values;? >

#http://nginx-ip/mem.php
Jim

This article is from the "12336621" blog, please be sure to keep this source http://12346621.blog.51cto.com/12336621/1914293

LNMP Installation---Source installation mysql5.6--nginx--php--memached

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.