CentOS 5.4搭建APACHE+PHP+MYSQL平台

依次安装apache,mysql,php,cacti ,rrdtool

1.安装apache
 tar   xzvf   http-2.2.8.tar.gz
 cd   http-2.2.8
./configure --prefix=/usr/local/apache2 --enable-so --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-modules=all --enable-shared=max --enable-rewrite --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --enable-vhost-alias --disable-userdir --with-mpm=worker
# make
# make install
# /usr/local/apache2/bin/apachectl start
# cd /etc/rc3.d
# ln -s /etc/init.d/httpd S85httpd
# ln -s /etc/init.d/httpd K85httpd

2.安装Mysql

引用#cp mysql-5.1.22-rc-linux-i686-icc-glibc23.tar.gz /usr/local/
#cd /usr/local/
#tar -zxvf mysql-5.1.22-rc-linux-i686-icc-glibc23.tar.gz
#ln -s mysql-5.1.22-rc-linux-i686-icc-glibc23 mysql
#cd mysql
#groupadd mysql
#useradd -g mysql mysql
#chown -R mysql .
#chgrp -R mysql .
#scripts/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql data
#bin/mysqld_safe --user=mysql &
#support-files/my-large.cnf /etc/my.cnf
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#servie mysqld restart
#chkconfig --add mysqld
#chkconfig --level 345 mysqld on
#service mysqld restart

 

3.安装基本库
(1)libxml

引用# tar xjvf libxml2-2.6.24.tar.bz2
# cd libxml2-2.6.24
# ./configure --prefix=/usr/local/libxml2
# make
# make install

(2)jpeg6

引用# mkdir /usr/local/jpeg6

引用#tar -zxvf php-5.2.6.tar.gz
#cd php-5.2.6
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd=/usr/local/gd2 --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir=/usr --with-zlib-dir=/usr/local/zlib --enable-gd-native-ttf --with-ttf --enable-gd-jis-conv--enable-xml --enable-mbstring --enable-sockets --enable-soap

6.让apache支持php
# vi /usr/local/apache2/conf/httpd.conf
找到AddType application/x-gzip .gz .tgz
添加

引用AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

找到DirectoryIndex index.html
修改成

引用DirectoryIndex index.html index.php

7.安装 rrdtool

引用#tar -zxvf rrdtool.tar.gz
#cd rrdtool-1.2.23
#./configure --prefix=/usr/local/rrdtool --disable-python --disable-tcl
# make
# make install

8.安装net-snmp

引用#yum -y install net-snmp-*
或者源码编译

引用#tar zxvf net-snmp-5.2.4.tar.gz
#cd net-snmp-5.2.4
#./configure --prefix=/usr/local/net-snmp   --enable-developer
#make
#make install

9.安装Cacti

引用#tar -zxvf cacti-0.8.7b.tar.gz
#cd cacti-0.8.7b
#mv cacti-0.8.7b /usr/local/apache2/htdocs/cacti
#cd /usr/local/apache2/htdocs/cacti/

#vi include/config.php

引用$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipw";

引用#/usr/local/mysql/bin/mysql -uroot -p cactidb < cacti.sql
#useradd cactiuser
#chown -R cactiuser rra
#chgrp -R cactiuser /usr/local/apache/htdocs/cacti/
#crontab -ucactiuser -e

*/5 * * * * /usr/local/php/bin/php /usr/local/apache2/htdocs/cacti/poller.php > /dev/null 2>&1

10.安装cactid

引用#tar -zxvf cacti-cactid-0.8.6g.tar.gz
#cd cacti-cactid-0.8.6g
#./configure --with-mysql=/usr/local/mysql
#make
#make install
#mkdir /usr/local/cactid/
#cp cactid cactid.conf /usr/local/cactid/

# vi   /usr/local/cactid/cactid.conf    

引用DB_Host         127.0.0.1
DB_Database     cactidb
DB_User         cactiuser
DB_Pass         cactipw

11.数据库配置

引用mysql> create database cactidb;
Query OK, 1 row affected (0.00 sec)

引用

mysql> grant all on cactidb.* to cactiuser@localhost identified by “cactipw”;
Query OK, 1 row affected (0.00 sec)

12.完成cacti的安装
输入:http://IP/cacti/
admin/admin
修改密码
更具具体安装路径设置
snmpwalk Binary Path
RRDTool Binary Path等等路径
进入cacti,根据现有模版监控服务器对象
cacti以及rrdtool博大精深,更多信息
请请参阅官方文档
http://www.cacti.net
http://www.rrdtool.org

阅读更多
个人分类: LAMP
想对作者说点什么? 我来说一句

Centos7 搭建apache+mysql+php环境

2018年01月08日 385KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭