# 安装 rrdtool 及所需组件:
yum install -y perl-rrdtool rrdtool rrdtool-devel rrdutils flex byacc
# 安装 rrdtool 及所需组件:
yum install -y perl-Socket6 perl-MailTools perl-Mail-Sender
# 安装 GCC :
yum install -y gcc
# 安装 Nfdump 工具:
cd /usr/local/src/
wget http://downloads.sourceforge.net/project/nfdump/stable/nfdump-1.6.6/nfdump-1.6.6.tar.gz
tar zxvf nfdump-1.6.6.tar.gz
cd nfdump-1.6.6/
./configure --enable-nfprofile --with-rrdpath=/usr/bin # --enable-nfprofile 为重新生成,--with-rrdpath= 为启用rddtool支持
make
make install
cd ../
# 下载配置 Nfsen :
mkdir -p /usr/local/nfsen
wget http://downloads.sourceforge.net/project/nfsen/stable/nfsen-1.3.6p1/nfsen-1.3.6p1.tar.gz
tar zxvf nfsen-1.3.6p1.tar.gz
cd nfsen-1.3.6p1/
cp etc/nfsen-dist.conf etc/nfsen.conf
# 修改Nfsen配置文件:
cat etc/nfsen.conf
#http://www.haiyun.me
$BASEDIR = "/usr/local/nfsen";
$HTMLDIR = "/var/www/html/nfsen/";
$USER = "apache";
$WWWUSER = "apache";
$WWWGROUP = "apache";
%sources = (
'upstream1' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },
);
以上部分参考:
Linux下is not in the sudoers file解决方法
在CentOS上搭建PHP服务器环境
# 安装apache:
yum install httpd httpd-devel
# 启动apache:
/etc/init.d/httpd start
# 安装mysql:
yum install mysql mysql-server
# 启动mysql:
/etc/init.d/mysqld start
# 安装php
yum install php php-devel
# 重启apache使php生效
/etc/init.d/httpd restart
# 安装php的扩展
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
# 安装完扩展之后需要再次重启apache
/etc/init.d/httpd restart
# 安装Nfsen:
./install.pl etc/nfsen.conf
# 启动Nfsen:
/usr/local/nfsen/bin/nfsen start
开启后可以通过 http://serverip/nfsen/nfsen.php WEB页面访问,
不过访问会报错
:
ERROR: nfsend connect() error: Permission denied! ERROR: nfsend - connection failed!! ERROR: Can not initialize globals!
# 这是因为权限不足,需要给 /data/nfsen/var/run/nfsen.comm 增加 rw 的权限:
chmod a+rw /usr/local/nfsen/var/run/nfsen.comm # Remark:每次NFSEN服务重启都需要重新加权限!
# 关闭防火墙
setenforce 0