一、Cacti的安装

 1.安装环境:RedHat AS 5
2.安装Apache、MySQL、PHP
(1).安装MySQL
解压 tar zxvf mysql-5.0.41.tar.gz
创建用户和组
groupadd mysql
useradd -g mysql mysql
配置编译选项
./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql --with-extra-charsets=all --with-unix-socket-path=/usr/local/mysql/var/mysql.sock --enable-assembler --enable-thread-safe-client --with-mysqld-ldflags=all-static
开始编译
Make
安装
Make install

配置mysql 把my.cnf 文件放到/etc/目录下。
Cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

创造mysql授权表(用来启动mysql数据库)
命令:/usr/local/mysql/bin/mysql_install_db

更改权限及属主属组
Chmod 755 /usr/local/mysql/var
Chown -R mysql.mysql /usr/local/mysql

启动mysql服务
/usr/local/mysql/share/mysql/mysql.server start

创建mysqld数据库的管理用户
命令:/usr/local/mysql/bin/mysqladmin -u root password 123456

进入mysql
/usr/local/mysql/bin/mysql -uroot -p123456

启动脚本(使系统启动时自动启动MySQL数据库服务)两种方法
A. 在linux系统下
在/etc/rc.local文件内添加下面的行:
/usr/local/mysql/share/mysql/mysql.server start
或 bin/mysqld_safe --user=mysql &
B. MySQL的启动和停止脚本
Cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
Chmod 755 /etc/init.d/mysqld
Chkconfig -add mysqld


如果编译时出现了以下错误:
checking for tgetent in -ltermcap… no
checking for termcap functions library… configure: error: No curses/termcap library found
说明 curses/termcap 库没有安装
去下载一个ncurses-5.6.tar.gz,
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6
./configure -prefix=/usr -with-shared -without-debug
make
make install clean
然后再重新编译Mysql进行安装。发现还是不行!
这下可苦 了我了,继续查找下,
[root@myserver lamp]# rpm -ivh /RPMS/Server/ncurses-
ncurses-5.5-24.20060715.i386.rpm        ncurses-devel-5.5-24.20060715.i386.rpm
[root@myserver lamp]# rpm -ivh /RPMS/Server/ncurses-devel-5.5-24.20060715.i386.rpm 
warning: /RPMS/Server/ncurses-devel-5.5-24.20060715.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:ncurses-devel          ########################################### [100%]
[root@myserver lamp]#
现在就可以重新编译Mysql进行安装。

安装好后不能从远程连接上 需要授权

 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;  

FLUSH   PRIVILEGES;  

 

 

1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

Sql代码 复制代码

   1. mysql -u root -pvmwaremysql>use mysql; 

   2. mysql>update user set host = '%' where user = 'root'; 

   3. mysql>select host, user from user; 

2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

Sql代码 复制代码

  1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH

      GRANT OPTION;  

  2.FLUSH   PRIVILEGES;

 

##自己执行的

INSERT INTO `user` VALUES ('localhost', 'resource', password("res-cntv"), 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', '', '', '', '', '0', '0', '0', '0');
INSERT INTO `user` VALUES ('%', 'resource', password("res-cntv"), 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', '', '', '', '', '0', '0', '0', '0');

FLUSH PRIVILEGES;

GRANT ALL PRIVILEGES ON *.* TO 'resource'@'%' IDENTIFIED BY 'res-cntv' WITH GRANT OPTION;

FLUSH PRIVILEGES;

 

 

 


1.Java安装:
 执行 
 ./jdk-6u21-linux-x64-rpm.bin
  得到 jdk-6u21-linux-amd64.rpm

 root 身份 
 #rpm  -ivh  jdk-6u21-linux-amd64.rpm
 #ll  /usr/java/jdk1.6.0_21

2. Ant 安装
 root 身份执行:
 cd  /home/isysearch/soft
 #tar  -xvzf  apache-ant-1.8.1-bin.tar.gz
#mv  apache-ant-1.8.1  /usr/local/.
 #ll /usr/local/ apache-ant-1.8.1

3.编辑配置文件
 修改Profile:
 #vim /etc/profile
JAVA_HOME=/usr/java/jdk1.6.0_21
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
ANT_HOME=/usr/local/apache-ant-1.8.1
PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH
export JAVA_HOME ANT_HOME CLASSPATH PATH

测试环境变量是否没有问题:
ant –h
java –version

4. 修改 Open too file 问题
# echo "* soft nofile 65000" >>/etc/security/limits.conf
# echo "* hard nofile 65535" >>/etc/security/limits.conf

5. /etc/hosts
注意事项:
1、一定要把本机的hostname –i 显示internet IP,否则RMI绑定有问题。
例子规范:
首先更改hostname 
#hostname liyan

#vim /etc/hosts
127.0.0.1                localhost.localdomain localhost
10.70.62.2             liyan

#hostname –i
10.70.62.2