1.编辑安装新的内核(请谨慎,不熟悉的话可以跳过)
web# /stand/sysinstall
web# cd /usr/src/sys/i386/conf
web# cp GENERIC Gadfly
web# dmesg | grep "not found"
web# ee Gadfly 根据情况适当修改内核(请谨慎)
web# cd /usr/src
web# make buildkernel KERNCONF=Gadfly
web# make installkernel KERNCONF=Gadfly
2.使用CVSup升级Ports Tree
web# mount /cdrom
web# pkg_add /cdrom/pakgages/net/cvsup-16.1h.tbz
web# pkg_add ftp://ftp.cn.freebsd.org/pub/FreeBSD/releases/i386/5.3-RELEASE/packages/devel/cvsup-16.1h.tbz
web# cp /usr/share/examples/cvsup/ports-supfile /usr/ports
web# ee /usr/ports/ports-supfile *default host=cvsup.cn.freebsd.org
web# cvsup -g -L 2 /usr/ports/ports-supfile
web# cd /usr/ports
web# make fetchindex
3.使用Ports方式安装部分工具软件(视情况而定,不需要完全安装,但expat2、gettext、gmake必须安装)
web# cd /usr/ports/textproc/expat2
web# make deinstall
web# make install clean
web# cd /usr/ports/devel/gettext
web# make deinstall clean
web# make install clean
web# cd /usr/ports/devel/zziplib
web# make install clean
web# cd /usr/ports/devel/readline
web# make install clean
web# cd /usr/ports/lang/perl5.8
web# make install clean
web# /usr/local/bin/use.perl port
web# cd /usr/ports/devel/glib20
web# make install clean
web# cd /usr/ports/devel/gmake
web# make install clean
web# cd /usr/ports/lang/gcc40
web# make install clean
web# cd /usr/ports/security/openssl
web# make install clean
web# pkg_delete linux_base-6.1_6
web# cd /usr/ports/emulators/linux_base
web# make install clean
web# cd /usr/ports/archivers/zip
web# make install clean
web# cd /usr/ports/archivers/rar
web# make install clean
web# cd /usr/ports/archivers/gzip
web# make install clean
web# cd /usr/ports/security/p5-Digest-MD5
web# make install clean
web# cd /usr/ports/security/p5-Authen-PAM
web# make install clean
web# cd /usr/ports/security/p5-Net-SSLeay
web# make install clean
4.使用Ports方式安装PostgreSQL8
web# cd /usr/ports/databases/postgresql80-server
web# make install clean
web# cd /usr/ports/databases/p5-DBD-Pg
web# make install clean
web# cd /usr/ports/security/pam-pgsql
web# make install clean
web# mkdir /var/db/pgsql
web# chown -R pgsql:pgsql /var/db/pgsql
web# ee /usr/local/pgsql/.profile PGDATA=/var/db/pgsql
web# su - pgsql
web# /usr/local/bin/initdb -D /var/db/pgsql
web# /usr/local/bin/postmaster -D /var/db/pgsql >logfile 2>&1 &
web# /usr/local/bin/createdb -E EUC_CN test
web# ee /var/db/pgsql/postgresql.conf listen_addresses = '*'
web# ee /var/db/pgsql/pg_hba.conf host all all 0.0.0.0 0.0.0.0 md5
web# exit
web# ee /etc/rc.conf
postgresql_enable="YES"
postgresql_data="/var/db/pgsql"
postgresql_flags="-w -s -m fast"
5.使用Port方式安装APACHE2
web# cd /usr/ports/www/apache2
web# make install clean
web# cd /usr/ports/www/mod_limitipconn2
web# make install clean
6.使用Ports方式安装php5-extensions
web# cd /usr/ports/lang/php5-extensions
web# make install clean
web# cd /usr/ports/datebases/phppgadmin
web# make install clean
web# mv /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
web# ee /usr/local/etc/php.ini
session.save_path = /tmp/session
max_execution_time=60
memory_limit=20M
post_max_filesize=10M
file_uploads=on
upload_max_filesize=10M
web# ee /usr/local/etc/apache2/httpd.conf
LoadModule limitipconn_module libexec/apache2/mod_limitipconn.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
Alias /phppgadmin "/usr/local/share/phpPgAdmin/"
web# mkdir /tmp/session
web# chmod -R 0755 /tmp/session
web# chown -R www:www /tmp/session
7.配置APACHE2和SSL
(1)下载并解压缩证书生成程序
web# cd /home/Gadfly
web# wget http://www.openssl.org/contrib/ssl.ca-0.1.tar.gz
web# tar zxf ssl.ca-0.1.tar.gz -C /usr/src/tools
(2)手工签属一个可用的证书
web# cd /usr/local/etc/apache2
web# /usr/src/tools/ssl.ca-0.1/new-root-ca.sh
web# /usr/src/tools/ssl.ca-0.1/new-server-cert.sh server
web# /usr/src/tools/ssl.ca-0.1/sign-server-cert.sh server
注:后面三个命令执行时会有一系列的问题需要回答:密码、省份、城市、机构 ...,commonName 设成跟你的ServerName一样,不然 apache 启动中会生成错误日志。
(3)到 /usr/local/etc/apache2 目录下面建两个目录,将生成的四个文件放到新目录中
web# mkdir ssl.crt ssl.key
web# mv ca.crt /usr/local/etc/apache2/ssl.crt
web# mv ca.key /usr/local/etc/apache2/ssl.key
web# mv server.crt /usr/local/etc/apache2/ssl.crt
web# mv server.key /usr/local/etc/apache2/ssl.key
(4)修改属性,以策安全
web# chmod 444 /usr/local/etc/apache2/ssl.key/server.key
web# chmod 444 /usr/local/etc/apache2/ssl.key/ca.key
web# chmod 444 /usr/local/etc/apache2/ssl.crt/server.crt
web# chmod 444 /usr/local/etc/apache2/ssl.crt/ca.crt
(5)修改ssl.conf文件
web# ee /usr/local/etc/apache2/ssl.conf
SSLCertificateFile /usr/local/etc/apache2/ssl.crt/server.crt
(6)设置开机起动APACHE和SSL
web# ee /etc/rc.conf
apache2_enable="YES"
apache2ssl_enable="YES"
8.安装PostgreSQL数据库PLPHP过程语言支持
web# cd /usr/ports/distfiles
web# tar jxvf php-5.0.3.tar.bz2 -C /usr/src/tools
web# cd postgresql
web# tar jxvf postgresql-base-8.0.1.tar.bz2 -C /usr/src/tools
web# tar jxvf postgresql-opt-8.0.1.tar.bz2 -C /usr/src/tools
web# wget http://www.commandprompt.com/files/plphp-8.x.tar.bz2
web# tar jxvf plphp-8.x.tar.bz2 -C /usr/src/tools
web# cd /usr/src/tools/php-5.0.3
web# ./configure --disable-all
web# make libphp5.la
web# cd ../postgresql-8.0.1
web# autoconf253
web# patch -p1 < ../plphp.patch
web# ./configure --libdir=/usr/local/lib/postgresql --with-php=/usr/src/tools/php-5.0.3
web# cd src/pl/plphp
web# ee Makefile
php_src = /usr/src/tools/php-5.0.3
php_major_version = 5
web# gmake
web# gmake install
web# cp /usr/local/pgsql/lib/plphp.so /usr/local/lib/postgresql
CREATE FUNCTION plphp_call_handler() RETURNS LANGUAGE_HANDLER AS 'plphp' LANGUAGE C; CREATE TRUSTED LANGUAGE plphp HANDLER plphp_call_handler;
CREATE FUNCTION plpgsql_call_handler () RETURNS language_handler AS '$libdir/plpgsql' LANGUAGE C; CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL';
9.配置PostgreSQl最大连接数 以至强2.4,1G内存的Web用途服务器为例
web# ee /var/db/pgsql/postgresql
max_connections = 256
shared_buffers = 4096
web# ee /usr/src/sys/i386/conf/Gadfly
options SHMMAXPGS=16384
options SHMSEG=256
options SEMMNI=256
options SEMMNS=512
options SEMMNU=256
options SEMMAP=256
web# cd /usr/src
web# make buildkernel KERNCONF=Gadfly
web# make installkernel KERNCONF=Gadfly
10.配置CVS版本控制服务器
web# cd /usr/ports/devel/cvsd
web# make install clean
创建 cvsd 用户: 用户组为cvsd,用户目录为/home/cvsd
web# cp /usr/local/etc/cvsd/cvsd.conf.sample /usr/local/etc/cvsd/cvsd.conf
web# ee /usr/local/etc/cvsd/cvsd.conf
RootJail /home/cvsd
Repos /cvsroot 将目录cvsroot 加入cvsd.conf的最后一行
web# su - cvsd
web# /usr/local/sbin/cvsd-buildroot /home/cvsd/ 初始化虚根目录
web# mkdir /home/cvsd/cvsroot 创建 cvsroot 目录
web# cvs -d /home/cvsd/cvsroot init 初始化cvs目录
web# cvsd-passwd /home/cvsd/cvsroot/ +cvsuser:Gadfly 建立cvs用户Gadfly
web# exit
web# ee /etc/inetd.conf
cvspserver stream tcp nowait cvsd /usr/bin/cvs cvs --allow-root=/home/cvsd/cvsroot pserver
web# cp /usr/local/etc/rc.d/cvsd.sh.sample /usr/local/etc/rc.d/cvsd.sh
web# chmod +x /usr/local/etc/rc.d/cvsd.sh
web# /usr/local/etc/rc.d/cvsd.sh start
设定环境变量:
web# ee /etc/profile
CVSROOT=:pserver:anonymous@localhost:/PHP_project; export CVSROOT;
web# ee /etc/csh.cshrc
setenv CVSROOT :pserver:anonymous@localhost:/PHP_project
|
请发表评论