freebsd 6.2 安装配置笔记[转]

freebsd 6.2 安装配置笔记June 28th, 2007

作者: Jeffrey
出处:http://blog.zhangjianfeng.com/?p=588

freebsd 6.2 安装配置笔记

#最小化安装后….
sysinstall,改口令,时区,src-sys,ports,man,Xorg, bash3,cvsup-without-gui,lynx,linux,unzip
并设置网卡,sshd服务

++开启sshd服务
vi /etc/ssh/sshd_config ,加入以下行
PermitRootLogin yes
退出后重启服务即可 /etc/rc.d/sshd restart

++csh改bash
chfn -s /usr/local/bin/bash username

++网络设置
#ifconfig_lnc0="DHCP"
ifconfig_lnc0="inet 192.168.11.174 netmask 255.255.255.0"
defaultrouter="192.168.11.1"
sshd_enable="YES"
hostname="testsrv174.zhangjianfeng.com"

++开机自动启动gnome
echo "exec /usr/local/bin/gnome-session" >/root/.xinitrc
在/etc/rc.conf 加入 gdm_enable="YES"

###++更新cvsup (第二次安装时没有更新cvsup,我只是用来做桌面系统而已)
###cd /usr/share/examples/cvsup
###编辑ports-supfile
###*default host=cvsup.FreeBSDChina.org
###cvsup -g -L 2 ports-supfile

++使用wget/axel加速你的port下载
通过修改make.conf实现
#FETCH_CMD=proz -s -k 5 –no-curses
FETCH_CMD= wget -c -t 1
DISABLE_SIZE=yes

++选择快的 ports 服务器
修改 /etc/make.conf 文件,在其中的最后部分加入如下语句:
MASTER_SITE_OVERRIDE= \
} \
} \
} \
} \

++安装常用软件,pkg_add和make两种安装方法请开两个终端来安装
mkdir /usr/ports/distfiles/pkg
export PACKAGESITE=ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/i386/packages-6.2-release/Latest/
export PKGDIR=/usr/ports/distfiles/pkg
#export PACKAGESITE=ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/i386/packages-6-stable/Latest/
#pkg_add -K参数可以将tbz源保存到$PKGDIR目录下,根据需要使用此参数
pkg_add -rK wget prozilla gaim gaim-openq eva vsftpd gftp xpdf rdesktop stardict zh-stardict2-dict-zh_CN
compupic gthumb zh-fcitx xchm.tbz zh-unrar gnomebaker
firefox2(6-stable源是3.0版本) fusefs-libs fusefs-kmod

++安装多媒体
下载下面的包,并安装
http://ftp.br.freebsd.org/local/packages/audio/lame-3.97_1.tbz

#以上两个链接已失效,请自行寻找
pkg_add -rK zh-xmms xmms-wma mplayer mplayer-fonts zh-mplayer-fonts kmplayer xine beep-media-player bmp-extra-plugins
aumix #音量控制
++xmms播放列表解决方法
打开xmms,然后,[首选项]–>[字体],将playlist变成:-misc-simsun-medium-r-normal-*-*-120-*-*-p-*-gb2312.1980-0",*-r-*

++安装声卡的驱动
kldload snd_driver    #一次加载了最常见的设备驱动
dmesg | grep pcm
cat /dev/sndstat,得到信息格式如下
FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: ; at io 0xdc00, 0xe000 irq 11 bufsz 16384 kld snd_ich (1p/1r/0v channels duplex default)
说明该声卡的类型为:snd_ich
#vi /boot/defaults/loader.conf
修改:snd_ich_load="NO" #intel Tch 这一行,
改成:snd_ich_load="YES" #intel Tch
(注意:如果在声卡驱动的这个小节,没有发现你的声卡类型,也可以手工自己加入一行,内容为
你的声卡类型_load = "YES" )
或直接在内核编译来支持声卡。
device sound
device snd_ich

++定制内核
/stand/sysinstall–>Configure–>Distributions–>src–>sys
安装后应该有/usr/src/sys文件夹
/boot/kernel/kernel #内核文件
cd /usr/src/sys/i386/conf && cp GENERIC GENERIC.bak
vi GENERIC #根据文档注释修改即可,不需要的行首加#
#cpu   I486_CPU
#cpu   I586_CPU
cpu   I686_CPU
ident   NEWKER   \\这里改成你内核的新名字
options SC_DISABLE_REBOOT \\在控制台禁用CTRL+ALT+DEL键
\\加入防火墙
options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=5
options TCP_DROP_SYNFIN
\\下面这两条不加 apache2有点问题
options ACCEPT_FILTER_DATA
options ACCEPT_FILTER_HTTP
# PCI Ethernet NICs. #将这一部分的其它网卡型号注释掉,仅保留当前网卡驱动即可
device   miibus   # MII bus support \\保留
/usr/sbin/config GENERIC #产生内核源代码
cd ../compile/GENERIC
make depend && make && make install
或#make buildkernel KERNCONF=NEWKER  
#make installkernel KERNCONF=NEWKER

++配置防火墙
/etc/rc.conf
\\加入以下内容
firewall_enable="YES"
firewall_script="/etc/rc.firewall"
firewall_type="/etc/ipfw.rules" \\这是防火墙自定义脚本
firewall_quiet="NO"
firewall_logging_enable="YES"
log_in_vain="NO"
tcp_drop_synfin="NO"
tcp_restrict_rst="YES"
icmp_drop_redirect="YES"
保存退出
vi /etc/ipfw.rules
\\ 大家注意 -q 前面要加一个空格
-q -f flush
-q add 00301 allow all from any to any via lo0
-q add 00302 check-state
-q add 00303 allow tcp from any to 10.72.255.131 53 out via vr0 setup keep-state   \\ 10.72.255.131 是DNS地址,大家根据本地的改下
-q add 00400 allow udp from any to 10.72.255.131 53 out via vr0 keep-state     \\   vr0 是我网卡的名称,大家根据己的改,以下都是一样
-q add 00500 allow tcp from any to any 80 in via vr0 setup keep-state
-q add 00900 allow tcp from any to any 25 out via vr0 setup keep-state
-q add 01200 allow tcp from any to any via vr0 setup keep-state uid root
-q add 01300 allow icmp from any to any in via vr0   keep-state
-q add 01400 allow tcp from any to any 21 in via vr0 setup keep-state
-q add 01500 allow tcp from any to me   21 in via vr0 setup limit src-addr 2
-q add 01600 allow tcp from any to any 22 in via vr0 setup keep-state
-q add 01800 allow tcp from any to me   22 in via vr0 setup limit src-addr 2
保存退出

++中文字体
将xp上simsun.ttc tahoma.ttf拷至/usr/X11R6/lib/X11/fonts/TTF/,并改扩展名为ttf
fc-cache -fv

++配置fcitx
cd /usr/ports/chinese/fcitx
make install clean
在~/.profile 文件中加以下三行 #因我用的是bash
export LANG="zh_CN.eucCN"
export LC_CTYPE="zh_CN.eucCN"
export

++vim配置
cd /usr/ports/editors/vim && make install clean #安装vim
cp /usr/local/share/vim/vim70/vimrc_example.vim ~/.vimrc
编辑.vimrc,注释掉" set nocompatible行

++安装ntfs写支持
安装 Kernel source
手工下载软件包
http://ftp.lv.freebsd.org/pub/FreeBSD/ports/packages/Latest/fusefs-ntfs.tbz
pkg_add path/fusefs-ntfs.tbz

++JAVA环境安装
1.open http://www.sun.com/software/java2/download.html, download the SCSL Source file,jdk-1_5_0-src-scsl.zip and the SCSL Binaries file, jdk-1_5_0-bin-scsl.zip .
2.In addition, please download the patchset, bsd-jdk15-patches-3.tar.bz2, from http://www.eyesbeyond.com/freebsddom/java/jdk15.html.
3.manually fetch the J2SE SDK self-extracting file for the Linux platform (j2sdk-1_4_2_12-linux-i586.bin) from http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=j2sdk-1.4.2_12-oth-JPR&SiteId=JSC&TransactionId=noreg
4.Please place the downloaded file(s) in /usr/ports/distfiles
pkg_add -rK m4
pkg_add -rK zip

++vsftpd配置
编辑 /usr/local/etc/vsftpd.conf加入三行
listen=YES
ftp_username=ftp
local_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
write_enable=YES
/usr/local/libexec/vsftpd #launching vsftpd

++linux下fdisk工具
pkg_add -rK linuxfdisk

++apache安装
cd /usr/ports/www/apache22
make install clean
解决 "Failed to enable the 'httpready' Accept Filter"问题
将accf_http_load="YES"添加至 /boot/defaults/loader.conf

===其它===
++挂设备
mount_cd9660 -C gbk /dev/acd0 /mnt/cdrom #加-C eucCN为了显示中文文件名
mount_msdosfs #fat
mount_ntfs     #ntfs

++如何以关键字搜寻 ports
cd /usr/ports/
make search key=ldap
make search name=ldap #知道软件名用这个

make fetch-recursive

你可能感兴趣的:(#Freebsd)