背景:
阅读新闻
Linux平台Cacti编译安装
[日期:2011-06-17] 来源:Linux社区 作者:curl [字体:]
系统环境:CentOS 5.X 或 RHEL 5.X
软件准备:
1. Apache2: httpd-2.2.16.tar.gz 下载地址:
2. MySQL5: mysql-5.1.50.tar.gz 下载地址:
3.PHP5: php-5.3.3.tar.gz 下载地址:
4.RRDTool: rrdtool-1.4.4.tar.gz 下载地址:
5. NET-SNMP:net-snmp-5.5.tar.gz 下载地址:
6.CACTI: cacti-0.8.7g.tar.gz 下载地址:
安装流程
A 安装 Apache:
确认已安装GCC,否则按提示安装一下源盘中都有过程有点麻烦这边省略
查看是否已装:
[]# rpm -qa| grep httpd
[]# rpm -qa| grep httpd
编译安装:
拷贝httpd-2.2.16.tar.gz至/usr/local/src
[]#cp httpd-2.2.16.tar.gz /usr/local/src
[]#cd /usr/local/src
[]#chmod 755 httpd-2.2.16.tar.gz
[]#tar -zxvf httpd-2.2.16.tar.gz
[]#cd httpd-2.2.16
[]#./configure --prefix=/usr/local/webs/apache22 --enable-modules=so
[]#make
[]#make install
以下安装为服务:
[]#cp /usr/local/webs/apache22/bin/apachectl /etc/rc.d/init.d/httpd
添加chkconfig 支持
[]#vi /etc/rc.d/init.d/httpd
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server
:wq
[]#chkconfig --add httpd
B 安装MySql:
查看是否已运行或安装:
[]# netstat –nat (看看3306的端口是否被占用)
[]# mysql –V(提示错误则未装)
查看并建立mysql用户
查看:
[]# grep "^mysql:" /etc/passwd –i
或者
[]# id mysql
不存在则:
[]# groupadd mysql
[]# useradd –g mysql mysql
编译安装:
拷贝mysql-5.1.50.tar.gz至/usr/local/src
[]#cp mysql-5.1.50.tar.gz /usr/local/src
[]#cd /usr/local/src
[]#chmod 755 mysql-5.1.50.tar.gz
[]#tar -zxvf mysql-5.1.50.tar.gz
[]#cd mysql-5.1.50
[]#./configure --prefix=/usr/local/mysql
[]#make
[]# mkdir /usr/local/mysql
[]# chown mysql /usr/local/mysql /usr/local/mysql/var
[]# chgrp mysql /usr/local/mysql /usr/local/mysql/var
[]#su mysql
[]#make install
[]#scripts/mysql_install_db
以下安装环境支持:
[]#rm -f /etc/my.cnf
[]#cp support-files/my-medium.cnf /etc/my.cnf
[]#echo /usr/local/mysql/lib/mysql >> /etc/ld.so.conf
[]#echo /usr/local/lib >> /etc/ld.so.conf
[]#ldconfig –v /**生效**/
以下安装为服务:
[]#cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysql
[]#chkconfig --add mysql
测试运行:
[]#/usr/local/mysql/bin/mysqld_safe &
修改root密码:
[]#/usr/local/mysql/bin/mysqladmin -u root password mydbpassword
C 安装PHP5
查看PHP版本
[]# php –v
已装旧版本则删除掉,未装则
编译安装:
拷贝php-5.3.3.tar.gz至/usr/local/src
[]#cp php-5.3.3.tar.gz /usr/local/src
[]#cd /usr/local/src
[]#tar -zxvf php-5.3.3.tar.gz
[]#cd php-5.3.3
[]#./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-apxs2=/usr/local/webs/apache22/bin/apxs --with-mysql=/usr/local/mysql --enable-sockets --with-zlib-dir=/usr/include --with-gd
[]#make && make install
[]#cp php.ini-dist /usr/local/php/php.ini
[]#cp php.ini-development /usr/local/php/php.ini /***php-5.3以上版本*/