粤ICP备11076303号  广州青年志愿者协会医疗服务总队 www.gzyld.org.cn
加入医疗队
加入志愿者

位置:GZ医疗队公益纪实公益站长网络技术

FreeBSD6.1入门级Web服务器配置手记(2)


来源:落伍者      作者:HarbinBeer      点击:次      时间:2007-06-18


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




[Copy to clipboard] [ - ]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




[Copy to clipboard] [ - ]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




[Copy to clipboard] [ - ]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}

应用程序及服务

基础环境

配置中文环境


QUOTE:
# ee /.cshrc




[Copy to clipboard] [ - ]CODE:
setenv EDITOR ee
setenv LC_ALL zh_CN.GBK
setenv LANG zh_CN.GBK
setenv LC_CTYPE zh_CN.GBK




QUOTE:
# cd /usr/ports/chinese/cce/
# make install clean ; rehash

以后就可以通过cce命令来启动中文环境了

安装perl


QUOTE:
# cd /usr/ports/lang/perl5.8
# make install clean ; rehash

安装openssl(可选)


QUOTE:
# cd /usr/ports/security/openssl
# make install clean ; rehash

安装Ports检查更新工具


QUOTE:
# cd /usr/ports/sysutils/portupgrade
# make install clean ; rehash

默认选项

AMP环境配置

安装mysql


QUOTE:
# cd /usr/ports/databases/mysql40-server
# make install clean ; rehash
# cd /usr/ports/databases/mysql40-scripts
# make install clean ; rehash
# /usr/local/bin/mysql_install_db
# ln -s /usr/local/lib/mysql/libmysqlclient.so.12 /usr/lib
# chown -R mysql /var/db/mysql
# chown -R root /var/db/mysql
# chown -R mysql:mysql /var/db/mysql
# chmod 700 /var/db/mysql

优化mysql


QUOTE:
# ee /etc/my.cnf




[Copy to clipboard] [ - ]CODE:
[mysqld]
skip-networking
skip-innodb
skip-bdb
skip-name-resolve
skip-locking
#log-bin
# 以下选项基于2G内存
key_buffer=512M
max_allowed_packet=4M
table_cache=1024
thread_cache=64
join_buffer_size=32M
sort_buffer=32M
record_buffer=32M
max_connections=512
wait_timeout=120
interactive_timeout=120
max_connect_errors=30000
long_query_time=1
max_heap_table_size=256M
tmp_table_size=128M
thread_concurrency=8
myisam_sort_buffer_size=128M

mysql随系统启动


QUOTE:
# cp /usr/local/etc/rc.d/mysql-server /usr/local/etc/rc.d/mysql.sh
# ee /etc/rc.conf




[Copy to clipboard] [ - ]CODE:
mysql_enable="YES"

启动mysql


[Copy to clipboard] [ - ]CODE:
# /usr/local/etc/rc.d/mysql-server.sh start

安装apache22


QUOTE:
# cd /usr/ports/www/apache22
# make install clean ; rehash

安装过程中,取消ipv6

新活动 回顶部
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
验证码: 点击我更换图片
最新评论 进入详细评论页>>