2007年1月14日 星期日

設定tcsh

#/etc/csh.cshrc

setenv EDITOR pico #需先安裝 editor/pico

alias ls 'gnuls --color=auto --show-control-chars'
#需先安裝 misc/gnuls #又或者改用 ls -G

set prompt="%B%m[%/]-%n->"

set autolist

#UTF-8
setenv LANG zh_TW.UTF-8
setenv LC_CTYPE zh_TW.UTF-8
setenv MM_CHARSET utf-8


#vi 顯示big5
alias vi 'env LC_CTYPE=en_US.ISO8859-1 vi'
# will be notified when someone logs in or out of your system.
set watch = (0 any any)

設定locale

檢查 /etc/login.conf 中的語言使用者等級是否正確。 確認 /etc/login.conf 存在
下列的設定值。
taiwan:Taiwanese Users:\
:lang=zh_TW.UTF-8:\
:lc_all=zh_TW.UTF-8:\
:lc_collate=zh_TW.UTF-8:\
:lc_ctype=zh_TW.UTF-8:\
:lc_messages=zh_TW.UTF-8:\
:lc_monetary=zh_TW.UTF-8:\
:lc_numeric=zh_TW.UTF-8:\
:lc_time=zh_TW.UTF-8:\
:tc=default:\
:charset=UTF-8:\
#:xmodifiers="@im=xcin":
#Setting the XIM Input Server


更新login.conf
# cap_mkdb /etc/login.conf


改變各使用者的語言
1.vipw:

user:password:UID:GID:language:0:0:User Name:UserHome:Shell

新kernel導致開機失敗

核心優化失敗後 重新掛上舊核心即可
在ok mode下
ok unload
ok
ok load /kernel.good 假設之前備份的檔為kernel.good
(/kerlner.GENERIC為預設核心)

ok load /modules/if_fxp.ko
ok boot

重編kernel

當想你去掉多餘載入的裝置驅動時,或是想加入firewall或SMP支援時,都需要這個步驟

##請先備份你舊有的kernel及module

1.編輯核心設定檔
vi /usr/src/sys/i386/conf/GENERIC

2.重編kernel
config GENERIC
cd ../compile/GENERIC
make cleandepend && make depend
make all install

如果過程都沒錯,能成功重開機進作系統後,便算成功了。

Rebuild everything!!

在更新完source 及 port-tree後,會各有一個UPDATING檔可看
/usr/src/UPDATING以及/usr/ports/UPDATING
裡面都寫很多注意事及更新內容

cd /usr/src
make buildworld
make kernel KERNCONF=YOUR_KERNEL_HERE
##可取為GENERIC ,, make kernel KERNCONF=GENERIC

[1] If you have third party modules, such as vmware, you should disable them at this point so they don't crash your system on reboot.

然後開進單人模式
[3] From the bootblocks, boot -s, and then do
fsck -p
mount -u /
mount -a
cd src
adjkerntz -i # if CMOS is wall time

mergemaster -p [5]

make installworld

make delete-old

mergemaster [4]

在作mergemaster時,會比對新舊設定檔,要仔細注意這個步驟,以免舊有設定被覆蓋
若是想安裝新設定檔按 i,若是想保留原有設定按 d


然後重新開機,應該就OK了,可以用 uname -r 來檢查FreeBSD版本

更新source及port-tree

國內各大CVSUP server
http://ftp.giga.net.tw/cvsup.php

1.編輯supfile
vi /usr/share/examples/cvsup/standard-supfile #更新source用
vi /usr/share/examples/cvsup/ports-supfile #更新port-tree用

*default host=cvsup8.FreeBSD.org
*default base=/var/db
*default prefix=/usr
*default release=cvs tag=RELENG_6_1
*default delete use-rel-suffix
##若在stand-supfile中加入 ports-all tag =.
##則等於是一個檔可以同時更新source及port-tree

2.更新

cvsup -g -L 2 standard-supfile

可以crontab方式定期更新source及port-tree

若是已有安裝sysutil/portupgrade,在更新完port-tree後

可以用 portsdb -FU來更新portsdb

/etc/make.conf

PERL_VER=5.8.8
PERL_VERSION=5.8.8
CPUTYPE=i686
NO_GAMES=true
NO_INFO=true
WITHOUT_X11=yes
X11BASE=${LOCALBASE}
MASTER_SITE_BACKUP?=\
ftp://ftp2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp3.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp7.tw.freebsd.org/FreeBSD/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}

FreeBSD 6 基本環境安裝設定流程

在基本的安裝和網路設定都OK後

1. 用cvsup更新 src及 port-tree

2. 重編系統及kernel (world,kernel)

3. 核心調校及重編

4. 設定locale及各使用者所使用的語言 (login.conf, vipw)

5. 設定 make.conf

6. 微調tcsh (gnuls,pico,..)

7. 設定 /etc/hosts.allow,擋掉亂try ssh的人

到這裡基本的系統環境都設定好了,接下來就可以安裝你所要的port了

1. portupgrade,sudo

2. Apache2+php5+mysql5+phpmyadmin

3. 設定Apache的 ssl + VirtualHost 以及Natd (Optional)

4. webmin,BBS,galler,lifetype/wp,dokuwiki等常用網路套件