CNFUG服務器實現過程

前言:
本文著重描述CNFUG服務器具體的配置過程,其中包括了Apache,MySQL,Php,Qmail,Qmailadmin,vpopmail等……
這算是一個完整的服務器的配置過程了!希望大家看了這篇文檔能夠有所啟發,能夠更加靈活的運用FreeBSD構建
更強大的服務!
系統環境:
FreeBSD 4.8 Stable(具體如何將系統升級到Stable我就不多說了,請參考FreeBSD的Handbook)
Qmail安裝路徑/usr/local/qmail/
Vpopmail安裝路徑/home/vpopmail/
Apache安裝路徑/server/httpd/
Forum路徑/www/cnfug/forum/htdocs/
Mail主頁路徑/www/cnfug/mail/htdocs/
Mail-cgi-bin路徑/www/cnfug/mail/cgi-bin/
MySQL安裝路徑/server/mysql/
php安裝路徑/server/php/
源碼存放路徑/source/src/
源碼編譯路徑/source/build/

安裝MySQL
添加MySQL相應的用戶和組 #pw groupadd mysql -g 3306
#pw useradd mysql -u 3306 -c "MySQL Daemon" -d /server/mysql -g 3306 -s /nonexitent
#tar zxvf mysql-4.0.13.tar.gz -C /server/build
#cd /server/build/mysql-4.0.13/
#./configure --prefix=/server/mysql --with-mysqld-ldflag=all-static --with--charset=gbk --with-low-memory --enable-assembler --disable-shared --without-docs
#make
#make install
#scripts/mysql_install_db (安裝數據庫)
#cp support-files/my-medium.cnf /etc/my.cnf
#vi /etc/my.cnf 添加user=mysql 如果你想讓你的數據庫獨立出來,可以指定數據庫的路徑
在/etc/my.cnf中添加 datadir=/www/MySQL/data cp /server/mysql/lib/mysql/libmysqlclIEnt* /usr/lib/ //這一步非常重要,不然在后面使用vpopmail添加domain時候會報錯//安全設置:修改權限 #chown -R mysql:mysql /server/mysql
#chmod -R go-xwr /server/mysql#/server/mysql/bin/mysqld_safe &
#/server/mysql/bin/mysqladmin -u root passWord "newpassword" //修改MySQL的root密碼!重要!
#/server/mysql/bin/mysql -u root -p 輸入你的密碼!你現在就應該可以用MySQL了!
添加MySQL用戶:
mysql>use mysql;
//建立vpopmail和ezmlm需要的用戶和相應的數據庫
mysql>grant select,insert,update,delete,create,drop on vpopmail.* to vpopmail@localhost identified by "12345678";
mysql>grant select,insert,update,delete,create,drop on ezmlm.* to ezmlm@localhost identified by "12345678";
mysql>create database vpopmail;
mysql>create database ezmlm;
mysql>show status;
mysql>status;
mysql>show databases;安裝Apache
添加Apache相關的用戶和組(默認FreeBSD已經建立了該用戶,如果沒有請添加) #pw groupadd www -g 80
#pw useradd www -u 80 -c "World Wide Web Owner" -d /server/httpd -g 80 -s /nonexitent如果有,請做如下修改 #pw usermod www -d /server/httpd -s /nonexitent
#tar zxvf httpd-2.0.47.tar.gz -C /source/build
#cd /source/build/httpd-2.0.47/
#./configure --prefix=/server/httpd --enable-mods-shared=all --enable-module=so --enable-ssl=shared --disable-status --disable-userdir --enable-suexec=shared
#make
#make install
#chown -R www:www /server/httpd
#/server/httpd/bin/apachectl start
安裝PHP #tar jxvf php-4.3.2.tar.bz2 -C /source/build/
#cd /source/build/php-4.3.2/
#./configure --prefix=/server/php --enable-track-vars --with-mysql=/server/mysql --with-apxs2=/server/httpd/bin/apxs --with-gd=/usr/server/gd(可選)
#make
#make install
#cp php.ini-recommended /server/php/lib/php.ini 在/server/httpd/conf/httpd.conf中添加如下腳本LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps(這一行可以不添加)

安裝Qmail
//建立安裝目錄
mkdir -p /usr/local/qmail/alias
//建立相關的用戶和組
#pw groupadd nofiles
#pw useradd alias -g nofiles -m -d /usr/local/qmail/alias -s /nonexistent
#pw useradd qmaild -g nofiles -d /usr/local/qmail -s /nonexistent
#pw useradd qmaill -g nofiles -d /usr/local/qmail -s /nonexistent
#pw useradd qmailp -g nofiles -d /usr/local/qmail -s /nonexistent

推薦閱讀