FreeBSD 6.1 入门级Web服务器配置手记
日期:2006-10-11 1:39:40 点击: 作者:HarbinBe… 来源:互联网 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】
二、系统更新和优化
同步系统时间
QUOTE:
# ntpdate clepsydra.dec.com
安装cvsup
QUOTE:
# pkg_add –r cvsup-without-gui ; rehash
选择需要更新的内容(如果不在乎更新时间的话可以跳过)
可以有选择地更新系统源码和ports树,参考http://doc.code365.net/Manual/FreeBSD_HandBook/cvsup.html
关于release跟stable的选择:从字面上理解,stable是稳定版之意,并且好多人认为stable是做服务器的最佳选择。不过官方称stabel只不过是current的一个分支,并不推荐用于生产服务器,生产级服务器应选择release(正式发行)版本http://doc.code365.net/Manual/FreeBSD_HandBook/current-stable.html
QUOTE:
# ee /usr/share/examples/cvsup/standard-supfile
# ee /usr/share/examples/cvsup/ports-supfile
更新系统源码跟ports树
根据自己网络情况选择速度最快的cvsup镜像站点,官方列表http://doc.code365.net/Manual/FreeBSD_HandBook/cvsup.html
QUOTE:
# cvsup -L 2 -h cvsup3.tw.freebsd.org /usr/share/examples/cvsup/standard-supfile ; rehash ;
# cvsup –L 2 –h cvsup3.tw.freebsd.org /usr/share/examples/cvsup/ports-supfile ; rehash
编译内核
QUOTE:
# dmesg | more #获得当前设备资源列表
# cd /usr/src/sys/i386/conf
# cp GENERIC MYKERNEL
# ee MYKERNEL
# 具体选项请参考http://doc.code365.net/Manual/FreeBSD_HandBook/kernelconfig-config.html
其中需要注意的是
CODE:
ident MYKERNEL #内核标记名称
options QUOTA #启用磁盘配额
QUOTE:
# cd /usr/src
# make -j4 buildworld ; rehash ; make –j4 buildkernel KERNCONF=MYKERNEL ; rehash ; make –j4 installkernel KERNCONF=MYKERNEL ; reboot
QUOTE:
# cd /usr/src
# mergemaster –p ; make –j4 installworld ; mergemaster ; reboot
(出现提示,回车继续,或输入i安装)
QUOTE:
#cd /usr/obj
#chflags -R noschg *
#rm -rf *
网络优化
QUOTE:
# ee /etc/sysctl.conf
CODE:
net.inet.ip.check_interface=1
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.tcp.recvspace=65535
net.inet.tcp.sendspace=65535
kern.ipc.somaxconn=32768
kern.ipc.maxsockbuf=2097152
net.inet.ip.redirect=0
net.inet.icmp.icmplim=100
net.inet.tcp.always_keepalive=1
net.inet.tcp.delayed_ack=1
net.inet.udp.maxdgram=65535
net.local.stream.sendspace=65535
net.local.stream.recvspace=65535
kern.maxfiles=65536
kern.maxfilesperproc=65536
net.inet.udp.checksum=1
net.inet.tcp.msl=7500
net.inet.tcp.syncookies=1
net.inet.icmp.bmcastecho=0
net.inet.icmp.maskrepl=0
kern.securelevel=0
QUOTE:
# ee /boot/loader.conf
CODE:
kern.maxdsiz="536870912"
kern.ipc.maxsockets="4008"
kern.ipc.nmbclusters="32768"
kern.ipc.nmbufs="65535"
kern.ipc.nsfbufs="2496"
net.inet.tcp.tcbhashsize="2048"
安装多线程下载工具axel
QUOTE:
# cd /usr/ports/ftp/axel
# make install clean ; rehash
默认选项
QUOTE:
# ee /etc/make.conf
CODE:
FETCH_CMD=axel
FETCH_BEFORE_ARGS= -n 10 -a
FETCH_AFTER_ARGS=
DISABLE_SIZE=yes
MASTER_SITE_OVERRIDE?=\
http://ports.hshh.org/${DIST_SUBDIR}/\
ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/\
ftp://ftp.jp.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/\
ftp://ftp.freeBSDchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>

