linux-6.1
+httpd-2.2.22
+mysql-5.1.62
+php-5.4.0
+rrdtool-1.4.5
+net-snmp-5.5
+cacti-0.8.8a
1.mysql
./configure --prefix=/usr/local/mysql --without-debug --with-extra-charsets2312 --with-assembler --with-pthread --with-client-ldflags --with-mysqld-ldflags
make && make install && echo 'OK'
./scripts/mysql_install_db --user=mysql(执行这步的时候/etc/my.cnf不能存在)
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chmod 750 /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql
设置开机自启动:
chkconfig --add mysqld
chkconfig --level 345 mysqld on
service mysqld restart
设置环境参数:
vi /etc/profile
PATH=$PATH:/usr/local/mysql/bin
账号设置:
mysqladmin -u root password "123"
mysql -u root -p
use mysql
delete from user where password="";删除匿名登录的账号
flush privileges;
exit
2.apache
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-info --enable-cgid --enable-mime-magic
make && make install && echo 'OK'
下面是为了使用service命令方便:
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
添加两行信息,方便开机自启动
vi /etc/init.d/httpd
#chkconfig:345 85 15
#description:Activates/Deactivates Apache Web Server
然后使用下面命令添加开机启动
chkconfig --add httpd
chkconfig --level 345 httpd on
3.php
./configure --prefix=/usr/local/php --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local/libgd --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype --with-zlib=/usr/local/zlib --enable-gd-native-ttf
make && make install && echo 'OK'
手动生成php配置文件
cp php.ini-production /usr/local/php/lib/php.ini
vi /usr/local/apache/conf/httpd.conf
添加支持php格式
DirectoryIndex index.html index.php index.cgi index.shtml index.phtml index.php3
添加应用
AddType application/x-httpd-php .php .php3 .phtml .inc
AddType application/x-httpd-php-source .phps
测试:
4.rrdtool
./configure --prefix=/usr/local/rrdtool
make && make install && echo 'OK'
ln -s /usr/local/rrdtool/bin/* /usr/local/bin
5.net-snmp
使用源码方式安装
net-snmp-utils
net-snmp
net-snmp-devel
net-snmp-libs
如果使用编译方式,当前建议选择5.3.2版本
6.cacti
解压:
tar xvf cacti-0.8.8a.tar.gz
直接把解压文件放到web目录下面
mv cacti-0.8.8a /usr/local/apache/htdocs/cacti
#chown -R apache.apache htdocs
添加主机的cacti用户
useradd cacti
给cacti用户读写数据的权限
chown -R cacti rra log
使用管理员登陆:
mysql -u root -p
创建cacti数据库:
create database cacti;
添加cacti用户:
insert into mysql.user(host,user,password) values('localhost','cacti',password('cacti'));
授权可以访问的内容:
grant all privileges on cacti.* to cacti@'localhost' identified by 'cacti';
立即生效:
flush privileges;
退出:
exit
shell环境导入cacti数据库:
mysql -u cacti -pcacti cacti < cacti.sql
使修改内容生效:
service mysqld restart
测试安装: