在FreeBSD上组建ISP级的邮件系统( 二 )


setenv CLICOLOR yes
set autolist
然后执行
sed -i.bak -E s/set prompt/#set prompt/g /root/.cshrc
退出重新登陆即可看到彩色目录了 。
D、更新软件包
采用FreeBSD 最好的地方就是安装软件方便 , 还可以装到最新的软件包 , 这就是强大的posts 系统 。如果你的系统在安装时没有选择posts ,具休如何操作看BSD 的handbook.
CVSUP 的站点很多 , 你可以选择离你最快的站点去更新posts , 具体查看 freebsd.org /freebsdchina.org.cn
在使用cvsup之前你必须连接到互联网 , 并需要安装cvsup 这个软件
假如你的服务器在内网里 , 并通过DMZ 进行IP映射 , 可以参考下面设置:
sshd_enable="YES"
fsck_y_enable="YES"
hostname="mail.extmail.org"
ifconfig_rl0="inet 192.168.1.1 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
如果你使用的是ADSL 拔号
a、修改/etc/ppp/ppp.conf
default:
set log Phase tun command # you can add more detailed logging if you wish
set ifaddr 10.0.0.1/0 10.0.0.2/0
ADSL:
set device PPPoE:vr0 # 将vr0 改为你拔号的网卡
set authname 你的ADSL 帐号
set authkey 你的ADSL密码
set dial
set login
add default HISADDR
b、/etc/rc.conf 内容
inetd_enable="YES"
sshd_enable="YES"
fsck_y_enable="YES"
hostname="mail.extmail.org"
ifconfig_rl0="inet 192.168.1.1 netmask 255.255.255.0"
ppp_enable="YES" #YES or NO
ppp_mode="ddial" #"auto", "ddial", "direct" or "dedicated".
ppp_nat="YES" # if you want to enable nat for your local network, otherwise NO
ppp_profile="adsl" #/etc/ppp/ppp.conf
c、安装cvsup-without-gui
?/usr/ports/net/cvsup-without-gui/
%make install clean
d、更新ports
安装完cvsup软件后 , 对ports 进行更新
%/usr/local/bin/cvsup -gL 2 -h cvsup4.FreeBSDchina.org /usr/share/examples/cvsup/ports-supfile
三、安装数据库 MySQL
MySQL 版本很多 , 大家可以据自己需要自行选择喜欢的版本安装 。
?/usr/ports/databases/mysql41-server/
%make install clean
在/etc/rc.conf 加入
mysql_enable="YES"
复制配置文件(非必需)
cp /usr/local/share/mysql/my-small.cnf /usr/local/etc/my.cnf
在此说明:
1、如果不在/etc/rc.conf 加入以上内容 , 手工是无法启动MySQL的 。
2、如果你想知道这个软件应该在/etc/rc.conf加入什么内容 , 打开/usr/local/etc/rc.d 目录 , 找到此软件的启动脚本 。然后打开文件 , 如果有详细的说明 。
%/usr/local/etc/rc.d/mysql-server.sh start
Starting mysql.
如何去检查一个服务是否正常启动:1、通过ps查看进程 , 2、检查所打开的端口 。
%ps aux|grep mysql
mysql 94899 0.2 0.5 1644 1240 p0 S 3:52PM 0:00.07 /bin/sh /usr/local/bin/mysqld_safe --
mysql 94919 0.0 10.8 55564 27428 p0 S 3:52PM 0:01.54 /usr/local/libexec/mysqld --defaults-
%
%netstat -an|grep 3306
tcp4 0 0 *.3306 *.* LISTEN
MySQL安装时 , 服务器的密码为空 , 建议你装好系统后 , 第一时间去更改密码 。
%/usr/local/bin/mysqladmin -u root -p passWord 你的新密码
Enter password:
如果你服务器只供本站内部使用建议在 my.cnf 里加入下面内容,以增加服务器的安全性 。
[mysqld]
bind_address=127.0.0.1
四、安装Apache
1、安装apache server
作为网络的今天apache web服务器已经是街知港闻了 。
?/usr/ports/www/apache22/
%make install clean
在/etc/rc.conf 中加入:
apache22_enable="YES"
如果启动时出现httpd: Could not reliably determine the server's fully qualifIEd domain name, using mail.sharesky.cn for ServerName 的错误 , 在/usr/local/etc/apache22/httpd.conf 约第144行的位置加入下面的内容 。

推荐阅读