一起搭建linux监控平台之nagios(一)lamp环境
环境OS:centos 5.8 x86_64这次脚本比上篇有些许修改,脚本如下
[*]#mkdir /etc/yum.repos.d/backup
[*] #mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/
[*] #mv /tmp/lamp/ftp.repo /etc/yum.repos.d/
[*] #yum clean all
[*] #yum makecache
[*] path=`pwd`
[*] yum -y install gcc gcc-c++ screen autoconf automake libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre pcre-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libtiff libtiff-devel gettext gettext-devel pam pam-devel fontconfig-devel libXpm-devel libtool php-common
[*] cd $path
[*] tar -zxvf httpd-2.2.9.tar.gz
[*] cd $path/httpd-2.2.9
[*] ./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
[*] make
[*] make install
[*] mv $path/httpd /etc/rc.d/init.d/httpd
[*] chmod +x /etc/rc.d/init.d/httpd
[*] chkconfig --add httpd
[*] chkconfig httpd on
[*] service httpd start
[*] #install mysql-server
[*] groupadd mysql
[*] useradd -g mysql mysql
[*] mkdir -p /data/mysql/var
[*] cd $path
[*] tar -zxvf Percona-Server-5.1.58.tar.gz
[*] cd $path/Percona-Server-5.1.58
[*] ./configure --prefix=/usr/local/mysql/ --localstatedir=/data/mysql/var --with-extra-charsets=utf8,gbk --with-pthread --enable-thread-safe-client --with-ssl --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-plugins=partition,innobase,csv,myisam,innodb_plugin --enable-shared --enable-assembler
[*] make && make install
[*] cp support-files/my-medium.cnf /etc/my.cnf
[*] cp support-files/mysql.server /etc/init.d/mysqld
[*] chmod +x /etc/init.d/mysqld
[*] ln -s /usr/local/mysql/bin/* /usr/local/bin/
[*] ln -s /usr/local/mysql/lib/mysql/lib* /usr/lib/
[*] /usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/var --user=mysql &
[*] chown -R root.mysql /usr/local/mysql/
[*] #chown -R mysql.mysql /usr/local/mysql/var/
[*] chown -R mysql.mysql /data/mysql/
[*] sed -i '38a\basedir = /usr/local/mysql/ \' /etc/my.cnf
[*] sed -i '39a\datadir = /data/mysql/var/ \' /etc/my.cnf
[*] service mysqld start
[*] #install php
[*] cd $path
[*] tar -zxvf libmcrypt-2.5.8.tar.gz
[*] cd $path/libmcrypt-2.5.8/
[*] ./configure --prefix=/usr/local/libmcrypt/
[*] make
[*] make install
[*] cd $path/libmcrypt-2.5.8/libltdl
[*] ./configure --enable-ltdl-install
[*] make
[*] make install
[*] cd $path
[*] tar -zxvf libiconv-1.13.1.tar.gz
[*] cd $path/libiconv-1.13.1
[*] ./configure --prefix=/usr/local/
[*] make
[*] make install
[*] ln -s /usr/local/lib/libmcrypt* /usr/lib
[*] ln -s /usr/local/lib/libiconv.* /usr/lib
[*] ln -s /usr/local/lib/libiconv.* /usr/lib64/
[*] yum -y install libxml2-devel curl-devel libpng-devel openldap-devel
[*] cd $path
[*] tar -zxvf php-5.2.6.tar.gz
[*] cd $path/php-5.2.6
[*] ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-iconv-dir=/usr/local --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gd --with-zlib-dir --with-mcrypt=/usr/local/libmcrypt --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
[*] make ZEND_EXTRA_LIBS='-liconv'
[*] make install
[*] ln -s /usr/local/php/bin/php /usr/bin/
[*] cp php.ini-dist /usr/local/php/etc/php.ini
[*] sed -i '170 s/DirectoryIndex/ DirectoryIndex index.php/' /etc/httpd/httpd.conf
[*] sed -i '312a\ AddType application/x-httpd-php .php .phtml \' /etc/httpd/httpd.conf
[*] cd $path
[*] tar -zxvf PDO_MYSQL-1.0.2.tgz
[*] cd PDO_MYSQL-1.0.2
[*] /usr/local/php/bin/phpize
[*] ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
[*] make && make install
[*] sed -i '486 s/extension_dir/ ;extension_dir/' /usr/local/php/etc/php.ini
[*] sed -i '597a extension = "pdo_mysql.so" ' /usr/local/php/etc/php.ini
[*] sed -i 's#;date.timezone.*#date.timezone = "Shanghai/Asia"# '/usr/local/php/etc/php.ini
[*] cp $path/index.php /usr/local/apache2/htdocs/index.php
[*] #/usr/local/apache2/bin/apachectl restart
[*] service httpd restart
[*] service mysqld restart
[*]
想单独下载lamp安装包,地址如下:
http://down.运维网.com/data/596769免豆下载
补充一下:yum源请事先先设置好,直接解压完,执行./install-all.sh就可以了
apache安装目录:/usr/local/apache2
php:/usr/local/php
mysql:/usr/lcoal/mysql
页:
[1]