LNMP环境搭建完整步骤
零、resource http://pan.baidu.com/s/1o83r3S2
一、centos 6.4、VirtualBox 5.0.14
二、nginx 1.9.9
安装
[root@pc ~]# cd /usr/local/src/
[root@pc src]# yum install wget
[root@pc src]# wget http://heanet.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz
[root@pc src]# tar -xzf pcre-8.38.tar.gz
[root@pc src]# cd pcre-8.38/
[root@pc pcre-8.38]# ./configure --prefix=/usr/local/pcre-8.38
[root@pc pcre-8.38]# make
[root@pc pcre-8.38]# make install
[root@pc pcre-8.38]# cd ../
[root@pc src]# yum -y install libjpeg libjpeg-devel libpng libpng-devel libvpx libvpx-devel libXpm libXpm-devel libxml2 libxml2-devel fontconfig fontconfig-devel freetype freetype-devel zlib zlib-devel bzip2 bzip2-devel curl curl-devel openssl openssl-devel
[root@pc src]# groupadd www
[root@pc src]# useradd -g www www
[root@pc src]# passwd www
[root@pc src]# wget http://nginx.org/download/nginx-1.9.9.tar.gz
[root@pc src]# tar -xzf nginx-1.9..tar.gz
[root@pc src]# cd nginx-1.9./
[root@pc nginx-1.9.]# ./configure --prefix=/usr/local/nginx-1.9. --user=www --group=www --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.38
[root@pc nginx-1.9.]# make
[root@pc nginx-1.9.]# make install
[root@pc nginx-1.9.]# cd /usr/local/nginx-1.9./conf/
[root@pc conf]# vi nginx.conf
user www;
worker_processes ;
error_log /data/logs/nginx_error.log;
pid /data/logs/nginx.pid;
http {
include vhost/*.conf;
}
[root@pc conf]# mkdir vhost rewrite
[root@pc conf]# mkdir -p /data/logs/
[root@pc conf]# chown -R www.www /data
[root@pc conf]# chmod -R 777 /data
[root@pc conf]# /usr/local/nginx-1.9.9/sbin/nginx -t
nginx: the configuration file /usr/local/nginx-1.9.9/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx-1.9.9/conf/nginx.conf test is successful
[root@pc conf]# /usr/local/nginx-1.9.9/sbin/nginx
[root@pc nginx-1.9.9]# ps -ef | grep nginx
root 14442 1 0 14:15 ? 00:00:00 nginx: master process /usr/local/nginx-1.9.9/sbin/nginx
www 14457 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14458 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14459 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14460 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14461 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14462 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14463 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14464 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14465 14442 0 14:24 ? 00:00:00 nginx: worker process
www 14466 14442 0 14:24 ? 00:00:00 nginx: worker process
root 14472 1358 0 14:27 pts/0 00:00:00 grep nginx
[root@pc conf]# curl http://localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p> <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p>
</body>
</html>
开机自启
[root@pc conf]# vi /etc/init.d/nginx
#! /bin/sh
DESC="nginx service"
NAME=nginx
DAEMON=//usr/local/nginx-1.9.9/sbin/$NAME
CONFIGFILE=/usr/local/nginx-1.9./conf/$NAME.conf
PIDFILE=/data/logs/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
set -e
[ -x "$DAEMON" ] || exit
do_start() {
$DAEMON -c $CONFIGFILE || echo -n "nginx already running"
}
do_stop() {
kill -INT `cat $PIDFILE` || echo -n "nginx not running"
}
do_reload() {
kill -HUP `cat $PIDFILE` || echo -n "nginx can't reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&
exit
;;
esac
exit
[root@pc conf]# chmod /etc/init.d/nginx
[root@pc conf]# service nginx restart
[root@pc conf]# vi /etc/rc.local
/etc/init.d/nginx start
三、mysql 5.6.30
安装
[root@pc ~]# cd /usr/local/src/
[root@pc src]# yum -y install bison expat expat-devel ncurses ncurses-devel libaio libaio-devel libc.so.
[root@pc src]# wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
[root@pc src]# tar -xzf cmake-3.5..tar.gz
[root@pc src]# cd cmake-3.5.
[root@pc cmake-3.5.]# ./configure
[root@pc cmake-3.5.]# make
[root@pc cmake-3.5.]# make install
[root@pc cmake-3.5.]# cd ../
[root@pc src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.30.tar.gz
[root@pc src]# tar -xzf mysql-5.6..tar.gz
[root@pc mysql-5.6.]# groupadd mysql
[root@pc mysql-5.6.]# useradd -g mysql mysql -s /bin/false
[root@pc mysql-5.6.]# mkdir -p /data/mysql
[root@pc mysql-5.6.]# chown -R mysql.mysql /data/mysql
[root@pc mysql-5.6.]# mkdir -p /usr/local/mysql-5.6.
[root@pc mysql-5.6.]# chown -R mysql.mysql /usr/local/mysql-5.6.
[root@pc mysql-5.6.]# yum -y install bison-devel ncurses-devel libaio libaio-devel
[root@pc mysql-5.6.]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6. \
-DMYSQL_DATADIR=/data/mysql \
-DSYSCONFDIR=/usr/local/mysql-5.6. \
-DWITH_MYISAM_STORAGE_ENGINE= \
-DWITH_INNOBASE_STORAGE_ENGINE= \
-DWITH_MEMORY_STORAGE_ENGINE= \
-DWITH_READLINE= \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT= \
-DENABLED_LOCAL_INFILE= \
-DWITH_PARTITION_STORAGE_ENGINE= \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
[root@pc mysql-5.6.]# make
[root@pc mysql-5.6.]# make install
[root@pc mysql-5.6.]# chmod +x scripts/mysql_install_db
[root@pc mysql-5.6.]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.6. --datadir=/data/mysql --explicit_defaults_for_timestamp
[root@pc mysql-5.6.]# cd /usr/local/mysql-5.6./
[root@pc mysql-5.6.]# rm -f /etc/my.cnf ./my.cnf
[root@pc mysql-5.6.]# cp support-files/my-default.cnf ./my.cnf
[root@pc mysql-5.6.]# ln -s /usr/local/mysql-5.6./my.cnf /etc/my.cnf
[root@pc mysql-5.6.]# vi my.cnf
basedir=/usr/local/mysql-5.6.
datadir=/data/mysql
port =
pid-file=/data/logs/mysql.pid
log_error = /data/logs/mysql_error.log
slow_query_log =
long_query_time =
slow_query_log_file = /data/logs/mysql_slow.log
[root@pc mysql-5.6.]# cp ./support-files/mysql.server /etc/init.d/mysql
[root@pc mysql-5.6.]# chmod /etc/init.d/mysql
[root@pc mysql-5.6.]# /etc/init.d/mysql start
Starting MySQL. SUCCESS!
初始化密码,允许远程连接及开机自启
[root@pc mysql-5.6.]# vi /etc/profile
export PATH=$PATH:/usr/local/mysql-5.6./bin
[root@pc mysql-5.6.]# source /etc/profile
[root@pc mysql-5.6.]# mysql -u root -p
Enter password: #密码为空
mysql> SET PASSWORD = PASSWORD('');
Query OK, rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;
Query OK, rows affected (0.00 sec)
mysql> DELETE FROM user WHERE Host!='%';
Query OK, rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, rows affected (0.00 sec)
mysql> exit
Bye
[root@pc mysql-5.6.]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
[root@pc mysql-5.6.]# service iptables restart
[root@pc mysql-5.6.]# vi /etc/rc.local
/etc/init.d/mysql start
四、php 5.6.21
安装
[root@pc ~]# cd /usr/local/src/
[root@pc src]# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
[root@pc src]# tar -xzf libmcrypt-2.5..tar.gz
[root@pc src]# cd libmcrypt-2.5.
[root@pc libmcrypt-2.5.]# ./configure
[root@pc libmcrypt-2.5.]# make
[root@pc libmcrypt-2.5.]# make install
[root@pc libmcrypt-2.5.]# ldconfig
[root@pc libmcrypt-2.5.]# cd libltdl/
[root@pc libltdl]# ./configure --enable-ltdl-install
[root@pc libltdl]# make
[root@pc libltdl]# make install
[root@pc libltdl]# cd ../../
[root@pc src]# wget http://jaist.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
[root@pc src]# tar -zxf mhash-0.9.9.9.tar.gz
[root@pc src]# cd mhash-0.9.9.9
[root@pc mhash-0.9.9.9]# ./configure
[root@pc mhash-0.9.9.9]# make
[root@pc mhash-0.9.9.9]# make install
[root@pc mhash-0.9.9.9]# cd ../
[root@pc src]# wget http://jaist.dl.sourceforge.net/project/lnmpaio/web/mcrypt/mcrypt-2.6.8.tar.gz
[root@pc src]# tar -xzf mcrypt-2.6..tar.gz
[root@pc src]# cd mcrypt-2.6.
[root@pc mcrypt-2.6.]# ./configure LD_LIBRARY_PATH=/usr/local/lib
[root@pc mcrypt-2.6.]# make
[root@pc mcrypt-2.6.]# make install
[root@pc mcrypt-2.6.]# cd ../
[root@pc src]# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libzip-0.9-3.1.el6.x86_64.rpm
[root@pc src]# rpm -ivh libzip-0.9-3.1.el6.x86_64.rpm
[root@pc src]# wget http://cn2.php.net/distributions/php-5.6.21.tar.gz
[root@pc src]# tar -xzf php-5.6..tar.gz
[root@pc src]# cd php-5.6.
[root@pc php-5.6.]# ./configure \
--prefix=/usr/local/php-5.6. \
--with-config-file-path=/usr/local/php-5.6./etc \
--enable-fpm --with-fpm-user=www --with-fpm-group=www \
--enable-mysqlnd \
--with-mysqli=/usr/local/mysql-5.6./bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql-5.6./bin/mysql_config \
--with-libxml-dir \
--enable-zip \
--with-zlib \
--with-zlib-dir \
--with-curl \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--with-xmlrpc \
--with-jpeg-dir \
--with-png-dir \
--with-xpm-dir \
--with-freetype-dir \
--enable-shared \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-pcntl \
--enable-sockets \
--enable-soap ...
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
[root@pc php-5.6.]# cat /etc/ld.so.conf.d/mysql-x86_64.conf
cat: /etc/ld.so.conf.d/mysql-x86_64.conf: No such file or directory
[root@pc php-5.6.]# echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf
[root@pc php-5.6.]# echo '/usr/local/lib64' >> /etc/ld.so.conf.d/local.conf
[root@pc php-5.6.]# cat /etc/ld.so.conf.d/mysql-x86_64.conf
/usr/lib64/mysql
[root@pc php-5.6.]# echo '/usr/local/mysql-5.6.30/lib' >> /etc/ld.so.conf.d/mysql-x86_64.conf
[root@pc php-5.6.]# ldconfig [root@pc php-5.6.]# ./configure --prefix=/usr/local/php-5.6. --with-config-file-path=/usr/local/php-5.6./etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=/usr/local/mysql-5.6./bin/mysql_config --with-pdo-mysql=/usr/local/mysql-5.6./bin/mysql_config --with-libxml-dir --enable-zip --with-zlib --with-zlib-dir --with-curl --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --with-xmlrpc --with-jpeg-dir --with-png-dir --with-xpm-dir --with-freetype-dir --enable-shared --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-pcntl --enable-sockets --enable-soap
[root@pc php-5.6.]# make -j4
[root@pc php-5.6.]# make install [root@pc php-5.6.]# cd /usr/local/php-5.6./etc
[root@pc etc]# cp /usr/local/src/php-5.6./php.ini-development php.ini
[root@pc etc]# cp php-fpm.conf.default php-fpm.conf
[root@pc etc]# vi php-fpm.conf
pid = /data/logs/php-fpm.pid
error_log = /data/logs/php-fpm.log
pm.max_children =
pm.start_servers =
pm.min_spare_servers =
pm.max_spare_servers =
[root@pc etc]# vi php.ini
date.timezone = 'PRC'
error_log = /data/logs/php_errors.log
[root@pc etc]# /usr/local/php-5.6./sbin/php-fpm
[root@pc etc]# ps -ef | grep fpm
root : ? :: php-fpm: master process (/usr/local/php-5.6./etc/php-fpm.conf)
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
www : ? :: php-fpm: pool www
root : pts/ :: grep fpm
[root@pc etc]# /usr/local/php-5.6./bin/php -v
PHP 5.6. (cli) (built: May ::)
Copyright (c) - The PHP Group
Zend Engine v2.6.0, Copyright (c) - Zend Technologies
开机自启
[root@pc etc]# vi /etc/init.d/php-fpm
#! /bin/sh
php_fpm_BIN=/usr/local/php-5.6./sbin/php-fpm
php_fpm_CONF=/usr/local/php-5.6./etc/php-fpm.conf
php_fpm_PID=/data/logs/php-fpm.pid
php_fpm_INI=/usr/local/php-5.6./etc/php.ini
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID -c $php_fpm_INI"
wait_for_pid () {
try=
while test $try -lt ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + `
sleep
done
}
case "$1" in
start)
echo -n "Starting php-fpm "
$php_fpm_BIN --daemonize $php_opts
if [ "$?" != ] ; then
echo " failed"
exit
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit
else
echo " done"
fi
;;
stop)
echo -n "Gracefully shutting down php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-quit"
exit
else
echo " done"
fi
;;
status)
if [ ! -r $php_fpm_PID ] ; then
echo "php-fpm is stopped"
exit
fi
PID=`cat $php_fpm_PID`
if ps -p $PID | grep -q $PID; then
echo "php-fpm (pid $PID) is running..."
else
echo "php-fpm dead but pid file exists"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit
else
echo " done"
fi
;;
restart)
$ stop
$ start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload|status}"
exit
;;
esac
[root@pc etc]# chmod /etc/init.d/php-fpm
[root@pc etc]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@pc etc]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
[root@pc etc]# service iptables restart
[root@pc etc]# vi /etc/rc.local
/etc/init.d/php-fpm start
五、vhost
[root@pc etc]# cd /data/
[root@pc data]# mkdir -p /data/www/test
[root@pc data]# vi /data/www/test/index.php
<?php
phpinfo();
[root@pc data]# chown -R www.www /data/www
[root@pc data]# vi /usr/local/nginx-1.9./conf/vhost/test.conf
server
{
listen ;
server_name www.test.dev;
index index.html index.php;
root /data/www/test; location ~ .*\.php?$
{
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi_params;
} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
} location ~ .*\.(js|css)?$
{
expires 12h;
} #include rewrite/test.conf;
#access_log /data/logs/nginx.test.access.log access;
}
[root@pc data]# vi /usr/local/nginx-1.9./conf/fastcgi_params
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
[root@pc data]# service nginx restart
[root@pc data]# echo '127.0.0.1 www.test.dev' >> /etc/hosts
[root@pc data]# curl http://www.test.dev/index.php | grep 'PHP Version 5.6.21'
六、extension
[root@pc ~]# cd /usr/local/src/
[root@pc src]# yum -y install git
[root@pc src]# git clone --depth= git://github.com/phalcon/cphalcon.git
[root@pc src]# cd cphalcon/build/
[root@pc build]# vi ./install
#phpize && ./configure --enable-phalcon && make && make install && echo -e "\nThanks for compiling Phalcon!\nBuild succeed: Please restart your web server to complete the installation"
/usr/local/php-5.6./bin/phpize && ./configure --enable-phalcon --with-php-config=/usr/local/php-5.6./bin/php-config && make && make install && echo -e "\nThanks for compiling Phalcon!\nBuild succeed: Please restart your web server to complete the installation"
[root@pc build]# ./install
[root@pc build]# vi /usr/local/php-5.6./etc/php.ini
extension_dir = "/usr/local/php-5.6.21/lib/php/extensions/no-debug-non-zts-20131226/"
extension=phalcon.so
[root@pc build]# service php-fpm restart
[root@pc build]# /usr/local/php-5.6./bin/php -i |grep phalcon [root@pc build]# cd ../../
[root@pc src]# wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
[root@pc src]# tar -xzf libmemcached-1.0..tar.gz
[root@pc src]# cd libmemcached-1.0.
[root@pc libmemcached-1.0.]# ./configure --prefix=/usr/local/libmemcached-1.0.
[root@pc libmemcached-1.0.]# make
[root@pc libmemcached-1.0.]# make install
[root@pc libmemcached-1.0.]# cd ../
[root@pc src]# wget http://pecl.php.net/get/memcached-2.2.0.tgz
[root@pc src]# tar -xzf memcached-2.2..tgz
[root@pc src]# cd memcached-2.2.
[root@pc memcached-2.2.]# /usr/local/php-5.6./bin/phpize
[root@pc memcached-2.2.]# ./configure --enable-memcached \
--with-php-config=/usr/local/php-5.6./bin/php-config \
--with-libmemcached-dir=/usr/local/libmemcached-1.0.
...
checking sasl/sasl.h usability... no
checking sasl/sasl.h presence... no
checking for sasl/sasl.h... no
configure: error: no, sasl.h is not available. Run configure with --disable-memcached-sasl to disable this check
[root@pc memcached-2.2.]# yum -y install cyrus-sasl-devel
[root@pc memcached-2.2.]# /usr/local/php-5.6./bin/phpize
[root@pc memcached-2.2.]# ./configure --enable-memcached --disable-memcached-sasl \
--with-php-config=/usr/local/php-5.6./bin/php-config \
--with-libmemcached-dir=/usr/local/libmemcached-1.0.
[root@pc memcached-2.2.]# make
[root@pc memcached-2.2.]# make install
[root@pc memcached-2.2.]# vi /usr/local/php-5.6./etc/php.ini
extension=memcached.so
[root@pc memcached-2.2.]# service php-fpm restart
[root@pc memcached-2.2.]# /usr/local/php-5.6./bin/php -i |grep memcached [root@pc memcached-2.2.]# cd ../
[root@pc src]# wget http://pecl.php.net/get/memcache-2.2.7.tgz
[root@pc src]# tar -xzf memcache-2.2..tgz
[root@pc src]# cd memcache-2.2.
[root@pc memcache-2.2.]# /usr/local/php-5.6./bin/phpize
[root@pc memcache-2.2.]# ./configure --with-php-config=/usr/local/php-5.6./bin/php-config
[root@pc memcache-2.2.]# make
[root@pc memcache-2.2.]# make install
[root@pc memcache-2.2.]# vi /usr/local/php-5.6./etc/php.ini
extension=memcache.so
[root@pc memcache-2.2.]# service php-fpm restart
[root@pc memcache-2.2.]# /usr/local/php-5.6./bin/php -i |grep memcache
七、memcached service
[root@pc ~]# cd /usr/local/src/
[root@pc src]# wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
[root@pc src]# tar -xzf libevent-2.0.-stable.tar.gz
[root@pc src]# cd libevent-2.0.-stable
[root@pc libevent-2.0.-stable]# ./configure -prefix=/usr
[root@pc libevent-2.0.-stable]# make
[root@pc libevent-2.0.-stable]# make install
[root@pc libevent-2.0.-stable]# ls -al /usr/lib | grep libevent
[root@pc libevent-2.0.-stable]# cd ../
[root@pc src]# wget http://memcached.org/files/memcached-1.4.25.tar.gz
[root@pc src]# tar -xzf memcached-1.4..tar.gz
[root@pc src]# cd memcached-1.4.
[root@pc memcached-1.4.]# ./configure -with-libevent=/usr
[root@pc memcached-1.4.]# make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /usr/local/src/memcached-1.4./missing aclocal-1.14
/usr/local/src/memcached-1.4./missing: line : aclocal-1.14: command not found
WARNING: 'aclocal-1.14' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
make: *** [aclocal.m4] Error
[root@pc memcached-1.4.]# autoreconf -ivf
[root@pc memcached-1.4.]# make
[root@pc memcached-1.4.]# make install
[root@pc memcached-1.4.]# ls -al /usr/local/bin/mem*
[root@pc memcached-1.4.]# /usr/local/bin/memcached -d -m -u root -l 127.0.0.1 -p -c -P /data/logs/memcached.pid
[root@pc memcached-1.4.]# vi /etc/init.d/memcached
#! /bin/sh
start()
{
echo -n $"Starting memcached"
/usr/local/bin/memcached -d -m -u root -l 127.0.0.1 -p -c -P /data/logs/memcached.pid
echo -e '\n'
}
stop()
{
echo -n $"Shutting down memcached"
kill `cat /data/logs/memcached.pid`
echo -e '\n'
}
[ -f /usr/local/bin/memcached ] || exit
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart}"
exit
esac
exit
[root@pc memcached-1.4.]# chmod /etc/init.d/memcached
[root@pc memcached-1.4.]# service memcached restart
[root@pc memcached-1.4.]# vi /etc/rc.local
/etc/init.d/memcached start
LNMP环境搭建完整步骤的更多相关文章
- 利用Docker搭建本地https环境的完整步骤
利用Docker搭建本地https环境的完整步骤 这篇文章主要给大家介绍了关于如何利用Docker搭建本地https环境的完整步骤,文中通过示例代码将实现的步骤介绍的非常详细,对大家的学习或者工作具有 ...
- LNMP环境搭建:Nginx安装、测试与域名配置
Nginx作为一款优秀的Web Server软件同时也是一款优秀的负载均衡或前端反向代理.缓存服务软件 2.编译安装Nginx (1)安装Nginx依赖函数库pcre pcre为“perl兼容正则表达 ...
- zabbix学习(一)——LNMP环境搭建及zabbix安装
第一部分:LNMP环境搭建 一.环境说明: OS: centos7.6_x64nginx:nginx-1.16.0php: php-7.1.11mysql:mysql-5.6.44 zabbi ...
- LNMP环境搭建
LNMP环境搭建 Linux + Nginx + MySQL + PHP PHP是一种脚本语言,当前中国乃至世界上使用PHP语言开发的网站非常普遍 Nginx是一个web服务软件,和apache是一类 ...
- LNMP环境搭建——MySQL篇
The world's most popular open source database 1.Install MySQL root@kallen:~# apt-get install mysql-s ...
- LNMP环境搭建之php安装,wordpress博客搭建
LNMP环境搭建之php安装,wordpress博客搭建 一.介绍: 1.什么是CGI CGI全称是"通用网关接口"(Common Gateway Interface),HTTP服 ...
- Linux下-LNMP环境搭建博客网站(全过程)
通常我们所说的LNMP是指一个网站基本的组织框架,即Linux系统支持,Nginx静态服务,Mysql数据库支持以及PHP动态编程语言支持.目前Mysql数据库被Oracle数据库分析公司收购,其创始 ...
- 阿里云(ECS)Centos服务器LNMP环境搭建
阿里云( ECS ) Centos7 服务器 LNMP 环境搭建 前言 第一次接触阿里云是大四的时候,当时在校外公司做兼职,关于智能家居项目的,话说当时俺就只有一个月左右的 php 后台开发经验(还是 ...
- ELK环境搭建完整说明
ELK环境搭建完整说明 ELK:ElasticSerach.Logstash.Kibana三款产品名称的首字母集合,用于日志的搜集和搜索.简单地理解为我们可以把服务端的日志(nginx.tomcat等 ...
随机推荐
- Azure SQL Database (22) 迁移部分数据到Azure Stretch Database
<Windows Azure Platform 系列文章目录> Azure SQL Database (19) Stretch Database 概览 Azure SQL Da ...
- C语言 · 最小公倍数
问题描述 编写一函数lcm,求两个正整数的最小公倍数. 样例输入 一个满足题目要求的输入范例.例:3 5 样例输出 与上面的样例输入对应的输出.例: 数据规模和约定 输入数据中每一个数的范围. 例:两 ...
- Tomcat7基于Redis的Session共享实战一
本文主要介绍如何使用redis对tomcat7的session进行托管. 1.安装Redisredis安装比较简单,此处略过. 2.配置两个Tomcat在本机上配置两个Tomcat,分别为tomcat ...
- GitHub iOS-Top 100 简介
GitHub排名前100的iOS第三方汇总简介,方便开发者选择适合的第三方框架. 项目名称 项目信息 1. AFNetworking 作者是 NSHipster 的博主, iOS 开发界的大神级人物, ...
- 【深入浅出Linux网络编程】 "开篇 -- 知其然,知其所以然"
[深入浅出Linux网络编程]是一个连载博客,内容源于本人的工作经验,旨在给读者提供靠谱高效的学习途径,不必在零散的互联网资源中浪费精力,快速的掌握Linux网络编程. 连载包含4篇,会陆续编写发出, ...
- 一起学微软Power BI系列-官方文档-入门指南(4)Power BI的可视化
在前面的系列文章中,我们介绍了官方有关获取数据,以及建模的原始文档和基本介绍.今天继续给大家介绍官方文档中,有关可视化的内容.实际上获获取数据和建模更注重业务关系的处理,而可视化则关注对数据的解读.这 ...
- 为什么要学习Linux
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 本篇修改自我在知乎上回答的问题,为什么要学习 Linux? 我最开始用Linux是 ...
- C# 对象锁
现在有一种场景,服务端将一个任务派发给10个客户端执行,所有客户端执行完后,整个任务才算执行完. 每个客户端执行完后,通过http发送一个完成的消息给服务端,服务端发送邮件通知给用户. 当10个客户端 ...
- Flume官方文档翻译——Flume 1.7.0 User Guide (unreleased version)中一些知识点
Flume官方文档翻译--Flume 1.7.0 User Guide (unreleased version)(一) Flume官方文档翻译--Flume 1.7.0 User Guide (unr ...
- c++编译器对多态的实现原理总结
问题:定义一个空的类型,里面没有任何的成员变量或者成员函数,对这个类型进行 sizeof 运算,结果是? 结果是1,因为空类型的实例不包含任何信息,按道理 sizeof 计算之后结果是0,但是在声明任 ...