启动IPF防火墙
一个典型的IPF配置
#== default block
block in quick on rl0 from 192.168.0.0/16 to any
block in quick on rl0 from 172.16.0.0/12 to any
block in quick on rl0 from 10.0.0.0/8 to any
block in quick on rl0 from 127.0.0.0/8 to any
block in quick on rl0 from 0.0.0.0/8 to any
block in quick on rl0 from 169.254.0.0/16 to any
#== TCP
block in on rl0 proto tcp from any to any
block out on rl0 proto tcp from any to any
#service
pass in quick on rl0 proto tcp from any to any port=80 keep state
pass in quick on rl0 proto tcp from any to any port=443 keep state
#client
pass out quick on rl0 proto tcp from any to any port=20 keep state
pass out quick on rl0 proto tcp from any to any port=21 keep state
pass out quick on rl0 proto tcp from any to any port=80 keep state
pass out quick on rl0 proto tcp from any to any port=443 keep state
pass out quick on rl0 proto tcp from any to any port=5999 keep state #for cvsup/csup
###UDP
block in on rl0 proto udp all
block out on rl0 proto udp all
pass out quick on rl0 proto udp from any to any port=53 keep state
配置网络
如果是DHCP的话直接写ifconfig_xxx = "DHCP" 就可以了。
安装mysql
cd /usr/ports/databases/mysql51-server/ make
记得要在rc.conf中增加mysql_enable="YES",否则手工启动脚本也会没反应。
安装PHP
如果你打算用apache联php的话,还是不要使用sysinstall安装了,那样安装的结果是没有libphp5.so。老老实实去/usr/ports/lang/php5 下去make,记得带上apache22的选项。然后把下面的语句添加到合适的地方。
AddType application/x-httpd-php .php
AddType application/x-httpd-source .phps
书写PHP
奇怪的是,PHP似乎并不能自动使用UTF-8方式连接数据库,所以要在PHP中加入以下几句:
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER_SET_CLIENT=utf8");
mysql_query("SET CHARACTER_SET_RESULTS=utf8");
安装Apache
Apache可以使用sysinstall从DVD直接安装。
在/boot/loader.conf中可以增加accf_http_load="YES",这个accf的功能:function is to buffer incoming connections until a certain complete HTTP requests arrive. 具体见Http://www.mydigitallife.info/2006/04/23/freebsd-apache-http-accept-filter-error/
启用ftp & ssh
ftpd & ssh是inetd的一部分,所以需要配置和启用inetd 将
ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l一行的#号去掉。
正确处理DHCP和resov.conf的关系
在/etc/dhclient.conf中加入
static dns: interface "vr0"{
prepend domain-name-services xx.xx.xx.xx, x.x.x.x;
}
Color
$ export TERM=xterm
$ alias ls=’ls –G’
万一
万一你的网络在某个内网里,只能用proxy的话: 不要相信 export HTTP_PROXY=ip:port 可以确保你的make时引发的fetch能正确执行。那个是骗小孩的~~
躲在防火墙后
csh下设定Proxy的环境变量:
setenv http_proxy 192.168.14.1:8080
setenv ftp_proxy 192.168.14.1:8080
bash下:
export http_proxy=proxyserver:port
export ftp_proxy=proxyserver:port
使用WGET获取ports
上面设定好之后,让我们替换掉FreeBSD中最白痴的一个工具fetch,这个东西在配置了ftp_proxy甚至不能够穿越HTTP Proxy进行ftp获取操作,为此,我们必须启用wget - 或者更强大的多线程工具。如果你跟我一样在Firewall后面无发下手make wget的话,你可以从其他机器上直接copy一个 wget文件到本地的/usr/local/bin下。
然后在/etc/make.conf中添加如下文字,如果没有这个文件就手工建立:
FETCH_BINARY=/usr/local/bin/wget
FETCH_ARGS=-nc
DISABLE_SIZE=yes
DISABLE_SIZE必须设上,否则一个只有fetch才能解释的arg就跑到wget头上去了。
-nc是强制覆盖,必须设上,否则wget会不停的在后面增加.1 .2 .3 .4。
前面之所以要强调在环境里写是因为在网络上充斥这这样的白痴赋值写法:
FETCH_ENV=http_proxy=http://proxy2.zsu.edu.cn:3128
FETCH_ENV=ftp_proxy=http://proxy2.zsu.edu.cn:3128
这是错误的,只要有一点赋值的概念就知道为什么错了。。。
JDK
从安装复杂度到使用程度来说,装Diablo-jdk15之类的东西要远比jdk16要省心,要安全。
SUN-WTK
very few people come to this far,however I need this.
First of all you should enable linux binary compatible : kldload linux and you should also put linux_enable="YES" in
rc.conf.
And then you should build /usr/ports/emulators/linux_base-fc4, yes perverify required some DLLs.
then you should build /usr/ports/x11/linux-xorg-libs, yes preverify1.1 link to X11.
没有评论:
发表评论