分类目录归档:LINUX

CentOS Linux安装monit

Monit是一个Linux/UNIX系统上开源的进程、文件、目录和文件系统监控和管理工具。官网:http://mmonit.com/。这里系统为CentOS6.2,监控机IP为192.168.1.100,被监控机IP为192.168.1.200。

一、被监控机安装monit
1、安装monit
monit有源码和编译好的二进制版,目前最新为monit-5.3.2,这里使用pre-compiled binaries版,省时省力。

选择相应的系统下载:

cd /tmp
wget http://mmonit.com/monit/dist/binary/5.3.2/monit-5.3.2-linux-x86.tar.gz
tar -axvf monit-5.3.2-linux-x86.tar.gz

2、将monit放到合适的位置:

mv monit-5.3.2 /usr/local/monit
继续阅读CentOS Linux安装monit

CentOS Linux安装cacti

Cacti是一套基于PHP、MySQL、SNMP及RRDTool开发的网络流量监测图形分析工具。使用snmp协议监控。官网:http://www.cacti.net/。这里系统为centOS6.2,监控机IP为192.168.1.100,被监控机IP为192.168.1.200。

一、安装PHP Web Server环境及cacti所需软件包
LAMP、LNMP、LANMP都可以。这里用apache+php+mysql。

yum install httpd mysql mysql-server php php-mysql php-snmp php-pdo rrdtool net-snmp net-snmp-libs net-snmp-utils

配置LAMP过程略过。

二、建立数据库

#mysql -u root -p
mysql>create database cacti default character set utf8;
mysql>create user 'cactiuser'@'localhost' identified by '123456';
mysql>grant all privileges on cacti.* to 'cactiuser'@'localhost';
mysql>flush privileges;
mysql>\q

建立了一个数据库cacti,mysql用户cactiuser,密码为123456。
继续阅读CentOS Linux安装cacti

CentOS Linux安装ntop

ntop是一个网络流量监控工具,自带web interface,主要用来监控内网流量可以安装在网关上。官网:http://www.ntop.org/。这里系统为CentOS6.2。

0、安装RPMForge源
部分依赖的软件包需要到RPMForge源下载,所以先要安装RPMForge源。
安装过程可参考:http://www.live-in.org/archives/998.html

1、安装必备软件

yum install libtool automake autoconf m4 make gcc gcc-c++ gdbm gdbm-devel zlib zlib-devel openssl openssl-devel python-devel GeoIP GeoIP-devel

2、安装libpcap

yum install libpcap libpcap-devel

3、安装rrdtool

yum install rrdtool rrdtool-devel
继续阅读CentOS Linux安装ntop

CentOS Linux VPS安装socks代理服务器

Socks代理常用于教育网访问国外网站等,Linux下socks服务器软件有ss5、kingate、dante,这里安装ss5,系统为CentOS5.7。

1、安装编译环境

yum install make automake gcc gcc-c++

2、安装ss5必要软件包

yum install pam-devel openssl-devel openldap-devel cyrus-sasl-devel

3、编译安装ss5
目前最新为ss5-3.8.9-5。

cd /tmp
wget http://sourceforge.net/projects/ss5/files/ss5/3.8.9-5/ss5-3.8.9-5.tar.gz/download
tar -zxvf ss5-3.8.9-5.tar.gz
cd ss5-3.8.9
./configure
make
make install
继续阅读CentOS Linux VPS安装socks代理服务器

CentOS桌面yum安装Adobe Flash Player

桌面打开浏览器访问:http://get.adobe.com/cn/flashplayer/。网页会判断操作系统和浏览器并下载 Flash Player(支持Firefox浏览器)。

或者直接下载:
i386系统

wget http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
rpm -ivh adobe-release-i386-1.0-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
yum install firefox.i386 flash-plugin

x86_64系统

wget http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
rpm -ivh adobe-release-x86_64-1.0-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
yum install firefox.x86_64 flash-plugin

更新 Flash player:

yum update flash-plugin

参考资料:
http://wiki.debian.org.hk/w/Install_Flash_Player_with_YUM

CentOS使用inotify+rsync实时同步

inotify是Linux下的一个文件系统事件监控机制(简单说就是用于监控某个文件夹的改动),作为dnotify的有效替代。inotify是一种强大的、细粒度的、异步的机制,它满足各种各样的文件监控需要。在单独使用rsync同步时,每次同步它会把全部的文件读取一遍,而inotify+rsync同步是触发式同步。假设被镜像端IP为192.168.1.100,镜像端IP为192.168.1.200。

一、被镜像(同步)端
linux内核2.6.13之后就支持inotify了,确认方法:

ls /proc/sys/fs/inotify

如果有以下三项就支持:

max_queued_events max_user_instances max_user_watches

继续阅读CentOS使用inotify+rsync实时同步

[转]TCP连接状态

状态:说明
CLOSED:没有活动的连接,或者未完成的连接
LISTEN:服务器正在等待进来的连接请求
SYN_RCVD:一个连接请求已经到达;等待ACK
SYN_SENT:应用程序已经开始打开连接
ESTABLISHED:正常的数据传输状态
FIN_WAIT1:应用程序说它已经结束连接了(服务器主动断开)
FIN_WAIT2:另一边已经同意释放连接(另一方主动断开)
TIME_WAIT:等待所有的分组逐渐消失
CLOSING:双方试图同时关闭连接
CLOSE_WAIT:另一方已经发起了释放连接的过程
LAST_ACK:等待所有的分组逐渐消失 继续阅读[转]TCP连接状态

CentOS安装iftop

iftop是linux下的一个流量监控工具,用于查看实时网络流量。
官网:http://www.ex-parrot.com/pdw/iftop/

1、安装必须软件包

yum install libpcap libpcap-devel ncurses ncurses-devel

2、安装iftop

cd /tmp
wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
tar -zxvf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make
make install
继续阅读CentOS安装iftop

mysql开启慢查询日志

mysql可以在日志里记录下运行比较慢的sql语句,可以帮助sql语句的优化。这里用的是mysql5.1。

1、编辑my.cnf

vim /etc/my.cnf

2、在[mysqld]后添加:

long_query_time = 2
slow_query_log = 1
slow_query_log_file = /var/log/slow.log
log-queries-not-using-indexes

long_query_time:设置sql执行超过多长时间会被记录下来,单位秒。
slow_query_log:设为1开启慢查询日志,0关闭。
slow_query_log_file:设置日志名称位置。
log-queries-not-using-indexes:设置记录下没有使用索引的sql语句。
继续阅读mysql开启慢查询日志