#下载配置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 "Development tools" "Development Library"
Yum-y install gcc gcc-c++ make zlib-devel ncurses-devel libxml2 libxml2-devel libjpeg-devel libpng-devel freetype Openlda P-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/;d ate.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
This article is from the "Wsyht blog" blog, make sure to keep this source http://wsyht2015.blog.51cto.com/9014030/1790374
One-Health installation LNMP