nagios整合cacti2011版(一)

第一章 LAMP基础环境搭建
===============================================================================
基础开发包升级
yum -y install gcc gcc-c++ flex bison autoconf automake \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \
zlib zlib-devel bzip2 bzip2-devel libxml2 libxml2-devel \
glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel \
curl curl-devel libtiff libtiff-devel pam pam-devel libtool libtool-devel \
e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel \
apr-util apr-util-devel gdbm gdbm-devel openssl openssl-devel  libmcrypt libmcrypt-devel libmhash libmhash-devel   libtool-ltdl-devel
-------------------------------------------------------------------------------
libiconv-1.13.1.tar.gz
wget  http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local
make
make install
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/
cd ../
-------------------------------------------------------------------------------
libmcrypt-2.5.8.tar.gz
wget http://vps.googlecode.com/files/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cp /usr/local/lib/libmcrypt.* /usr/lib
cd ../../
-------------------------------------------------------------------------------
mhash-0.9.9.tar.gz
wget http://acelnmp.googlecode.com/files/mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.tar.gz
cd mhash-0.9.9/
./configure
make
make install
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
cd ../
-------------------------------------------------------------------------------
zxvf mcrypt-2.6.8.tar.gz
wget http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
./configure
make
make install
cd ../
-------------------------------------------------------------------------------
cronolog-1.6.2.tar.gz
wget http://vps.googlecode.com/files/cronolog-1.6.2.tar.gz
tar zxvf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configure --prefix=/usr/local/cronolog
make
make install
cd ../
===============================================================================
Install mysql
yum -y remove mysql       //如果有就删除系统自带的数据库
userdel -r mysql
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql -s /sbin/nologin -d /data/mysql mysql
mkdir /data/mysql/data
mkdir /data/mysql/log
chmod -R 755 /data/mysql
chown -R mysql:mysql /data/mysql
wget  http://down1.chinaunix.net/distfiles/mysql-5.0.54.tar.gz
tar zxvf mysql-5.0.54.tar.gz
cd mysql-5.0.54/
./configure \
--prefix=/usr/local/mysql/ \
--enable-assembler \              //Use assembler versions of some string functions if available
--with-extra-charsets=complex \
--enable-thread-safe-client \     //Compile the client without threads
--with-big-tables \               //Support tables with more than 4 G rows even . 32bit platforms
--with-readline \
--with-ssl \
--with-embedded-server \          //Build the embedded server (libmysqld)
--enable-local-infile             //Enable LOAD DATA LOCAL INFILE (default: disabled)
-------------------------------------------------------------------------------
./configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
-------------------------------------------------------------------------------
make
make install
这里要很长时间,请耐心等等.
chown -R mysql:mysql /usr/local/mysql
cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
vi /usr/local/mysql/my.cnf
# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
user            = mysql
basedir         = /usr/local/mysql
datadir         = /data/mysql/data
pid-file        = /data/mysql/ritto.pid
log-error       = /data/mysql/log/ritto-error.log
log-bin         = /data/mysql/log/ritto-bin.bin
log-output = FILE
#skip-federated
#log-bin=mysql-bin
/usr/local/mysql/bin/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf
注意,这里my.cnf拷过来的时候要把用户和组换成mysql:mysql
Chown -R  mysql:mysql   /usr/local/mysql
#Boot Mysql
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &
echo "/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &" >> /etc/rc.d/rc.local
#Stop Mysql
/usr/local/mysql/bin/mysqladmin -uroot -p123456 shutdown
#Change mysql root password
 /usr/local/mysql/bin/mysqladmin -uroot -p password jet*****
/usr/local/mysql/bin/mysql -uroot -e "set password for  root@'localhost'=password('123456');flush  privileges;"
#Set mysql of system services
cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
/etc/rc.d/init.d/mysqld 
startStarting MySQL                                             [确定]
#Set mysql path with system path
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
===============================================================================
Apache 2.2. 17 的安装方法:
不推荐使用MPM的运行方式用在生产环境下,使用prefork MPM
--with-mpm=worker 或 --with-mpm=perchild
yum -y remove httpd
rum -y remove php-common
gd-2.0.35.tar.gz
wget http://google-desktop-for-linux-mirror.googlecode.com/files/gd-2.0.35.tar.gz
tar xvf gd-2.0.35.tar
cd gd
cd 2.0.35
./configure
make
make install
cd ../
httpd-2.2.17.tar.gz
wget http://www.apache.org/dist/httpd/httpd-2.2.17.tar.gz
tar zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
"./configure --prefix=/usr/local/apache2" \
"--enable-so" \           //DSO capability
"--enable-usertrack" \    //user-session tracking
"--enable-ssl" \          //SSL、TLS support(mod_ssl)
"--enable-info" \         //server information
"--enable-cgi" \          //CGI .s
"--enable-static-ab" \    //Build a statically linked version of ab
"--enable-speling" \      //correct common URL misspellings
"--enable-rewrite" \      //rule based URL manipulation
"--enable-deflate" \      //Deflate transfer encoding support
"--enable-mods-shared=all" \   //Space-separated list of shared modules to enable |"all" | "most"
"--enable-cache" \        //dynamic file caching
"--enable-file-cache" \   //File cache
"--enable-mem-cache" \    //memory caching module
"--enable-disk-cache" \   //disk caching module
"--enable-mime-magic" \   //automagically determining MIME type
"--enable-proxy"  \       //Apache proxy module
------------------------------------------------------------------------- ------
./configure --prefix=/usr/local/apache2 --enable-so --enable-usertrack --enable-ssl --enable-info --enable-cgi  --enable-speling --enable-rewrite --enable-deflate --enable-mods-shared=all --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-mime-magic --enable-static-ab --enable-proxy
------------------------------------------------------------------------- ------
make
make install
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local
cd ../
groupadd daemon
/usr/sbin/useradd -g daemon -s /sbin/nologin daemon
chown -R daemon:daemon apache2/
chmod -R 755 apache2
===============================================================================

你可能感兴趣的:(apache,mysql,职场,nagios,休闲)