当前位置:操作系统 > Unix/Linux >>

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.soAddType application/x-httpd-php .phpAddType 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#pw groupadd qmail#pw useradd qmailq -g qmail -d /usr/local/qmail -s /nonexistent#pw useradd qmailr -g qmail -d /usr/local/qmail -s /nonexistent#pw useradd qmails -g qmail -d /usr/local/qmail -s /nonexistent

  查看建好的用户和组#pw user show -a#pw group show -a

  安装Qmail#tar zxvf qmail-1.03.tar.gz//对Qmail打补丁#patch -p0 < qmail-103.patch#tar zxvf qmail-smtpd-auth-0.30.tar.gz#cd qmail-smtpd-auth-0.30#cp base* README.auth ../qmail-1.03#patch -d ../qmail-1.03 < auth.patch 编辑conf-qmail修改其中的路径为/usr/local/qmail这样qmail就安装到/usr/local/qmail目录下!默认是在/var/qmail目录下!

  

  //执行make检查#make setup check./config-fast cnfug.org//修正SMTP认证信息人员输入和任意更改电子邮件发信人地址的补丁#cp qmail-smtpd.c qmail-1.03/#patch < qmail-smtpd.patch.txt#make qmail-smtpd#cp qmail-smtpd /usr/local/qmail/bin/qmail-smtpd//建立邮件帐号的别名#cd /usr/local/qmail/alias#touch .qmail-postmaster .qmail-mailer-daemon .qmail-root#chmod 644 /usr/local/qmail/alias/.qmail*//建立Qmail启动文件#cp /usr/local/qmail/boot/home /usr/local/qmail/rc#perl -i -pe 's/Mailbox/Maildir/' /usr/local/qmail/rc#perl -i -pe 's/sendmail_enable="YES"/sendmail_enable="NONE"/' /etc/rc.conf#perl -i -pe 's/sendmail_submit_enable="YES"/sendmail_submit_enable="NO"/' /etc/defaults/rc.conf#perl -i -pe 's/sendmail_outbound_enable="YES"/sendmail_outbound_enable="NO"/' /etc/defaults/rc.conf#perl -i -pe 's/sendmail_msp_queue_enable="YES"/sendmail_msp_queue_enable="NO"/' /etc/defaults/rc.conf#mv /usr/lib/sendmail /usr/lib/sendmail.bak(在FreeBSD下该命令不需要)#mv /usr/sbin/sendmail /usr/sbin/sendmail.bak#chmod u+x /usr/local/qmail/bin/sendmail#ln -s /usr/local/qmail/bin/sendmail /usr/lib/sendmail(在FreeBSD下该命令不需要)#ln -s /usr/local/qmail/bin/sendmail /usr/sbin/sendmail#mkdir -p /etc/qmail#echo "csh -cf '/usr/local/qmail/rc &'">>/etc/qmail/start#echo "/etc/qmail/smtp.sh">>/etc/qmail/starttar zxvf ucspi-tcp-0.88.tar.gzcd ucspi-tcp-0.88 修改conf-home为/usr/local/qmail(安装到路径/usr/local/qmail/bin/目录下) #vi conf-homemakemake setup check//生成tcp.smtp.cdbecho "127.0.0.1:allow,RELAYCLIENT=""" > /etc/qmail/tcp.smtp/usr/local/qmail/bin/tcprules /etc/qmail/tcp.smtp.cdb /etc/qmail/tcp.smtp.tmp < /etc/qmail/tcp.smtp检查qmaild的uid和gid pw user show qmaildqmaild:*:3308:3307::0:0:User &:/usr/local/qmail:/nonexistent

  它的uid是3308,gid是3307
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,