首页 > 代码库 > lnmp

lnmp

LNMP( mysql-5.6.26.tar.gz  pcre-8.37.tar.bz2 libmcrypt-2.5.8.tar.bz2  nginx-1.8.0.tar.gz   php-5.6.13.tar.bz2 )


修改主机名


hostname zabbix.huiyunltd.com

sed -i ‘s#HOSTNAME=memcached.huiyunltd.com#HOSTNAME=zabbix.huiyunltd.com#g‘ /etc/sysconfig/network


[root@zabbix ~]# yum groupinstall "Development Tools" "Development Libraries" -y


[root@zabbix ~]# yum install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* -y


[root@zabbix ~]# tar xf pcre-8.37.tar.bz2 -C /usr/local/src/


[root@zabbix ~]# tar xf nginx-1.8.0.tar.gz -C /usr/local/src/

[root@zabbix ~]# cd /usr/local/src/nginx-1.8.0/


[root@zabbix ~]# make j 3 ; make install ; cd


[root@zabbix ~]# useradd -M -u 8001 -s /sbin/nologin nginx


[root@zabbix ~]# vim /usr/local/nginx/conf/nginx.conf


[root@zabbix ~]# /usr/local/nginx/sbin/nginx 

[root@zabbix ~]# netstat -tlnp | grep nginx

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      7390/nginx


关闭防火墙 # sudo service iptables stop && chkconfig iptables off

关闭selinux  sudo vim /etc/sysconfig/selinux          SELINUX=disabled



[root@zabbix ~]#  /usr/local/nginx/sbin/nginx -t 

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful


[root@zabbix ~]# /usr/local/nginx/sbin/nginx -s reload


[root@zabbix ~]# ln -sv /usr/local/nginx/sbin/nginx /bin/


---------------

[root@zabbix ~]# rpm -qa | grep mysql

mysql-libs-5.1.73-7.el6.x86_64

[root@zabbix ~]# rpm -e mysql-libs-5.1.73-7.el6.x86_64 --nodeps

[root@zabbix ~]# yum install -y cmake ncurses-devel

[root@zabbix ~]# tar xf mysql-5.6.26.tar.gz -C /usr/local/src/


[root@zabbix ~]# cd !$

[root@zabbix src]# cd mysql-5.6.26/



[root@zabbix mysql-5.6.26]# id mysql

id: mysql: No such user

[root@zabbix mysql-5.6.26]# useradd -M -s /sbin/nologin mysql

[root@zabbix mysql-5.6.26]# id mysql

uid=8002(mysql) gid=8002(mysql) groups=8002(mysql)


[root@zabbix mysql-5.6.26]# cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DMYSQL_UNIX_ADDR=/tmp/mysql.sock  -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci  -DWITH_EXTRA_CHARSETS=all  -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data  -DMYSQL-USER=mysql


[root@zabbix mysql-5.6.26]# make -j 4 && make install


[root@zabbix ~]# chown -R mysql.mysql /usr/local/mysql/


[root@zabbix ~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

[root@zabbix ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld


[root@zabbix ~]# vim /etc/init.d/mysqld

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data



[root@zabbix ~]# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql


[root@zabbix ~]# service mysqld start


[root@zabbix ~]# ln -sv /usr/local/mysql/bin/* /bin/

[root@zabbix ~]# /usr/local/mysql/bin/mysql_secure_installation


-------------------------

[root@zabbix ~]# yum install -y php-pear


[root@zabbix ~]# tar xf libmcrypt-2.5.8.tar.bz2 -C /usr/local/src/

[root@zabbix ~]# cd !$

[root@zabbix src]# cd libmcrypt-2.5.8/

[root@zabbix ~]# ./configure --prefix=/usr/local/libmcrypt

[root@zabbix ~]# make ; make install ; cd


[root@zabbix ~]# yum install -y libxml2-devel libcurl-devel libjpeg-devel libpng-devel freetype freetype-devel


include ld.so.conf.d/*.conf

/usr/local/libmcrypt/lib

/usr/local/mysql/lib


[root@zabbix ~]# ldconfig

[root@zabbix ~]# echo ‘ldconfig‘ >> /etc/rc.local

[root@zabbix ~]# tar xf php-5.6.13.tar.bz2 -C /usr/local/src/


[root@zabbix ~]# cd !$

[root@zabbix src]# cd php-5.6.13/


[root@zabbix ~]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-mcrypt=/usr/local/libmcrypt

[root@zabbix ~]# make -j 3 && make install ; cd


[root@zabbix ~]# cp /usr/local/src/php-5.6.13/php.ini-production /usr/local/php/php.ini

[root@zabbix ~]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

[root@zabbix ~]# vim /usr/local/php/etc/php-fpm.conf


[root@zabbix ~]# cp /usr/local/src/php-5.6.13/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

[root@zabbix ~]# chmod +x /etc/init.d/php-fpm

[root@zabbix ~]# chkconfig php-fpm on

[root@zabbix ~]# /etc/init.d/php-fpm start

Starting php-fpm  done

[root@zabbix ~]# netstat -tlunp | grep 9000

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      28444/php-fpm 


[root@zabbix ~]# echo "<?php phpinfo(); ?>" > /usr/local/nginx/html/index.php


-------------------------------------------------------------


[root@zabbix mysql]# mysql -uzabbix -p zabbix < schema.sql 

Enter password: 

[root@zabbix mysql]# mysql -uzabbix -p zabbix < images.sql 

Enter password: 

[root@zabbix mysql]# mysql -uzabbix -p zabbix < data.sql


[root@zabbix mysql]# yum install -y net-snmp-devel


[root@zabbix zabbix-3.0.5]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent -with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl


[root@zabbix zabbix-3.0.5]# make install


[root@zabbix ~]# vim /usr/local/zabbix/etc/zabbix_server.conf

[root@zabbix ~]# vim /usr/local/zabbix/etc/zabbix_agentd.conf

[root@zabbix ~]# useradd -u 8005 -M -s /sbin/nologin zabbix


[root@zabbix ~]# /usr/local/zabbix/sbin/zabbix_server 

[root@zabbix ~]# echo /usr/local/zabbix/sbin/zabbix_server >> /etc/rc.local


[root@zabbix ~]# netstat -antup | grep zabbix

tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      4207/zabbix_server 




lnmp