Chinaunix首页 | 论坛 | 博客
  • 博客访问: 42595
  • 博文数量: 15
  • 博客积分: 350
  • 博客等级: 一等列兵
  • 技术积分: 180
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-12 20:37
文章分类

全部博文(15)

文章存档

2011年(15)

我的朋友

分类: LINUX

2011-06-08 13:17:10

1、测试Apachephp

[root@localhost tmp]# service httpd start

启动 httpd

[root@localhost tmp]# cd /var/www/html/

[root@localhost html]# vi test.php

 

"test.php" [New] 5L, 42C written

[root@localhost html]# cat test.php

//php

   

     Phpinfo();

    ?> 

 

[root@localhost html]# service httpd restart

停止 httpd[确定]

启动 httpd[确定]

 

2、配置MySQL

[root@localhost html]# whereis mysql_install_db

mysql_install_db: /usr/bin/mysql_install_db /usr/share/man/man1/mysql_install_db.1.gz

[root@localhost html]# cd /usr/bin/

[root@localhost bin]# ./mysql_install_db

Installing MySQL system tables...

OK

Filling help tables...

OK

 

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

See the manual for more instructions.

You can start the MySQL daemon with:

cd /usr ; /usr/bin/mysqld_safe &

 

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

 

Please report any problems with the /usr/bin/mysqlbug script!

 

The latest information about MySQL is available on the web at

Support MySQL by buying support/licenses at

[root@localhost bin]# mysqld_safe --user=mysql &

[1] 9730

[root@localhost bin]# Starting mysqld daemon with databases from /var/lib/mysql

 

[root@localhost bin]# jobs

[1]+  Running                 mysqld_safe --user=mysql &

 

[root@ localhost bin]# netstat -nat

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address               Foreign Address             State     

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN     

 

[root@localhost bin]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.0.45 Source distribution

 

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

+--------------------+

3 rows in set (0.00 sec)

 

mysql> create database cacti;

Query OK, 1 row affected (0.01 sec)

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| cacti              |

| mysql              |

| test               |

+--------------------+

4 rows in set (0.01 sec)

 

mysql> exit

Bye

[root@localhost bin]# mysql -p cacti

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.0.45 Source distribution

 

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 

mysql> show tables;

Empty set (0.00 sec)

 

mysql> exit

Bye

[root@localhost bin]# mysql -p cacti

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.0.45 Source distribution

 

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 

mysql> grant all on cacti.* to cactiuser@localhost identified by "tyydcacti";

Query OK, 0 rows affected (0.00 sec)

 

mysql> grant all privileges on cacti.* to cactiuser@"localhost" Identified by "tyydcacti";

Query OK, 0 rows affected (0.00 sec)

 

mysql> grant select,insert,update,delete,create,alter,drop,index on *.* to cactiuser@"localhost" Identified by "tyydcacti";

Query OK, 0 rows affected (0.00 sec)

mysql> exit

Bye

 

3、安装spine

[root@localhost tmp]# cd cacti-spine-0.8.7g

[root@localhost cacti-spine-0.8.7g]# ./configure

 

[root@localhost cacti-spine-0.8.7g]# make

 

[root@localhost cacti-spine-0.8.7g]# make install

 

root@localhost cacti-spine-0.8.7e]# whereis spine

spine: /usr/local/spine

[root@localhost cacti-spine-0.8.7e]# cd /usr/local/spine/

[root@localhost etc]# cp spine.conf spine.conf.bak

[root@localhost etc]# ll

total 16

-rw-r--r--  1 root root 2459 Sep 17 08:31 spine.conf

-rw-r--r--  1 root root 2459 Sep 17 08:33 spine.conf.bak

[root@localhost etc]# vi spine.conf

 

DB_Host         localhost

DB_Database     cacti

DB_User         cactiuser

DB_Pass         tyydcacti

DB_Port         3306

 

 

4、安装rrdtool

[root@localhost cacti_soft]# ll

total 4000

-rw-r--r--  1 root root  2232297 Sep 16 12:49 cacti-0.8.7e.tar.gz

drwxr-xr-x  6 1000 users    4096 Sep 17 08:31 cacti-spine-0.8.7e

-rw-r--r--  1 root root   782735 Sep 16 12:49 cacti-spine-0.8.7e.tar.gz

-rw-r--r--  1 root root  1043064 Sep 16 12:50 rrdtool-1.2.15.tar.gz

[root@localhost cacti_soft]# tar -zxvf rrdtool-1.2.15.tar.gz

[root@localhost rrdtool-1.2.15]#./configure

[root@localhost rrdtool-1.2.15]# make

[root@localhost rrdtool-1.2.15]# make install

 

5、安装cacti

[root@localhost cacti_soft]# tar -zxvf cacti-0.8.7e.tar.gz

 

[root@localhost cacti_soft]# ll

drwxr-xr-x  12 1000 users    4096 Jun 29  2009 cacti-0.8.7e

-rw-r--r--   1 root root  2232297 Sep 16 12:49 cacti-0.8.7e.tar.gz

[root@localhost cacti_soft]# mv cacti-0.8.7e /var/www/html/cacti

[root@localhost cacti_soft]# cd /var/www/html/cacti/

 

[root@localhost html]# ll

total 16

drwxr-xr-x  12 root root 4096 Jun 29  2009 cacti

-rw-r--r--   1 root root   47 Sep 16 12:54 test.php

[root@localhost html]# cd cacti/

 

[root@localhost html]# useradd cactiuser

[root@localhost html]# groupadd cactiuser

groupadd: group cactiuser exists

[root@localhost html]# more /etc/passwd

 

cactiuser:x:892:892::/home/cactiuser:/bin/bash

[root@localhost html]# more /etc/group

 

cactiuser:x:892:

 

[root@localhost cacti]# usermod -g cactiuser cactiuser

[root@localhost cacti]# more /etc/group

 

cactiuser:x:892:cactiuser

 

[root@localhost html]# chown -R cactiuser:cactiuser cacti

 

[root@localhost cacti]# chgrp -R cactiuser rra/ log/

 

[root@localhost include]# cp config.php config.php.bak

 

[root@localhost include]# vi config.php

 

 

/* make sure these values refect your actual database/host/user/password */

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "cactiuser";

$database_port = "3306";

 

[root@localhost cacti]# mysql -u root -p cacti < cacti.sql

Enter password:

[root@localhost cacti]# mysql -u root -p cacti

Enter password:

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 36

Server version: 5.0.45 Source distribution

 

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 

mysql> show tables;

+---------------------------+

| Tables_in_cacti           |

+---------------------------+

| cdef                      |

| cdef_items                |

| colors                    |

| data_input                |

| data_input_data           |

| data_input_fields         |

| data_local                |

| data_template             |

| data_template_data        |

| data_template_data_rra    |

| data_template_rrd         |

| graph_local               |

| graph_template_input      |

| graph_template_input_defs |

| graph_templates           |

| graph_templates_gprint    |

| graph_templates_graph     |

| graph_templates_item      |

| graph_tree                |

| graph_tree_items          |

| host                      |

| host_graph                |

| host_snmp_cache           |

| host_snmp_query           |

| host_template             |

| host_template_graph       |

| host_template_snmp_query  |

| poller                    |

| poller_command            |

| poller_item               |

| poller_output             |

| poller_reindex            |

| poller_time               |

| rra                       |

| rra_cf                    |

| settings                  |

| settings_graphs           |

| settings_tree             |

| snmp_query                |

| snmp_query_graph          |

| snmp_query_graph_rrd      |

| snmp_query_graph_rrd_sv   |

| snmp_query_graph_sv       |

| user_auth                 |

| user_auth_perms           |

| user_auth_realm           |

| user_log                  |

| version                   |

+---------------------------+

48 rows in set (0.01 sec)

 

mysql> exit

Bye

 

6、配置crontab

 

[root@localhost bin]# crontab -l

*/1 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

 

 

7、安装cacti-plugin

 

[root@localhost ceshi]# unzip cacti-plugin-0.8.7e-PA-v2.5.zip -d cacti-plugin-0.8.7e-PA

 

[root@localhost ceshi]# cd cacti-plugin-0.8.7e-PA

 

[root@localhost cacti-plugin-0.8.7e-PA]# ll

总计 124

-rw-rw-rw- 1 root root 92973 2009-07-10 cacti-plugin-0.8.7e-PA-v2.5.diff

drwxr-xr-x 5 root root  4096 10-09 00:42 files-0.8.7e

-rw-rw-rw- 1 root root 15237 2006-11-09 LICENSE

-rw-rw-rw- 1 root root  2037 2007-11-05 pa.sql

-rw-rw-rw- 1 root root  1259 2009-06-28 Readme.txt

[root@localhost cacti-plugin-0.8.7e-PA]# mysql -u root cacti < pa.sql

[root@localhost cacti-plugin-0.8.7e-PA]# cp cacti-plugin-0.8.7e-PA-v2.5.diff /var/www/html/cacti/

[root@localhost cacti-plugin-0.8.7e-PA]# cat Readme.txt

 

    Drop the patch into your cacti directory, and then use this command on unix

    to patch your cacti files.

   

    patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.5.diff

   

    Edit your includes/global.php and add a plugin to the $plugins list

 

    Then you will need to import the pa.sql file into your mysql database.

 

[root@localhost cacti-plugin-0.8.7e-PA]# cd /var/www/html/cacti/

[root@localhost cacti]# patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.5.diff

 

 

[root@localhost cacti]# cd include/

 

[root@localhost include]# vi global.php

 

 

/* Default database settings*/

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "123456";

$database_port = "3306";

 

 

$config['url_path'] = '/cacti/';

 

 

8、安装settings

 

[root@localhost ceshi]# tar -zxvf settings-0.5.tar.gz

[root@localhost ceshi]# mv settings /var/www/html/cacti/plugins

[root@localhost include]# vi global.php

$plugins = array();

$plugins[] = 'settings';

 

9、安装monitor

 

[root@localhost ceshi]# unzip monitor-0.8.2.zip

[root@localhost ceshi]# mv monitor /var/www/html/cacti/plugins

[root@localhost include]# vi global.php

$plugins = array();

$plugins[] = 'monitor';

 

10、安装thold

[root@localhost ceshi]# tar -zxvf thold-0.4.2.tar

[root@localhost ceshi]# mv thold /var/www/html/cacti/plugins

[root@localhost thold]# mysql -u root cacti < thold.sql

[root@localhost include]# vi global.php

$plugins = array();

$plugins[] = ' thold ';

 

11、安装weathermap

 

[root@localhost ceshi]# unzip php-weathermap-0.96.zip

 

[root@localhost ceshi]# mv weathermap/ /var/www/html/cacti/plugins

 

[root@localhost ceshi]# cd /var/www/html/cacti

 

[root@localhost cacti]# cd plugins

[root@localhost plugins]# ll

总计 12

-rw-r--r-- 1 root root   44 10-09 00:43 index.php

drwxr-xr-x 3 root root 4096 10-09 00:45 settings

drwxr-xr-x 9 root root 4096 10-09 00:45 weathermap

 

[root@localhost plugins]# cd weathermap/

[root@localhost weathermap]# ll

总计 628

-rw-r--r-- 1 root root  14314 2008-11-30 cacti-pick.php

-rw-r--r-- 1 root root  27547 2009-04-12 CHANGES

-rw-r--r-- 1 root root   1618 2008-09-22 check-gdbug.php

-rw-r--r-- 1 root root  12963 2008-09-15 check.php

drwxr-xr-x 2 root root   4096 2009-04-19 configs

-rw-r--r-- 1 root root  18011 2008-03-20 COPYING

drwxr-xr-x 5 root root   4096 2009-04-19 docs

-rw-r--r-- 1 root root   1095 2008-03-20 editor-config.php-dist

-rwxr-xr-x 1 root root   5022 2008-11-30 editor.css

-rwxr-xr-x 1 root root  10205 2009-04-19 editor.inc.php

-rwxr-xr-x 1 root root  25133 2008-12-12 editor.js

-rwxr-xr-x 1 root root  46805 2009-04-12 editor.php

drwxr-xr-x 2 root root   4096 2009-04-19 editor-resources

-rw-r--r-- 1 root root   9872 2008-12-12 HTML_ImageMap.class.php

drwxr-xr-x 2 root root   4096 2009-04-19 images

-rw-r--r-- 1 root root     62 2008-03-20 index.php

drwxr-xr-x 5 root root   4096 2009-04-19 lib

-rw-r--r-- 1 root root     65 2008-03-20 logout.php

-rw-r--r-- 1 root root     38 2008-03-20 net-data.txt

drwxr-xr-x 2 root root   4096 2009-04-19 output

-rw-r--r-- 1 root root  50734 2008-03-20 overlib.js

drwxr-xr-x 2 root root   4096 2009-04-19 random-bits

-rw-r--r-- 1 root root   1208 2008-09-15 README

-rw-r--r-- 1 root root  32417 2009-04-19 setup.php

-rwxr-xr-x 1 root root   8461 2009-04-19 weathermap

-rw-r--r-- 1 root root  26725 2009-02-02 weathermap-cacti-plugin-mgmt.php

-rw-r--r-- 1 root root  21295 2009-02-02 weathermap-cacti-plugin.php

-rw-r--r-- 1 root root    932 2008-07-18 weathermap-cacti-rebuild.php

-rw-r--r-- 1 root root 107958 2009-04-19 Weathermap.class.php

-rw-r--r-- 1 root root    366 2009-04-19 weathermap.conf

-rw-r--r-- 1 root root  49798 2009-04-19 WeatherMap.functions.php

-rw-r--r-- 1 root root  24973 2009-04-19 WeatherMapLink.class.php

-rw-r--r-- 1 root root  30935 2009-04-19 WeatherMapNode.class.php

[root@localhost weathermap]# cp editor-config.php-dist editor-config.php

[root@localhost weathermap]# chown apache configs

[root@localhost weathermap]# chmod u+w configs

[root@localhost weathermap]# vi editor-config.php

 

$cacti_base = 'C:/httpd-.2_x64/htdocs/cacti';

// $cacti_base = "/var/www/html/cacti";

 

$cacti_url = "";

 

// $mapdir= $cacti_base.'/plugins/weathermap/configs';

$mapdir='configs';

改成

// $cacti_base = 'C:/httpd-.2_x64/htdocs/cacti';

$cacti_base = "/var/www/html/cacti";

 

$cacti_url = "";

 

$mapdir= $cacti_base.'/plugins/weathermap/configs';

// $mapdir='configs';

 

[root@localhost weathermap]# cd ..

[root@localhost plugins]# cd ..

[root@localhost cacti]# cd include/

 

[root@localhost include]# vi global.php

 

/* Default database settings*/

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "123456";

$database_port = "3306";

 

$plugins = array();

$plugins[] = ' weathermap ';

 

 

阅读(1630) | 评论(0) | 转发(0) |
0

上一篇:linux下root密码修改

下一篇:linux下安装mysql

给主人留下些什么吧!~~