存档

‘xNix平台’ 分类的存档

CentOS 5.4 VPN架设

2010年3月7日 甜蚂蚁 没有评论

yum install ppp iptables
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-1.rhel5.1.i386.rpm

rpm -ivh pptpd*.i386.rpm

vi /etc/ppp/options.pptpd
name pptpd
refuse-pap
refuse-chap
refuse-mschap
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
ms-dns 8.8.8.8
ms-dns 4.4.4.4

vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
sideblue pptpd password *

vi /etc/sysctl.conf
修改

net.ipv4.ip_forward = 1

然后sysctl -p
vi /etc/pptpd.conf

option /etc/ppp/options.pptpd
logwtmp
localip 222.184.9.106
remoteip 222.184.9.108-110

下面开始修改iptables
iptables -A INPUT -p tcp –dport 1723 -j ACCEPT
iptables -A INPUT -p tcp –dport 47 -j ACCEPT
iptables -A INPUT -p gre -j ACCEPT
iptables -t nat -A POSTROUTING -s 222.184.9.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -s 222.184.9.0/24 -p tcp -m tcp –tcp-flags SYN,RST SYN -j TCPMSS –set-mss 1200

最后执行/etc/init.d/iptables save

chkconfig pptpd on
chkconfig iptables on

到此配置结束

分类: xNix平台 标签:

CentOS下Nagios编译安装操作手册

2010年2月20日 甜蚂蚁 没有评论

yum install httpd gcc glibc glibc-common gd gd-devel php
useradd nagios
passwd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

到这里完成用户创建和环境准备,wget两个nagios的包,我用的是

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

当然你最好用最新的
tar打开nagios的包

tar zxvf nagios-3.2.0.tar.gz
cd nagios-3.2.0

./configure –with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode

make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios

tar打开nagios插件的包

tar zxvf nagios-plugins-1.4.11.tar.gz
cdnagios-plugins-1.4.11
./configure –with-nagios-user=nagios –with-nagios group=nagios
make
make install

加入nagios服务

chkconfig –add nagios
chkconfig nagios on

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

关闭SElinux

getenforce
setenforce 0

修改目录权限

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
service nagios start

解决cgi无法访问的错误
打开cgi.cfg配置文件,修改

use_authentication=1

否则web页面无法打开cgi

分类: xNix平台 标签:

mysql主从同步配置步骤

2009年12月15日 甜蚂蚁 没有评论

环境均为debian,首先保证mysql的版本一致,如果不一致,做主机的版本不能高于slave机的版本,最好还是一致的,测试时环境如下:
ifc-ftp:~# mysql -V
mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2
测试环境两台主机ip分别为192.168.100.66,192.168.100.68,其中192.168.100.66为主机(以下简称66),192.168.100.68为从机(以下简称68)
首先配置主机
vi /etc/mysql/my.cnf
修改其中的bind-address字段,默认是127.0.0.1,这将引起其他机器无法正确访问到mysql,改为
bind-address = 192.168.100.66
然后在[mysqld]这一段的配置中加入以下内容:
# sync
server-id=1
log-bin=mysql-bin
innodb_flush_log_at_trx_commit = 1
sync_binlog=1
binlog-do-db=phpdisk
binlog-ignore-db=test
binlog-ignore-db=mysql
replicate-do-db=phpdisk
阅读全文…

分类: xNix平台 标签:

CentOS架设只转发的DNS服务器

2009年11月15日 甜蚂蚁 没有评论

yum -y install bind bind-chroot bind-utils system-config-bind
cp /usr/share/doc/bind-9.3.6/sample/etc/named.conf /var/named/chroot/etc/
vi /var/named/chroot/etc/named.conf

options {
directory “/var/named”;
dump-file “/var/named/data/cache_dump.db”;
statistics-file “/var/named/data/named_stats.txt”;
forwarders { 221.228.255.1; 61.147.37.1; };
allow-query { any; };

};

zone “.” IN {
type hint;
file “named.root”;
};

zone “localdomain.” IN {
type master;
file “localdomain.zone”;
allow-update { none; };
};

zone “localhost.” IN {
type master;
file “localhost.zone”;
allow-update { none; };
};

zone “0.0.127.in-addr.arpa.” IN {
type master;
file “named.local”;
allow-update { none; };
};

include “/etc/rndc.key”;

cd /usr/share/doc/bind-9.3.6/sample/var/named
cp localdomain.zone localhost.zone named.local /var/named/chroot/var/named/
cp /usr/share/doc/bind-9.3.6/sample/var/named/named.root /var/named/chroot/var/named/

注意其中粗体的全部是命令,安装后记得service named restart,如果有报错自行检查一下,可能是漏了分号,我测试正常;
记得关闭iptables或者写规则

分类: xNix平台 标签:

浪潮NP350系列无法正常运行debian

2009年11月14日 甜蚂蚁 没有评论

手头有两台浪潮NP350HR,已经多次测试证明浪潮无法正常运行debian及其衍生发行版ubuntu,表现为网卡工作不正常,尝试编译内核,升级网卡驱动等均无效,刚才测试了一下,安装centos后网卡运行正常,因此决定浪潮系列的从此开始使用centos。
另外centos安装的时候如果用CD的话,会用到CD1-5这五张盘,这显然不是人干的事情,解决方法很简单,下载centos的DVD镜像,然后随便上传到哪个http服务器上并且解压到web服务器的某个子目录,然后使用centos netinstall进行安装,速度非常快,和本地安装的速度差不多,因为本地的光驱速度甚至还不如网络:)
centos安装以后默认会打开防火墙,并且只打开22端口,只需要关闭iptables就可以了

service iptables stop

分类: xNix平台 标签:

Panabit网卡的选择

2009年11月12日 甜蚂蚁 没有评论

到目前为止,我在Panabit上共使用过以下网卡:
Intel Pro 100 (NC3121)
Realtek 1000M 千兆网卡
Intel 1000M GT Desktop Adapter
Intel 1000M GT
均为同品牌的双网卡做流量通道,事实证明百兆的网卡和千兆的还是有区别的,但是Realtek的千兆网卡的效能和Intel 1000M GT比起来差不多,而且用Intel网卡的时候还需要编译内核去掉em模块驱动,否则会不停的在console上提示无法注册em驱动。
鉴于以上测试,我认为用Intel 1000M GT网卡是比较好的选择,没有的话用Realtek千兆也行,或者用Intel的双口百兆卡,这个卡我也测试过,效果一般般,就是那个82855什么的芯片,如果实在没有,找老网卡,越老的越好(当然别是10M的),新卡的做工都比较废,比如现在的8139简直就是节省到某种程度,另外某些主板自带的Realtek网卡用做管理接口的时候有问题,我用过某款主板的集成网卡做管理的时候,文件无法从网页上传,sftp也非常慢,如果你和我碰到一样的问题,尝试用第三块网卡,而不是用集成网卡。

分类: xNix平台 标签:

Weave Server 0.5架设过程

2009年10月20日 甜蚂蚁 1 条评论

首先需要apt-get apache2 php5-cgi php5-mysql mysql-server php5-gd
完成以后用phpinfo测试一下,看看有没有加载pdo和json,weave需要这两个,debian默认加载的,不需要操心。
从官方下载weave server所需文件,修改文件夹0.5中的default_constants.php.dist为default_constants.php,然后编辑其中的内容,主要是类似如下的部分,我的是
if (WEAVE_STORAGE_ENGINE == ‘mysql’)
{
#if using mysql, host, db name, username and password for the auth store
if (!defined(‘WEAVE_MYSQL_STORE_READ_HOST’)) { define(‘WEAVE_MYSQL_STORE_READ_HOST’, ‘localhost’); }
if (!defined(‘WEAVE_MYSQL_STORE_READ_DB’)) { define(‘WEAVE_MYSQL_STORE_READ_DB’, ‘weave’); }
if (!defined(‘WEAVE_MYSQL_STORE_READ_USER’)) { define(‘WEAVE_MYSQL_STORE_READ_USER’, ‘root’); }
if (!defined(‘WEAVE_MYSQL_STORE_READ_PASS’)) { define(‘WEAVE_MYSQL_STORE_READ_PASS’, ‘rootpass’); }

里面的rootpass是你的mysql的密码。然后把server文件夹传到服务器上,你传到哪儿就需要修改apache中的配置路径。

下面首先开始配置mysql

mysql -u root -p

输入密码后执行以下命令

create database weave;
CREATE TABLE `wbo` (
`username` varbinary(32) NOT NULL default ”,
`collection` varbinary(64) NOT NULL default ”,
`id` varbinary(64) NOT NULL default ”,
`parentid` varbinary(64) default NULL,
`predecessorid` varbinary(64) default NULL,
`modified` decimal(12,2) default NULL,
`sortindex` int(11) default NULL,
`depth` tinyint(4) default NULL,
`payload` longtext,
`payload_size` int(11) default NULL,
PRIMARY KEY (`username`,`collection`,`id`),
KEY `parentindex` (`username`,`collection`,`parentid`),
KEY `modified` (`username`,`collection`,`modified`),
KEY `weightindex` (`username`,`collection`,`sortindex`),
KEY `predecessorindex` (`username`,`collection`,`predecessorid`),
KEY `size_index` (`username`,`payload_size`)
) ENGINE=InnoDB;

因为我配置的过程不需要用到用户认证,所以我没有插入user表,此步省略;
下面开始配置apache,你可以照抄我的配置,注意需要修改一下实际路径
/etc/apache2/sites-available/default

ServerName weave.gzxkc.com
DocumentRoot /home/www/weave.gzxkc.com/server/

ErrorLog /var/log/apache2/weaveserver-error.log
CustomLog /var/log/apache2/weaveserver-access.log combined

Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
AuthType Basic
AuthName “Weave Server”
AuthUserFile /etc/apache2/auth
require valid-user

Alias /0.5 /home/www/weave.gzxkc.com/server/0.5/index.php

/etc/apache2/ports.conf
Listen 60002


# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
Listen 443

然后建立auth文件

htpasswd -c /etc/apache2/auth yourusername

输入密码
这样在weave的登录的地方就用你的用户名和密码登录

到此所有的配置结束,这里我用到了负载均衡,所以VirtualHost是内外那个地址,你需要修改成你的服务器地址。
完成以后重新启动一下apache即可

分类: xNix平台 标签:

Debian下nginx的配置

2009年10月16日 甜蚂蚁 没有评论

首先apt-get install nginx
nginx默认的配置文件在/etc/nginx/nginx.conf
我给出一个配置实例,很容易就看懂了,如果需要加入其他的服务器,在里面直接照着复制即可

user www-data;

worker_processes 10;

#error_log logs/error.log;
#error_log logs/error.lognotice;
#error_log logs/error.loginfo;

#pid logs/nginx.pid;

#最大文件描述符
worker_rlimit_nofile 51200;

events
{
use epoll;

worker_connections 51200;
}

http
{
include mime.types;
default_type application/octet-stream;

keepalive_timeout 120;

tcp_nodelay on;

upstream back.gzxkc.com{
server 192.168.100.162:60051;
}

server
{
listen 80;
server_name back.gzxkc.com;

location /
{
proxy_pass http://back.gzxkc.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}

分类: xNix平台 标签: