centos6.3 安装cacti完整实录

1. 安装必要的工具
yum install -y wget gcc gcc-c++ autoconf make zlib zlib-devel openssl openssl-devel cmake ncurses ncurses-devel bison libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gd gd-devel net-snmp* rrdtool rrdtool-devel


2. 下载必要的安装包
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz
wget http://nginx.org/download/nginx-1.3.11.tar.gz
wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.29.tar.gz
wget http://cn2.php.net/distributions/php-5.4.10.tar.gz
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz


3. 安装NGINX
groupadd www
useradd -g www www
tar zxf pcre-8.32.tar.gz
cd pcre-8.32
./configure
make && make install
cd ../
ln -s /usr/local/lib/libpcre.so.1 /usr/lib/
tar zxf nginx-1.3.11.tar.gz
cd nginx-1.3.11
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../

4. 安装MYSQL
groupadd mysql
useradd -g mysql mysql
tar zxf mysql-5.5.29.tar.gz
cd mysql-5.5.29
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/webserver/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/webserver/mysql/logs -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1
make && make install
cd ../
chown -R mysql:mysql /usr/local/webserver/mysql/
/usr/local/webserver/mysql/scripts/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data/ --user=mysql


5. 安装PHP
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure
make && make install
cd ../
tar zxf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make && make install
cd ../
tar zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
make && make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install
cd ../../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.7 /usr/lib/libmcrypt.so.4.4.7
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
tar zxf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
/sbin/ldconfig
./configure
make && make install
cd ../
tar zxf php-5.4.10.tar.gz
cd php-5.4.10
./configure --prefix=/usr/local/webserver/php --with-mysql=/usr/local/webserver/mysql --with-pdo-mysql=/usr/local/webserver/mysql --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-libxml-dir --with-openssl --with-kerberos --with-pcre-regex --with-zlib --with-curl --with-snmp --enable-soap --enable-sockets --enable-pcntl --enable-mbstring --with-ldap --with-ldap-sasl  --with-freetype-dir --with-jpeg-dir --with-png-dir --with-mhash --with-mcrypt --with-gd --enable-bcmath --enable-shmop --enable-inline-optimization --enable-zip
make ZEND_EXTRA_LIBS='-liconv'
make install
cd ../

6. 安装CACTI
tar zxf cacti-0.8.8a.tar.gz
cd cacti-0.8.8a
/usr/local/webserver/mysql/bin/mysqladmin --user=root create cacti
/usr/local/webserver/mysql/bin/mysql -uroot cacti < cacti.sql
echo "grant all privileges on cacti.* to cacti@localhost identified by 'cacti';"|/usr/local/webserver/mysql/bin/mysql
echo "flush privileges;"|/usr/local/webserver/mysql/bin/mysql

Edit include/config.php and specify the database type, name, host, user and password for your Cacti configuration.
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";

cd ../
mv cacti-0.8.8a /usr/local/webserver/nginx/html/cacti
chown -R www:www /usr/local/webserver/nginx/html/cacti

 Add a line to your /etc/crontab file similar to:
*/5 * * * * www /usr/local/webserver/php/bin/php /usr/local/webserver/nginx/html/cacti/poller.php > /dev/null 2>&1

你可能感兴趣的:(linux,cacti,centos6.3,LNMP)