最近研究cacti,需要先搭个平台,惭愧,搭了三天才搭成功,特作记录。
[root@localhost soft]# uname -a
Linux localhost.localdomain 3.19.8-100.fc20.i686+PAE #1 SMP Tue May 12 17:27:49 UTC 2015 i686 i686 i386 GNU/Linux
1.
安装apache
官网下载: apr-1.5.2.tar.gz ,apr-util-1.5.4.tar.gz ,httpd-2.4.16.tar.gz
apr-1.5.2.tar.gz
tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install
apr-util-1.5.4.tar.gz
tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
httpd-2.4.16.tar.gz
tar -zxvf httpd-2.4.16.tar.gz
cd httpd-2.4.16
./configure --prefix=/usr/local/apache --enable-module=so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install
关闭SELINUX
vi /etc/selinux/config SELINUX=disabled
启动 /usr/local/apache/bin/apachectl start
2.
安装mysql
最初安装的是rpm包,但后续安装PHP时不知怎么制定--with-mysql 选项,顾重新安装二进制版本
官网下载安装包:mysql-5.6.26-linux-glibc2.5-i686.tar.gz
官方安装说明:http://dev.mysql.com/doc/refman/5.6/en/binary-installation.html
yum -y install libaio
*
-
shell> groupadd mysql
-
shell> useradd -r -g mysql mysql
-
shell> cd /usr/local
-
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
-
shell> ln -s full-path-to-mysql-VERSION-OS mysql
-
shell> cd mysql
-
shell> chown -R mysql .
-
shell> chgrp -R mysql .
-
shell> scripts/mysql_install_db --user=mysql
-
shell> chown -R root .
-
shell> chown -R mysql data
-
shell> bin/mysqld_safe --user=mysql &
-
# Next command is optional
-
shell> cp support-files/mysql.server /etc/init.d/mysql.server
安装完毕后,mysqladmin -uroot -p password 'psd' 出错,无法通过此种方式设置新密码。采用另外一种方式:
bin/mysqld_safe shutdown
bin/mysqld_safe --skip-grant-tables&
./mysql
use mysql
update user set password=password('123456') where user='root';
flush privileges;
\q
bin/mysqld_safe shutdown
bin/mysqld_safe --user=mysql &
至此mysql 安装完毕
3.
安装PHP
经检查 zlib, libpng,libiconv,libxml,Fontconfig ,GD都已安装
此部分可以参考 http://www.cnblogs.com/JemBai/archive/2009/04/17/1437700.html
libjpeg :
mkdir -p /usr/local/libjpeg/man/man1
./configure --prefix=/usr/local/libjpeg
--enable-shared --enable-static
make && make install
部分包下载地址:
zlib
libpng
freetype
FontConfig
下载PHP包:php-5.6.12.tar.gz
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-jpeg-dir=/usr/local/libjpeg --enable-sockets
make && make install
cp /usr/local/soft/php-5.6.12/php.ini-production /usr/local/php/lib/php.ini
修改apache httpd.conf
在AddType application/x-gzip .gz .tgz 下添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddHandler php5-script .php
AddType text/html .php
重启apache
apachectl restart
4.
cacti 安装
下载cacti:cacti-0.8.8f.tar.gz
yum -y install rrdtool*
groupadd cacti
useradd -r -g cacti cacti
tar -zxvf cacti-0.8.8f.tar.gz
mv cacti-08.9.8f /usr/local/apache/htdocs/cacti
导入表
mysql -uroot -p
create database cacti
use cacti
source /usr/local/apache/htdocs/cacti/cacti.sql
use mysql
grant all on cacti.* to cacti@localhost identified by 'cacti' 授权cacti 可以在localhost 登陆
flush privileges
\q
修改cacti 目录下include/config.php 数据库连接信息,打开$url_path
将相应的内容依自己设定的进行更改
chown -R cactiuser rra/ log/
crontab -e编辑
*/2 * * * * /usr/local/php/bin/php /usr/local/cacti/poller.php >> /tmp/cactilog 2>&1
然后就可以通过 进行访问了
遇到的问题:
1.最开始安装mysql rpm 包时 ,遇到登陆被拒绝的错误,后来发现在 root 下有个隐藏文件.mysql_secret 记录了安装时随即生成的密码,可以直接通过mysqladmin进行修改
2.安装PHP 时要添加--with-mysql 否则首页空白,其次要添加
--enable-sockets 否则会有下面错误
Error
The following PHP extensions are missing:
Please install those PHP extensions and retry
阅读(1001) | 评论(0) | 转发(0) |