存档

‘√linux’ 分类的存档

nagios配置文件

2010年5月31日 没有评论

个人觉得这东西太难搞了。尽管网上教程那么多。也请教了不少人。但我还是很艰难的才搞成。。
我太笨了……
.cfg
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg

[root@moniter objects]# more contacts.cfg
define contact{
contact_name vi;
alias sys admin
service_notification_period 24×7
host_notification_period 24×7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email viyin@yahoo.com
pager 1391119xxxx
}

[root@moniter objects]# more contactgroups.cfg
define contactgroup{
contactgroup_name vis;
alias roots;
members vi
}

[root@moniter objects]# more hosts.cfg
define host{
# use host-pnp
host_name viyin.net
alias www
address 218.6.15.105
check_command check-host-alive
max_check_attempts 3
check_period 24×7
contact_groups vis
notification_interval 10
notification_period 24×7
notification_options d,u,r
}
[root@moniter objects]# more hostgroups.cfg
define hostgroup{
hostgroup_name linux-servers
alias linux-servers
members viyin.net
}

[root@moniter objects]# more services.cfg
define service{
# use srv-pnp
host_name viyin.net
service_description Current Users
check_command check_local_users!20!50
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
check_period 24×7
notification_interval 10
notification_period 24×7
notification_options w,u,c,r
contact_groups vis
}

分类: √linux, √web 标签: ,

iptables限速

2010年5月28日 没有评论

-A RH-Firewall-1-INPUT –source 74.117.0.0/16 -m limit –limit 1/s -j ACCEPT
-A RH-Firewall-1-INPUT –source 74.117.0.0/16 -j DROP

# -A OUTPUT –destination 74.117.0.0/16 -m limit –limit 20/s -j ACCEPT

本来以为要双向定义 。试过后,input就行了。

分类: √linux 标签: ,

在 Linux 上通过 Xen运行 FreeBSD

2010年5月7日 没有评论

 ™ hypervisor 是一个开放源代码的并行虚拟化产品, 并由商业的 XenSource 公司提供支持。 在这种系统中,客户操作系统称为 domU 域, 而宿主系统则称为 dom0。 在 Linux 上运行 虚拟机实例的第一步, 是安装用于 Linux dom0 的 Xen。 在这个例子中, 宿主系统采用的发行版本是 Slackware Linux
在 Linux dom0 上安装 Xen 3
1.从 XenSource 下载 Xen 3.0

从 http://www.xensource.com/ 下载 xen-3.0.4_1-src.tgz。

2.解压缩源代码包

# cd xen-3.0.4_1-src
# KERNELS=”linux-2.6-xen0 linux-2.6-xenU” make world
# make install
注意: 为 dom0 重新编译内核:

# cd xen-3.0.4_1-src/linux-2.6.16.33-xen0
# make menuconfig
# make
# make install
对于较早版本的 Xen,可能需要指定 make ARCH=xen menuconfig
3.在 Grub 的 menu.lst 中增加一个对应的菜单项

编辑 /boot/grub/menu.lst 并在其中增加下列配置:

title Xen-3.0.4
root (hd0,0)
kernel /boot/xen-3.0.4-1.gz dom0_mem=262144
module /boot/vmlinuz-2.6.16.33-xen0 root=/dev/hda1 ro
4.重新启动计算机并进入 Xen

阅读全文…

history命令记录

2010年5月4日 1 条评论

unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG; export HISTFILE=/dev/null; export HISTSIZE=0; export HISTFILESIZE=0

分类: √linux 标签:

freebsd下apache+nginx+php+mysql+eaccelerator+memcache安装配置

2010年4月19日 没有评论

freebsd下apache+nginx++++memcache安装配置
太长了。到后面没那么细心了。直接复制粘贴上来。就不加说明了。
1.安装apache

bsd1# pwd
/usr/ports/www/22
bsd1# make install clean

2.安装MYSQL
./configure –prefix=/usr/local/mysql –enable-assembler –with-charset=utf8 –enable-thread-safe-client –with-extra-charsets=all –with-big-tables –with-readline –with-ssl –with-embedded-server –enable-local-infile –with-plugins=innobase

make -j 5
make install
groupadd mysql
useradd -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db –user=mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
这是linux的安装命令。BSD照着改一下

2.安装PHP
先装组件jpeg,libpng,freetype,zlib,gd,curl,libxml2,libxslt,libmcrypt
pkg_add -r gd
pkg_add -r freetype
pkg_add -r curl
pkg_add -r libxml2
pkg_add -r libxslt
pkg_add -r libmcrypt
pkg_add -r mhash
./configure –prefix=/usr/local/php –with-config-file-path=/etc –with-apxs2=/usr/local/sbin/apxs –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-iconv-dir –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir –enable-xml –disable-rpath –enable-discard-path –enable-magic-quotes –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –enable-force-cgi-redirect –enable-mbstring –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –with-mime-magic –enable-suhosin
make &&make install
cp php.ini-dist /etc/php.ini
阅读全文…

SSH密钥配置

2010年4月15日 1 条评论

linux 创建
#-keygen -t rsa

[root@viyin.net ~]# ls ~/.ssh/
id_rsa id_rsa.pub known_hosts

CRT-工具-创建公钥-RSA

生成密钥.

上传CRT所生成的Identity.pub 到~/.ssh/

ssh-keygen -X -f Identity.pub >> /root/.ssh/ (SSH配置文件里默认文件名)

修改Mysql数据储存目录.Freebsd

2010年4月14日 没有评论

Ports安装Mysql默认的数据文件存储目录为/var/db/,现要移到/usr/local//下.
最简单的方法是采用符号链接,但符号链接在频繁读写时可能有效率问题.
#ln -s /usr/local/mysql /var/db/mysql

建立目录
mkdir /usr/local/mysql
权限
chown -R mysql:mysql /usr/local/mysql
停止MYSQL服务进程
mysqladmin -u root -p shutdown
移动数据
mv /var/db/mysql /usr/local/data
修改配置文件
vi /etc/my.cnf
(如果没有,到/usr/local/share/mysql/下找到my-*.cnf文件,cp一个到/etc/my.cnf)中

增加mysql_dbdir=”/usr/local/mysql”
修改启动脚本
vi /usr/local/etc/rc.d/mysql-server
修改datadir=/usr/local/data/mysql
重新启动MySQL服务
/usr/local/etc/rc.d/mysql-server start
查看是否启动成功

阅读全文…

分类: √freebsd, √linux 标签: , ,