一健安裝LNMP

#下載配置Yum

#rm -rf /etc/yum.repos.d/other

#mkdir /etc/yum.repos.d/other

#mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/other

#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

#yum clean all

#yum makecache


#配置本地YUM

mount /dev/cdrom /media

rm -rf /etc/yum.repos.d/other

mkdir /etc/yum.repos.d/other

mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/other

cp /opt/CentOS-Media.repo /etc/yum.repos.d/

yum clean all

yum makecahce


#修改主機名

sed -i '2d' /etc/sysconfig/network

sed -i '1a HOSTNAME=zabbix' /etc/sysconfig/network

hostname zabbix


#安裝源碼Nginx

yum -y groupinstall "開發工具" "開發庫"

yum -y install gcc gcc-c++ make zlib-devel ncurses-devel libxml2 libxml2-devel libjpeg-devel libpng-devel freetype openldap-devel openldap openssl openssl-devel pcre pcre-devel curl-devel freetype-devel net-snmp-devel mysql-devel  

service httpd stop;chkconfig httpd off

service mysqld stop;chkconfig mysqld off;rm -rf /etc/init.d/mysqld

mv /etc/my.cnf /etc/my.cnf.old

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

service iptables stop;setenforce 0

useradd -M -s /sbin/nologin www

tar xf nginx-1.8.0.tar.gz

cd nginx-1.8.0

./configure --prefix=/usr/local/nginx  --pid-path=/usr/local/nginx/nginx.pid --user=www  --group=www --with-http_ssl_module  --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/usr/local/nginx/client --http-proxy-temp-path=/usr/local/nginx/proxy --http-fastcgi-temp-path=/usr/local/nginx/fcgi --http-uwsgi-temp-path=/usr/local/nginx/uwsgi --http-scgi-temp-path=/usr/local/nginx/scgi --with-pcre --without-http_rewrite_module 

make

make install

rm -f /usr/local/nginx/conf/nginx.conf

cp /opt/nginx.conf /usr/local/nginx/conf/

cp /opt/nginx /etc/init.d/nginx


#安裝cmake編譯工具

cd /opt

tar xf cmake-2.8.10.2.tar.gz

cd cmake-2.8.10.2

./bootstrap --prefix=/usr/local/cmake

make

make install


#安裝源碼MySQL

cd /opt

useradd -M -s /sbin/nologin mysql

tar zxf mysql-5.5.14.tar.gz

cd mysql-5.5.14

/usr/local/cmake/bin/cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DSYSCONFDIR=/etc -DMYSQL_DATADIR=/usr/local/mysql/data  -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysqld.sock -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DMYSQL_USER=mysql

make

make install

chown -R mysql:mysql /usr/local/mysql

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

cp /opt/mysql-5.5.14/support-files/my-medium.cnf /etc/my.cnf

cp /opt/mysql-5.5.14/support-files/mysql.server /etc/init.d/mysqld

sed -i '1a /usr/local/mysql/lib/' /etc/ld.so.conf

ln -s /usr/local/mysql/bin/* /usr/sbin

ldconfig


#安裝php的擴展包 

cd /opt 

tar xf mhash-0.9.9.9.tar.gz  

cd mhash-0.9.9.9 

./configure 

make 

make install 

cd /opt 

tar -zxf libiconv-1.13.1.tar.gz 

cd libiconv-1.13.1 

./configure  

make 

make install 

cd /opt

tar zxf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make 

make install

ldconfig

cd /opt/libmcrypt-2.5.8/libltdl/ 

./configure --with-gmetad --enable-gexec --enable-ltdl-install 

make  

make install 

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

ln -s /usr/local/lib/libmhash.* /usr/lib/ 

ldconfig

cd /opt

tar xf php-5.4.42.tar.gz

cd php-5.4.42

cp -r /usr/lib64/libldap* /usr/lib/

./configure  --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --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 --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-freetype-dir --with-gettext --with-fpm-user=www --with-fpm-group=www                                           

make ZEND_EXTRA_LIBS='-liconv'

make install

cp /opt/php-5.4.42/php.ini-production /usr/local/php/etc/php.ini

cp /opt/index.php /usr/local/nginx/html

cp /opt/testdb.php /usr/local/nginx/html


#配置啓動fpm

cp /opt/php-fpm.conf /usr/local/php/etc/

cp /opt/php-5.4.42/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 


#服務端配置LAMP使用環境

sed -i 's/;date.timezone =/date.timezone = Asia\/Shanghai/g' /usr/local/php/etc/php.ini

sed -i 's#max_execution_time = 30#max_execution_time = 300#g' /usr/local/php/etc/php.ini

sed -i 's#post_max_size = 8M#post_max_size = 32M#g' /usr/local/php/etc/php.ini

sed -i 's#max_input_time = 60#max_input_time = 300#g' /usr/local/php/etc/php.ini

sed -i 's/;mbstring.func_overload = 0/mbstring.func_overload = 2/g' /usr/local/php/etc/php.ini


#啓動服務

chkconfig --add nginx;chkconfig nginx on;chmod +x /etc/init.d/nginx;service nginx start

chkconfig --add mysqld;chkconfig mysqld on;chmod +x /etc/init.d/mysqld;service mysqld start

chkconfig --add php-fpm;chkconfig php-fpm on;chmod +x /etc/init.d/php-fpm;service php-fpm start

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章