[root@server6 ~]# ls
cmake-2.8.12.2-4.el6.x86_64.rpm mysql-boost-5.7.17.tar.gz
mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar
[root@server6 ~]# tar zxf mysql-boost-5.7.17.tar.gz
[root@server6 ~]# ls
cmake-2.8.12.2-4.el6.x86_64.rpm mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar
mysql-5.7.17 mysql-boost-5.7.17.tar.gz
[root@server6 ~]# cd mysql-5.7.17
[root@server6 mysql-5.7.17]# cd
[root@server6 ~]# rpm -ivh cmake-2.8.12.2-4.el6.x86_64.rpm
[root@server6 ~]# yum install -y cmake-2.8.12.2-4.el6.x86_64.rpm
[root@server6 ~]# cd mysql-5.7.17
[root@server6 mysql-5.7.17]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql\ #安装目录
> -DMYSQL_DATADIR=/usr/local/lnmp/mysql/data \ #数据库存放目录
> -DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock \ #Unix socket 文件路径
> -DWITH_MYISAM_STORAGE_ENGINE=1 \ #安装 myisam 存储引擎
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \ #安装 innodb 存储引擎
> -DDEFAULT_CHARSET=utf8 \ #使用 utf8 字符
> -DDEFAULT_COLLATION=utf8_general_ci \ #校验字符
> -DEXTRA_CHARSETS=all \ #安装所有扩展字符集
[root@server6 mysql-5.7.17]# yum install -y gcc gcc-c++ make ncurses-devel bison openssl-devel zlib-devel
[root@server6 mysql-5.7.17]# rm -f CMakeCache.txt #重新编译时,需要清除旧的对象文件和缓存信息
[root@server6 mysql-5.7.17]# make
[root@server6 mysql-5.7.17]# make install
[root@server6 data]# cd /usr/local/lnmp/mysql
[root@server6 mysql]# ls
[root@server6 mysql]# cd support-files/
[root@server6 support-files]# ls
magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server
[root@server6 support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
[root@server6 support-files]# vim /etc/my.cnf
18 basedir =/usr/local/lnmp/mysql
19 datadir = /usr/local/lnmp/mysql/data
20 port = 3306
21 # server_id = .....
22 socket = /usr/local/lnmp/mysql/data/mysql.sock
[root@server6 support-files]# vim mysql.server
[root@server6 support-files]# cp mysql.server /etc/init.d/mysqld
[root@server6 mysql]# groupadd -g 27 mysql
[root@server6 mysql]# useradd -u 27 -g 27 -M -d /usr/local/lnmp/mysql/data -s /sbin/nologin mysql
[root@server6 mysql]# chown -R mysql.mysql .
[root@server6 ~]# vim .bash_profile
[root@server6 ~]# source .bash_profile
[root@server6 ~]# cd /usr/local/lnmp/mysql/data
[root@server6 data]# rm -fr *
[root@server6 mysql]# mysqld --initialize --user=mysql #记住生成的密码
[root@server6 mysql]# chown root . -R
[root@server6 mysql]# chown mysql data/ -R
[root@server6 mysql]# ll
[root@server6 mysql]# /etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
[root@server6 mysql]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: #输入刚才生成的密码
The existing password for the user account root has expired. Please set a new password.
New password: #写入新的密码
Re-enter new password:
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) :
... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
[root@server6 mysql]# mysql -p
[root@server6 ~]# ls
php-5.6.35.tar.bz2
[root@server6 ~]# tar jxf php-5.6.35.tar.bz2
[root@server6 ~]# ls
php-5.6.35 php-5.6.35.tar.bz2
[root@server6 ~]# cd php-5.6.35
./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-mysql=mysqlnd --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-pear --with-gettext --with-gmp --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash
[root@server6 php-5.6.35]# yum install curl-devel -y
[root@server6 php-5.6.35]# rpm -ivh re2c-0.13.5-1.el6.x86_64.rpm
[root@server6 php-5.6.35]# yum install net-snmp-devel -y
[root@server6 php-5.6.35]# yum install libmcrypt-2.5.8-9.el6.x86_64.rpm libmcrypt-devel-2.5.8-9.el6.x86_64.rpm -y
[root@server6 php-5.6.35]# yum install -y gmp-devel
[root@server6 php-5.6.35]# yum install gd-devel-2.0.35-11.el6.x86_64.rpm -y
[root@server6 php-5.6.35]# yum install -y libxml2-devel openssl-devel curl-devel
[root@server6 php-5.6.35]# make && make install
[root@server6 php-5.6.35]# cd /usr/local/lnmp/php/
[root@server6 php]# cd -
/root/php-5.6.35
[root@server6 php-5.6.35]# cp php.ini-production /usr/local/lnmp/php/etc/php.ini
[root@server6 php-5.6.35]# cd /usr/local/lnmp/php/etc
[root@server6 etc]# vim php.ini
[root@server6 ~]# cd /usr/local/lnmp/php/etc
[root@server6 etc]# cp php-fpm.conf.default php-fpm.conf
[root@server6 etc]# useradd -M -d /usr/local/lnmp/nginx -s /sbin/nologin nginx
[root@server6 etc]# cd
[root@server6 ~]# cd php-5.6.35/sapi/fpm/
[root@server6 fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@server6 fpm]# chmod +x /etc/init.d/php-fpm
[root@server6 fpm]# /etc/init.d/php-fpm start
Starting php-fpm done
[root@server6 ~]# ls
gd-devel-2.0.35-11.el6.x86_64.rpm nginx-sticky-module-ng.tar.gz
libmcrypt-2.5.8-9.el6.x86_64.rpm php-5.6.35
libmcrypt-devel-2.5.8-9.el6.x86_64.rpm php-5.6.35.tar.bz2
nginx-1.10.1.tar.gz re2c-0.13.5-1.el6.x86_64.rpm
[root@server6 ~]# tar zxf nginx-1.10.1.tar.gz
[root@server6 ~]# tar zxf nginx-sticky-module-ng.tar.gz
[root@server6 ~]# cd nginx-1.10.1
[root@server6 nginx-1.10.1]# vim src/core/nginx.h
[root@server6 nginx-1.10.1]# vim auto/cc/gcc
[root@server6 nginx-1.10.1]# ./configure --prefix=/usr/local/lnmp/nginx --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx --with-threads --with-file-aio
[root@server6 nginx-1.10.1]# yum install -y pcre-devel
[root@server6 nginx-1.10.1]# make && make install
[root@server6 nginx-1.10.1]# cd /usr/local/lnmp/nginx/conf/
[root@server6 conf]# vim nginx.conf
[root@server6 conf]# vim /etc/security/limits.conf
nginx - nofile 65536
[root@server6 ~]# vim .bash_profile
[root@server6 ~]# source .bash_profile
[root@server6 ~]# nginx -t
[root@server6 init.d]# nginx
[root@server6 init.d]# cd
[root@server6 ~]# cd /usr/local/lnmp/nginx/html/
[root@server6 html]# ls
50x.html index.html
[root@server6 html]# vim index.php
测试:
在浏览器中:
172.25.14.6/index.php
[root@server6 html]# cd /usr/local/lnmp/nginx/conf/
[root@server6 conf]# vim nginx.conf
43 location / {
44 root html;
45 index index.php index.html index.htm;
46 }
[root@server6 ~]# ls
Discuz_X3.2_SC_UTF8.zip
[root@server6 ~]# yum install -y unzip
[root@server6 ~]# unzip Discuz_X3.2_SC_UTF8.zip -d /usr/local/lnmp/nginx/html/
在浏览器中输入bbs.westos.org/install/
[root@server6 ~]# cd /usr/local/lnmp/nginx/html
[root@server6 html]# mv upload/ bbs
[root@server6 html]# cd bbs/
[root@server6 bbs]# chmod 777 config/ data/ uc_server/ uc_client/ -R
[root@server6 bbs]# cd /usr/local/lnmp/php/etc/
[root@server6 etc]# vim php.ini
pdo_mysql.default_socket= /usr/local/lnmp/mysql/data/mysql.sock
[root@server6 etc]# /etc/init.d/php-fpm reload
Reload service php-fpm done
[root@server6 etc]# cd /usr/local/lnmp/mysql/
[root@server6 mysql]# ls
bin data include man README support-files
COPYING docs lib mysql-test share
[root@server6 mysql]# chmod 755 data/
[root@server6 ~]# cd /usr/local/lnmp/nginx/html/bbs/install/
[root@server6 install]# rm -f index.php
[root@server6 ~]# tar zxf memcache-2.2.5.tgz
[root@server6 ~]# ls
Discuz_X3.2_SC_UTF8.zip nginx-1.10.1.tar.gz
gd-devel-2.0.35-11.el6.x86_64.rpm nginx-sticky-module-ng
libmcrypt-2.5.8-9.el6.x86_64.rpm nginx-sticky-module-ng.tar.gz
libmcrypt-devel-2.5.8-9.el6.x86_64.rpm package.xml
memcache-2.2.5 php-5.6.35
memcache-2.2.5.tgz php-5.6.35.tar.bz2
nginx-1.10.1 re2c-0.13.5-1.el6.x86_64.rpm
[root@server6 ~]# cd /usr/local/lnmp/php/bin/
[root@server6 bin]# cd
[root@server6 ~]# vim .bash_profile
[root@server6 ~]# source .bash_profile
[root@server6 ~]# cd memcache-2.2.5
[root@server6 memcache-2.2.5]# phpize
[root@server6 memcache-2.2.5]# ./configure
[root@server6 memcache-2.2.5]# make
[root@server6 memcache-2.2.5]# make install
[root@server6 memcache-2.2.5]# cd /usr/local/lnmp/php/lib/php/extensions/no-debug-non-zts-20131226/
[root@server6 extensions]# cd /usr/local/lnmp/php/etc/
[root@server6 etc]# vim php.ini
[root@server6 etc]# /etc/init.d/php-fpm reload
Reload service php-fpm done
[root@server6 ~]# yum install -y memcached
[root@server6 ~]# /etc/init.d/memcached start
Starting memcached: [ OK ]
[root@server6 memcache-2.2.5]# cp memcache.php example.php /usr/local/lnmp/nginx/html/
[root@server6 memcache-2.2.5]# cd /usr/local/lnmp/nginx/html/
[root@server6 html]# vim memcache.php
测试:
在网页上输入172.25.14.6
在物理机上测试
压测:
[root@foundation14 ~]# ab -c 10 -n 1000 http://172.25.14.6/example.php
[root@foundation14 ~]# ab -c 10 -n 1000 http://172.25.14.6/index.php
[root@server6 ~]# tar zxf openresty-1.13.6.1.tar.gz
[root@server6 ~]# cd openresty-1.13.6.1
[root@server6 openresty-1.13.6.1]# ./configure --prefix=/usr/local/lnmp/openresty --with-http_ssl_module --with-http_stub_status_module --user=nginx --group=nginx --with-threads --with-file-aio
[root@server6 openresty-1.13.6.1]# gmake
[root@server6 openresty-1.13.6.1]# gmake install
[root@server6 openresty-1.13.6.1]# cd /usr/local/lnmp/openresty/nginx/conf/
[root@server6 conf]# vim nginx.conf
12 events {
13 worker_connections 65535;
14 }
15
16
17 http {
18 upstream memcache{
19 server localhost:11211;
20 keepalive 512;
21 }
22 include mime.types;
23 default_type application/octet-stream;
47 location / {
48 root html;
49 index index.php index.html index.htm;
50 }
51 location /memc{
52 internal;
53 memc_connect_timeout 100ms;
54 memc_send_timeout 100ms;
55 memc_read_timeout 100ms;
56 set $memc_key $query_string;
57 set $memc_exptime 300;
58 memc_pass memcache;
59 }
81 location ~ \.php$ {
82 set $key $uri$args;
83 srcache_fetch GET /memc $key;
84 srcache_store PUT /memc %key;
85 root html;
86 fastcgi_pass 127.0.0.1:9000;
87 fastcgi_index index.php;
88 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
89 include fastcgi.conf;
90 }
[root@server6 conf]# /usr/local/lnmp/openresty/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/lnmp/openresty/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/lnmp/openresty/nginx/conf/nginx.conf test is successful
[root@server6 conf]# nginx -s stop
[root@server6 conf]# /usr/local/lnmp/openresty/nginx/sbin/nginx
[root@server6 conf]# cd ..
[root@server6 nginx]# cd html/
[root@server6 html]# cp /usr/local/lnmp/nginx/html/example.php .
[root@server6 html]# cp /usr/local/lnmp/nginx/html/index.php .
测试:
在浏览器中写入172.25.14.6/index.php
在浏览器中输入172.25.14.6/example.php
在物理机上测试:
压测
[root@foundation14 ~]# ab -c 10 -n 1000 http://172.25.14.6/example.php
[root@foundation14 ~]# ab -c 10 -n 1000 http://172.25.14.6/index.php