centos6.2下cacti详细安装过程
2013-08-07 08:28
423 查看
本文中的apache,php和mysql都是编译安装的,使用的都是最新的稳定版本,首先来看下它们的编译安装过程。进行以下准备工作建立以下目录:
在浏览器输入 http://serverip/cacti 默认用户名:admin 密码:admin
[bash]#mkdir /usr/local/lamp #存放所有编译的程序 [bash]#mkdir /usr/local/lamp/etc #存放配置文件 [bash]#mkdir /usr/local/lamp/apache24 #apache安装目录 [bash]#mkdir /usr/local/lamp/mysql #mysql安装目录 [bash]#mkdir /usr/local/lamp/php #php安装目录 [bash]#groupadd -g 150 mysql设定mysql用户和安装目录权限
[bash]#useradd -u 150 -g mysql -d /usr/local/lamp/mysql -M mysql #mysql用户 [bash]#ls /usr/local/lamp/mysql/ -l [bash]#chown -R mysql.root /usr/local/lamp/mysql #改变安装目录用户所有权 [bash]#chmod 775 /usr/local/lamp/mysql #改变目录的读写权限 [bash]#mkdir /usr/local/lamp/database #存放mysql数据库 [bash]#chown -R mysql.root /usr/local/lamp/database/ [bash]#chmod -R 775 /usr/local/lamp/database/1、安装apache到搜狐开原镜像网站下载apache2.4最新版本
[bash]#wget http://mirrors.sohu.com/apache/httpd-2.4.1.tar.gz解压缩
[bash]#tar zxvf httpd-2.4.1.tar.gz [bash]#cd httpd-2.4.1进行编译前的配置:
[bash]#./configure --prefix=/usr/local/lamp/apache24 --sysconfdir=/usr/local/lamp/etc --with-included-apr --enable-so --enable-deflate --enable-expires --enable-rewrite --enable-static-support --enable-mods-shared=most --enable-speling --enable-forward --enable-ssl --with-ssl --enable-cache-disk编译
[bash]#make安装
[bash]#make install如果出现: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.则需要下载apr和apr-utils 并解压到./srclib/, 再进行编译
[bash]#wget http://apache.etoak.com//apr/apr-util-1.4.1.tar.gz [bash]#wget http://apache.etoak.com//apr/apr-1.4.6.tar.gz [bash]#tar zxvf apr-1.4.6.tar.gz [bash]#tar zxvf apr-utli-1.4.1.tar.gz [bash]#cp -rf apr-1.4.6 httpd-2.4.1/srclib/apr [bash]#cp -rf apr-util-1.4.6 httpd-2.4.1/srclib/apr-util测试服务是否安装成功
[bash]#/usr/local/lamp/apache24/bin/apachectl start打开浏览器,输入http://YOURIP如果返回It works说明apache安装成功了,2、安装mysql5.5.21不知道为什么最近sohu和163的开源镜像站上都没有mysql的下载地址了,只好在官网注册个账号下载了下载mysql-community-server-5.5.21.tar.gz源码首先需要安装以下程序和开发库
[bash]#yum –y install gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool*然后解压源码包
[bash]#tar zxvf mysql-5.5.21.tar.gz [bash]#cd mysql-5.5.21先对安装包进行清理
[bash]#make clean [bash]#rm –rf CMakeCache.txt使用cmake编译mysql (cmake编译mysql的选项参见mysql编译configure向cmake过渡指南)配置编译选项:
[bash]#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lamp/mysql -DSYSCONFDIR=/usr/local/lamp/etc -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/lamp/database -DMYSQL_USER=mysql -DWITH_DEBUG=0编译安装:
[bash]#make [bash]#make install复制配置文件
[bash]# cp ./support_files/my-medium.cnf ../etc/my.cnf#设置mysql服务
[bash]#cp /usr/local/lamp/mysql/support-files/mysql.server /etc/init.d/mysql [bash]#chmod 755 /etc/init.d/mysql [bash]#chkconfig mysql on#安装默认数据库
[bash]#/usr/local/lamp/mysql/scripts/mysql_install_db --basedir=/usr/local/lamp/mysql --datadir=/usr/local/lamp/database --skip-name-resolve --user=mysql#启动MySQL服务器
[bash]#service mysqd start设置mysql的rootyonghu密码
[bash]#mysqladmin -uroot password "password"设定mysql的环境变量,我用连接的方式设定的
[bash]#ln -s /usr/local/lamp/mysql/bin/mysql /usr/local/3、安装php安装一些开发库安装libjpeg-devel,net-snmp,net-snmp-devel,net-snmp-utils gmp gmp-devel
[bash]#yum install libjpeg-devel,net-snmp,net-snmp-devel,net-snmp-utils gmp gmp-devel下载php的最新稳定版本源码
[bash]#wget http://mirrors.sohu.com/php/php-5.3.6.tar.gz [bash]#tar zxvf php-5.3.6.tar.gz [bash]#cd php-5.3.6配置编译选项
[bash]#./configure --prefix=/usr/local/lamp/php --with-apxs2=/usr/local/lamp/apache24/bin/apxs --with-mysql=/usr/local/lamp/mysql --with-mysqli=/usr/local/lamp/mysql/bin/mysql_config --build=i386-redhat-linux-gnu --host=i386-redhat-linux-gnu --target=i686-redhat-linux-gnu --with-pdo-mysql=/usr/local/lamp/mysql --with-libxml-dir --enable-xml --with-gd --with-jpeg-dir --with-png-dir --with-bz2 --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-snmp --enable-inline-optimization --disable-debug --sysconfdir=/usr/local/lamp/etc --cache-file=../config.cache --with-libdir=lib --with-config-file-path=/usr/local/lamp/etc --with-pic --disable-rpath --without-gdbm --with-gettext --with-gmp --with-iconv --with-pcre-regex --with-zlib --with-layout=GNU --enable-magic-quotes编译安装:
[bash]#make [bash]#make install编辑/usr/local/lamp/etc/httpd.conf1、把这两行
[bash]#cp php.ini-recommended /usr/local/lamp/php/etc/php.ini
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps添加到
AddType application/x-compress .Z AddType application/x-gzip .gz .tgz之后2、修改
DirectoryIndex index.html为
DirectoryIndex index.html index.php重启apache,并写一个phpinfo脚本测试下php的安装这样基础的三大件就安装完成了,接下来安装cacti需要的一些组件:rrdtool 、 spine等4、安装rrdtool下载rrdtool
[bash]#wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz [bash]#tar zxvf rrdtool-1.4.7.tar.gz [bash]#cd rrdtool进行编译安装:
[bash]#./configure --prefix= /usr/local/lamp/rrdtool [bash]#Make [bash]#Make install [bash]#ln -s /usr/local/lamp/rrdtool/bin/* /usr/local/bin/ //完成后建立符号连接 [bash]#rrdtool -v //查看rrdtool版本,测试rrdtool是否安装成功,如果安装成功就可以安装cacti了5、安装配置cacti下载安装cacti
[bash]#tar -zxvf cacti-0.8.7i.tar.gz [bash]#mv –r cacti-0.8.7i /usr/local/lamp/apache24/htdocs/cacti初始化cacti数据库
[bash]#cd /usr/local/lamp/apache24/htdocs/cacti [bash]#mysql -uroot -p //登录mysql 配置cacti数据库 mysql>create database cacti; mysql>grant all on cacti.* to cacti@localhost identified by "cacti"; mysql>exit [bash]#mysql -uroot -p cacti < /var/www/html/cacti/cacti.sql //导入cacti数据库初始化脚本配置cacti的数据库连接
[bash]#vim include/config.php $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "cacti"; $database_port = "3306"; [bash]#vim include/globel.php $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "cacti"; $database_port = "3306";配置snmp轮询
[bash]#useradd cacti //添加cacti用户 [bash]#chown -R cacti rra //将rra目录的所有权给cacti用户 [bash]#chgrp -R cacti . //修改cacti目录所属组 [bash]#su cacti //为cacti用户添加cron任务 [bash]#crontab -e //编辑定时任务 */5 * * * * /usr/local/lamp/bin/php /usr/local/lamp/apache24/htdocs/cacti/poller.php > /dev/null 2>&1 # /usr/local/bin/php /usr/local/lamp/apache24/htdocs/cacti/poller.php正确输出类似于下面内容:
OK u:0.01 s:0.02 r:21.42 OK u:0.01 s:0.02 r:21.42 OK u:0.01 s:0.02 r:21.42 OK u:0.01 s:0.02 r:21.42 10/21/2008 015:20:31 PM - SYSTEM STATS: Time:3.5831 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:7 DataSources:401 RRDsProcessed:2206、测试cacti
在浏览器输入 http://serverip/cacti 默认用户名:admin 密码:admin
snmpwalk Binary Path /usr/local/bin/snmpwalk snmpget Binary Path /usr/local/bin/snmpget snmpbulkwalk Binary Path /usr/local/bin/snmpbulkwalk snmpgetnext Binary Path /usr/local/bin/snmpgetnext RRDTool Binary Path /usr/local/bin/rrdtool RRDTool Default Font Path PHP Binary Path /usr/local/lamp/php/bin/php Cacti Log File Path /usr/local/lamp/apache24/htdocs/cacti/log/cacti.log至此cacti整个的安装过程就完成了,后续的使用和调试,我会陆续发表出来。
相关文章推荐
- CentOS 6.2编译安装Apache2.4.1+MySQL5.5.21+PHP5.3.10详细过程
- CentOS7.2系统环境中安装saltstack详细配置过程讲解
- 在Linux(CentOS)中安装was8.5的详细过程
- CentOS 安装VNC 5 详细过程
- CentOS下独立SVN服务器的安装与配置详细过程
- Win7安装64位CentOS 6.4双系统详细过程
- CentOS 7.2 安装MariaDB详细过程
- CentOS6.5下Cacti安装过程
- centos6.5_x86_64 下安装 Oracle11gR2 的详细过程
- CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin详细过程
- CentOS下安装QT详细过程以及错误处理
- Centos7.0 安装Redis 3.2.1详细过程和使用常见问题
- [cacti监控] centos6.2下安装cacti监控
- CentOS下独立SVN服务器的安装与配置详细过程
- Linux系统CentOS6.2版本下安装JDK7详细过程
- CentOS6.0/RedHat Server 6.4安装配置过程 详细图解!
- CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin详细过程
- centos安装配置hadoop超详细过程
- Win7安装64位CentOS 6.4双系统详细过程
- CentOS安装Hadoop2.7.2详细过程