Linux Work Enviroment Build Record

1, Install Debian Squeeze
select standard system tools category only

2, Switch distribute to Wheezy
a, edit /etc/apt/sources.list, the contect is follow
[crayon lang=”sh”]deb http://mirrors.ustc.edu.cn/debian/ testing main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free[/crayon]

b, fetch package list
execute follow command in root console
[crayon lang=”sh”]#aptitdu update[/crayon]

c, update system to Wheezy
execute follow command in root console
[crayon lang=”sh”]#aptitude dist-upgrade[/crayon]

d, reboot system after update process is complete.

3, Configure system
a, locales
execute follow command in root console
[crayon lang=”sh”]#dpkg-reconfigure locales[/crayon]

select all en_US/zh_CN/zh_TW locale, the default locale is en_US.UTF-8

b, console resolution
execute hwinfo –framebuffer will display your graphic card support resolution
edit /etc/default/grub, add the line as follow
[crayon lang=”sh”]GRUB_GFXMODE=1920x1080x32[/crayon]

edit /etc/grub.d/00_header, add follow line after 132 line
[crayon lang=”sh”]set gfxpayload=keep[/crayon]
if grub2 not display corrent with this resolution, it’s can change keep to corrent resolution.

general /boot/grub/grub/cfg, execute follow command in root console
[crayon lang=”sh”]#grub-mkconfig -o /boot/grub/grub.cfg[/crayon]

c, timezone
edit /etc/default/rcS, change UTC=yes to UTC=no

4, Install package from network
execute follow command in root console
[crayon lang=”sh”]#aptitude install sudo unzip unrar vim emacs rcconf build-essential hwinfo git xorg iceweasel ibus ibus-table-wubi xfonts-wqy ttf-wqy-zenhei ttf-wqy-microhei fonts-droid feh scrot alsa-base alsa-utils[/crayon]

5, Install Google Chrome
create text file /etc/apt/sources.list.d/google-chrome.list with follow contect
[crayon lang=”sh”]deb http://dl.google.com/linux/chrome/deb/ stand main[/crayon]

then update package list and install package, the command as follow
[crayon lang=”sh”]#aptitude update
#aptitude install google-chrome-stable[/crayon]

6, Compile Window Manager
download dmenu source code from it’s homepage
then execute follow command in root console
[crayon lang=”sh”]#tar zxvf dmenu-x.x.tar.gz
#cd dmenu-x.x
#make clean install[/crayon]

dmenu will install to /usr/local/bin/ directory

create script file dmenu_path in /usr/local/bin/ with follow contect, mode is 0755
[crayon lang=”sh”]#!/bin/sh

CACHE=$HOME/.dmenu_cache
IFS=:

uptodate() {
test -f “$CACHE” &&
for dir in $PATH
do
test ! $dir -nt “$CACHE” || return 1
done
}

if ! uptodate
then
for dir in $PATH
do
cd “$dir” &&
for file in *
do
test -x “$file” && echo “$file”
done
done | sort | uniq > “$CACHE”.$$ &&
mv “$CACHE”.$$ “$CACHE”
fi

cat “$CACHE”[/crayon]

download Musca source code from it’s homepage
then exectue follow command in root console
[crayon lang=”sh”]#tar zxvf musca-x.x.x.tar.gz
#cd musca-x.x.x
#make
#cp apis /usr/local/bin/
#cp musca /usr/local/bin/
#cp xlisten /usr/local/bin[/crayon]

7, Configure X
a,Xorg
the X server xorg haven’t configure by manual, it’s work well by itself.

b,musca
create musca config file ~/.musca_start with follow contect
[crayon lang=”sh”] set window_open_frame empty
set border_width 0
border off
pad 0 0 0 0
hook on ^add pad 0 0 0 0
name Management
add Programming
add Internet
add Multimedia
use 0
bind on Mod4+e exec emacs
bind on Mod4+b exec google-chrome
bind on Mod4+0 use 0
bind on Mod4+1 use 1
bind on Mod4+2 use 2
bind on Mod4+3 use 3[/crayon]

c,xinit
create X lunchar file ~/.xinitrc with follow contect
[crayon lang=”sh”] export XMODIFIERS=”@im=ibus”
export XIM=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
exec ibus-daemon &
exec musca[/crayon]

d,XTerm
default, XTerm english font is too small, and can’t display chinese, so change the default font
XTerm config is build-in ~/.Xdefault, the contect as follow
[crayon lang=”sh”] Xft.dpi: 96
Xft.antialias: true
XTerm*locale: true
XTerm*utf8: true
XTerm*utf8Title: true
XTerm*renderFont: true
XTerm*preeditType: Root
XTerm*xftAntialias: true
XTerm*fontMenu*fontdefault*Label: Default
XTerm*faceName: Droid Sans Mono:antialias=true:pixelsize=13
XTerm*faceNameDoublesize: WenQuanYi Zen Hei:antialias=true:pixelsize=13
XTerm*cjkWidth: false
XTerm*background: black
XTerm*foreground: white
XTerm*SaveLines: 3000
XTerm*VT100.Translations: #override \
Ctrl V: insert-selection(CLIPBOARD,PRIMARY,CUT_BUFFER0) \n\
: select-end(CLIPBOARD,PRIMARY,CUT_BUFFER0) \n\
Ctrl P: print() \n[/crayon]

Hackintosh

一、硬件
主板:MSI G41TM-E43

详细信息
芯片:Intel G41 + ICH7
显示:GF6600LE
网卡:Realtek 8111DL
声卡:Realtek ALC888S / ALC889

二、软件
Mac OSX Snow Leopard 10.6.3
MD5:A83CEC287B4AB2F0EF11264C580C4E2D
http://bbs.pcbeta.com/viewthread-724423-1-1.html

MBR安装补丁
OSInstall + OSInstall.mpkg
http://bbs.pcbeta.com/viewthread-731391-1-1.html

引导程序
BootThink 2.4.6
http://www.rayfile.com/zh-cn/files/73e974f0-98c2-11e0-8a01-0015c55db73d/

显卡驱动
Natit + NVinject(任选一个)
http://www.kexts.com/view/170-videocards_(nvidia)_10.6_(86-64).html

声卡驱动
VoodooHDA 0.2.1
http://bbs.pcbeta.com/forum-viewthread-tid-763627-highlight-voodoohda.html

网卡驱动
RTGMac 2.0.6
http://bbs.pcbeta.com/forum-viewthread-tid-884669-highlight-8111.html

HFS Explorer 0.21
http://bbs.pcbeta.com/forum-viewthread-tid-640909-highlight-HFS%2BExplorer.html

TransMac 9.1
http://bbs.pcbeta.com/forum-viewthread-tid-613089-highlight-transmac.html

Leopard硬盘安装助手 0.3
http://bbs.pcbeta.com/forum-viewthread-tid-881248-highlight-%D3%B2%C5%CC%B0%B2%D7%B0%D6%FA%CA%D6.html

DiskGenius 3.5.0
http://www.diskgenius.cn/

三、安装
指导资料
http://bbs.pcbeta.com/viewthread-763656-1-1.html

四、状况
除了未开启QE/CI,其它均正常。

五、备注
1,声卡驱动若使用VoodooHDA 0.2.72,则有轻微的沙沙响,后改用0.2.1则正常
2,显示驱动使用Natit或NVinject后可更改分辨率,但不能开启QE/CI
3,除网卡驱动是在启动到OS X系统里安装外,其它驱动均放至BootThink目录

Install ZendOptimizer 3.3.9 to Lenny

# php -v
PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug  4 2010 03:25:57)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

# wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

# tar zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

# cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/lib/php5/

下面这步是重点
# echo “zend_extension=/usr/lib/php5/ZendOptimizer.so” > /etc/php5/conf.d/zend.ini

# /etc/init.d/apache2 restart

# php -v
PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug  4 2010 03:25:57)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

Vyatta里进行端口映射

一、在NAT里设置转发

vyatta@vyatta# show service nat rule 30
destination {
     port 22222
}
inbound-interface pppoe0
inside-address {
     address 192.168.1.186
}
protocol tcp
type destination
[edit]
vyatta@vyatta#

二、防火墙里放行

vyatta@vyatta# show firewall name OnWAN rule 15
action accept
destination {
     port 22222
}
protocol tcp
[edit]
vyatta@vyatta#

Install pptp and radius on lenny

1,install all packages
#apt-get install pptpd freeradius radiusclient1

2,configure pptp
#vim /etc/pptpd.conf

localip 192.168.42.122
remoteip 192.168.42.123-200

#vim /etc/ppp/pptpd-options

ms-dns 8.8.4.4
ms-dns 208.67.222.222
plugin /usr/lib/pppd/2.4.4/radius.so
radius-config-file /etc/radiusclient/radiusclient.conf

3,configure radius
#vim /etc/freeradius/client.conf

client 127.0.0.1 {
 secret  = mysecret
 nastype     = other
}

#vim /etc/freeradius/users

myusername Cleartext-Password := “mypassword”
 Service-Type = Framed-User,
 Framed-Protocol = PPP,
 Framed-IP-Address = 192.168.42.123,
 Framed-IP-Netmask = 255.255.255.0,
 Framed-Routing = Broadcast-Listen,
 Framed-Filter-Id = “std.ppp”,
 Framed-MTU = 1500,
 Framed-Compression = Van-Jacobsen-TCP-IP
 
 
4,configure radclient
#vim /etc/radiusclient

127.0.0.1           mysecret
 
#vim /etc/radiusclient/dictionary.microsoft

add content from http://wiki.freeradius.org/PopTop

#vim /etc/radiusclient/dictionary

INCLUDE /etc/radiusclient/dictionary.microsoft
INCLUDE /etc/radiusclient/dictionary.merit
5,test radius
#radtest myusername mypassword 127.0.0.1 0 mysecret

6,if OS not exist /dev/ppp device,creat it
#mknod /dev/ppp c 108 0

“本地设备名已在使用中”

环境:
两台交换机(一台DES3026,一台非网管)未经过任何设置连接若干PC,一台samba服务器连接在非网管交换机上提供文件共享服务。

前因:
在DES3026上设置两个vlan,PC、非网管交换机和samba服务器接在相同vlan的端口。

现象:
在PC里把samba共享目录映射成win盘符后,每次登录第一次打开这个盘符会弹出警告对话框:“本地设备名已在使用中。此连接尚未还原。”

分析
故障前后PC和samba服务器没有经过任何改动,唯一的变动是交换机划分了vlan,于是至电dlink客服,得到的回答是划分vlan后,连接另一台非网管交换机,把它当成一台PC就可以了。
后来尝试把samba服务器连接在非网管交换机上,这时故障解除。

原因:
不明。

DES-3026 + m0n0 1.3 b16 实现vlan

我原先的网络是192.168.0.0/24,后来为了设置vlan,就把m0n0的lan IP改为192.168.12.2/24了。

2009-04-14_142518

具体过程如下:

一、交换机设置

有人说在交换机上做好vlan后,把连接m0n0的端口设置trunking,但是我的3026交换机做不到。

所以改为这种方法:

vlan10:             2-19 untag
                             20 tag

vlan20:                  20 tag
                        21-26 untag

m0n0连接到3026的20端口

二、m0n0设置

1,Interfaces –> (assign) –> vlans

在这里添加vlan10和vlan20

2009-04-14_142048

2,Interfaces –> (assign) –> Interface assignments

在这里指定vlan 10的接口为vlan10,vlan 20的接口为vlan20

(其实这里只是点+号而已)

2009-04-14_142100

3.1,Interfaces –> (assign) –> OPT1
在这里激活vlan10的接口

"description"填写为"vlan10"
打勾"enable optional 1 interface"
"bridge with"选为"none"
"ip address"填为"192.168.0.2/24"

2009-04-14_142122

3.2,Interfaces –> (assign) –> OPT2
在这里激活vlan20的接口

"description"填写为"vlan20"
打勾"enable optional 2 interface"
"bridge with"选为"none"
"ip address"填为"192.168.5.2/24"

2009-04-14_142135

4.1 Firewall –> Rules –> vlan10
这里要添加允许vlan10网段上网的规则
vlan互访限制也在这里设置,这里的规则直接影响到vlan间的互访

同时要限制vlan10客户端的上网行为也是这里设置规则

2009-04-14_142159

4.2 Firewall –> Rules –> vlan20
这里要添加允许vlan20网段上网的规则
vlan互访限制也在这里设置,这里的规则直接影响到vlan间的互访

同时要限制vlan20客户端的上网行为也是这里设置规则

2009-04-14_142209

题外话:
以上方法虽然实现了我的要求,但跟我想象中的效果相差很大。

我的想法是:
只是在交换机上划分vlan,原来所有客户端不做更改,还是原来的IP,原来的网关,各客户机都能上网,但不同vlan的客户端不能互访。

debian控制服务的几个命令

以前我是用rcconf来控制服务的自启动的,当然有的时候也会直接去/etc/rcX.d目录下把SXXservicename改成KXXservicename来停止自启动服务,不过现在又看到了两个新命令:

第一个是invoke-rc.d

这个命令可以停止或启动服务,比如:

invoke-rc.d exim4 stop

invoke-rc.d nfs-common start

 

第二个是update-rc.d

这个命令可以启用或禁止服务自启动

update-rc.d –f exim4 remove

update-rc.d nfs-common start 20 3 4 5

Vyatta限速测试3

今天接着测试vyatta的限速。

我把匹配的地址改为192.168.0.5/32之后,限速生效了,0.5的下载速度大约在180k,其它的IP下载速度大约在40k,当我把匹配的IP改为192.168.0.5/24后,限速又不生效了。

不知道vyatta的out和in是怎么定义的,如果它是如下所定义的话:

download: internet ===> (in)Vyatta(out) ===> client
up: internet <=== (out)Vyatta(in) <=== client

那么当我在LAN接口的out方向做限速时,匹配的IP位置就应该是destination而非source,但是我在官方文档上所看到的实例以及网上一些文章都指定为source,不得其解。
根据上面的定义,是不是可以在WAN接口的out方向做限速,从而达到做上传限速呢?

另外vyatta 5.0.2也开始支持in的限速了,类型是traffic-limiter,不过它没有default class,有时间用它在WAN接口上测试一下下载的限速。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
vyatta@vyatta# show qos-policy
 traffic-shaper ALL {
     bandwidth 2mbit
     class 10 {
         bandwidth 2mbit
         burst 3k
         ceiling 2mbit
         match IP5 {
             ip {
                 destination {
                     address 192.168.0.5/32
                 }
             }
         }
     }
     default {
         bandwidth 512kbit
         burst 1k
         ceiling 512kbit
     }
 }
[edit]
vyatta@vyatta# show interfaces
 ethernet eth0 {
     address 192.168.0.2/24
     hw-id 00:05:5d:72:ed:**
     qos-policy {
         out ALL
     }
 }
 ethernet eth1 {
     duplex auto
     hw-id 00:05:5d:72:ed:**
     pppoe 1 {
         default-route auto
         password *********
         user-id ********
     }
 }
[edit]
vyatta@vyatta#