Chinaunix首页 | 论坛 | 博客
  • 博客访问: 67786
  • 博文数量: 20
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 240
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-07 15:19
文章分类
文章存档

2009年(3)

2008年(17)

我的朋友

分类: LINUX

2008-11-07 16:10:39

结合了网上与自己的实践总结出来。 
     
      apache2.2.8+mysql5.0.51+php5.2.5+snmp5.14(详细说明)+rrdtool+cacti 配置
 
-----------------------------------------------------------------------------------
 
安装mysql
cd /usr/local/src
tar zxvf mysql-max-4.0.27-pc-linux-gnu-i686-glibc23.tar.gz
mv mysql-max-4.0.27-pc-linux-gnu-i686-glibc23 /usr/local/mysql
groupadd mysql ; useradd -g mysql mysql
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .
/usr/local/mysql/bin/mysqld_safe --user=mysql &
./bin/mysqladmin -uroot password mysql
cp ../mysql-5.0.51/support-files/my-large.cnf /etc/my.cnf
cp ../mysql-5.0.51/support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level mysqld 345 on
chkconfig --list mysqld
 
-----------------------------------------------------------------------------------
 
安装apache
cd /usr/local/src
tar zxfv httpd-2.0.59.tar.gz
cd httpd-2.0.59
./configure --prefix=/usr/local/apache --with-mpm=prefork --enable-so --enable-modules=all
make;make install
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
cd /etc/rc3.d
ln -s /etc/init.d/httpd S85httpd
ln -s /etc/init.d/httpd K85httpd
/usr/local/apache/bin/apachectl start

-----------------------------------------------------------------------------------
 
安装PHP
安装支持图形处理,自己可以找最新的安装。
##### zlib#####
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install
cd ..
##### FreeType ##### freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype
make
make install
cd ..

##### LibPNG #####
cd libpng-1.2.20
cp scripts/makefile.linux makefile
make test
make install
cd ..

##### Jpeg ##### jpegsrc.v6b.tar.gz
cd jpeg-6b
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install
cd ..
##### gd ##### gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd \
--with-jpeg=/usr/local/jpeg \
--with-freetype=/usr/local/freetype \
--with-png \
--with-zlib
make
make install
注:libart-2.0,libpng,freetype2(安装时就./configure)
然后ln -s /usr/local/include/libart-2.0 /usr/include/libart-2.0
ln -s /usr/local/include/freetype2 /usr/include/freetype2

安装PHP
tar -zxvf php-5.2.5.tar.gz
cd php-5.2.5
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-
mysql=/usr/local/mysql --with-config-file-path=/usr/local/php/etc --with-openssl --with-gd=/usr/local/gd --
with-gdbm=/usr/lib --with-freetype-dir=/usr/local/freetype  --with-jpeg-dir=/usr/local/jpeg --with-png-dir --with-
zlib=/usr/local/zlib --enable-mbstring --enable-sockets
make;make install
cp php.ini-dist /usr/local/php/etc/php.ini
vi /usr/local/apache/conf/httpd.conf
添加       AddType application/x-tar .tgz
           AddType application/x-httpd-php .php
           AddType image/x-icon .ico
           DirectoryIndex index.php index.html index.html.var
/usr/local/apache/bin/apachectl restart
 
-----------------------------------------------------------------------------------
 
设置mysql
/usr/local/mysql/bin/mysql -u root -pmysql
      mysql> create database cactidb;
  mysql> grant all on cactidb.* to root;
  mysql> grant all on cactidb.* to ;
  mysql> grant all on cactidb.* to cactiuser;
  mysql> grant all on cactidb.* to ;
  mysql> set password for );
注:以上语句输出 Query OK, 0 rows affected (0.01 sec) 表示成功
  mysql> exit
 
-----------------------------------------------------------------------------------
 
检测apache + php + mysql
cd (apache目录)
touch info.php
vi info.php
                        phpinfo( );
            ?>
保存退出 :wq
[root @tsai htdocs]# touch mydqltest.html
[root @tsai htdocs]# vi mysqltest.html
     
        
                           $link=mysql_connect('localhost','root');
                mysql_select_db('mysql');
               $str="select * from user;";
               $result=mysql_query($str,$link);
               $show=mysql_num_rows($result);
               mysql_close($link);
               for ($i=0;$i < $show;$i++)
                   {
                 $arr[$i]=mysql_fetch_array($result);
                   };
            ?>

         
            
            
            
         
    
         
           
           
           
        
            
         
      
保存退出 :wq

重启mysql + apache 服务
service mydql restart
service httpd restart
进入浏览器检查 
http://服务器IP/info.php 和 http://服务器IP/mysqltest.html
 
-----------------------------------------------------------------------------------
 
安装rrdtool
tar zxvf rrdtool-1.0.50.tar.gz
cd rrdtool-1.0.50
./configure
make && make install
 
-----------------------------------------------------------------------------------
 
安装net-snmp的rpm
net-snmp-libs-5.3.1-24.el5
net-snmp-utils-5.3.1-24.el5
net-snmp-5.3.1-24.el5
vi /etc/snmp/snmpd.conf
更改 1、com2sec notConfigUser  default       public
       改为:com2sec notConfigUser   127.0.0.1       public
       2、access  notConfigGroup ""      any       noauth    exact  systemview  none none
       改为:access  notConfigGroup ""      any       noauth    exact  all  none  none
       3、#view all    included  .1         80
       将前面的 # 注释 去掉。
service snmpd restart
 
-----------------------------------------------------------------------------------
 
安装/ 配置cacti
useradd cactiuser -g users
passwd cactiuser (pwd:cactipw)
cp cacti-0.8.7.tar.gz /apache目录
cd /apache目录
tar -zxvf cacti-0.8.7.tar.gz
mv cacti-0.8.6g cacti
cd cacti
/usr/local/mysql/bin/mysql -u root -p cactidb < cacti.sql
passwork:
chown -R cactiuser rra/ log/
cd scripts
chown cactiuser:users *
vi /apache目录/cacti/include/config.php
$database_type = “mysql”;
$database_default = “cactidb”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “cactipw”;
更改用户、密码 等项 与上面给出的对应 保存退出
crontab -u cactiuser -e 
加入
*/5 * * * * /usr/local/php/bin/php /apache目录/cacti/poller.php > /dev/null 2>&1
 
-----------------------------------------------------------------------------------
 
全部设置完毕。
打开浏览器 http://服务器IP/cacti 进入cacti的初始设置页面
第一次默认登陆账号:admin 密码 admin
登陆后在新改个密码就OK
需要说明的还有路径
/usr/bin/snmpwalk
/usr/bin/snmpget
/usr/bin/snmpbulkwalk
/usr/bin/snmpgetnext
/usr/local/rrdtool-1.2.23/bin/rrdtool
/www/cacti/log/cacti.log
/usr/local/php/bin/php
注:此时graphs还不能显示图形,需要将服务重新启动一下
service snmpd restart
service mysql restart
service httpd restart
 
-----------------------------------------------------------------------------------
 
注:添加新设备或者服务器后,一定要生成次图像后过段时间才会显示up
阅读(1961) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
Host User Password