很多人经常问为什么我的邮件服务器向163.com /sina.com/yahoo.com.cn...都能收到 , 为什么回复的邮件却收不到 , 原因很简单 , 因为这些服务器不能找到你的域名的A记录或MX 记录 。很多人在安装时使用的域都是不合法的域名 , 即未经注册的DNS FQDN(完全限定名) 。如果你没有申请合法的域名 , 可以到 comexe.cn 3322.org 申请一个动态域名来收发邮件 。
本例中以 extmail.org 这个域为例 , 主机名为mail ,邮件服务器建立在DDNS 之上 。
打开Windows 的CMD 使用nslookup 查询extmail.org 的MX记录 , 如果你自己拥有固定IP可以创建自己的DNS , 如果你使用的是新网或其它域名供应商 , 进入后台添加一个记录即可 , 供体参考DNS 相关的内容 。
C:>nslookup -type=mx extmail.org 221.4.66.66
Server: ns2.cnc-gd.net
Address: 221.4.66.66
DNS request timed out.
timeout was 2 seconds.
Non-authoritative answer:
extmail.org MX preference = 20, mail exchanger = mx.extmail.org
extmail.org nameserver = ns2.xinnetdns.com
extmail.org nameserver = ns.xinnet.cn
extmail.org nameserver = ns.xinnetdns.com
extmail.org nameserver = ns2.xinnet.cn
mx.extmail.org internet address = 210.21.119.139
ns.xinnet.cn internet address = 210.51.171.209
ns.xinnetdns.com internet address = 210.51.170.66
ns2.xinnet.cn internet address = 210.51.170.67
ns2.xinnetdns.com internet address = 210.51.170.67
作为windows 高手的你 , 这点小事难不到你吧 。
二、安装FreeBSD A、系统分区
很多人在使用自己的作业系统时 , 不知道如何对系统分区 , 对于分区方案没有最好的 , 只是跟据自己的情况去分 。
下面是我的分区方案 。
硬盘为120G , /(根)1G 左右就差不多了 , 但考滤到/root 工作目录也在这里 , 所以分大一点 。
/home/data 主要是用来存放Email /ftp用户的数据
/tmp 1G 也是考虑到临时文件多 , 所以给大也点 。
/usr/ 10G 因为要安装软件 , 还有下载的软件 , 我没有装GUI 所以只分了10G我认为足够了 。
/var 3G这个目录存放的东西比较多 , 如日志、邮件的临时目录 , 如果空间不够amavisd-new 无法解开邮件进行杀毒 。
?-h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1a 1.9G 481M 1.3G 26% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ad0s1g 92G 353M 84G 0% /home/data
/dev/ad0s1e 989M 224K 910M 0% /tmp
/dev/ad0s1f 9.7G 1.8G 7.1G 20% /usr
/dev/ad0s1d 2.9G 105M 2.6G 4% /var
用户可以跟据自己的需要进行分区 。
B、安装基本系统
对于系统的安装 , 我选择了minimal(最小系统)和ports ,因为有些没必要的包就不装 , 减少系统体积 , 另外作为一台服务器 , 我从来不装GUI。
下载BSD时 , 只需要下载DISK 1 就行了 , 缺少的软件包可以通过网络安装 。
C、配置系统
如果你在安装后期没有配置系统 , 在系统启动完成后以root的身份登陆系统 , 运行sysinstall 进行设置 , 或通过ee编辑器编辑/etc/rc.conf文件 , 在这里提醒各位 , 一会大多数服务都需要在/etc/rc.conf加入启动内容才能正常启动 。
设置好固定IP , 或通过DHCP 自动分配置机器IP 。使用SSH 客户端进行管理服务器将会为你的工作提供方便 。
使用SSH 要注意:
a、不能用root直接登陆 , 需要添加一个新用户 , 指定到wheel 组,用此用户登陆后用使用 su - 提升到管理员 。
b、 以我的SecureCRT 为例,Session options ->Authentication ->Primary 选择keyboard Interactive
c、如果你要使用像Linux 一样的彩色显示 , 需要把 Emulation -> Terminal ->Xterm 选中ANSI Color 并在/etc/csh.cshrc加入
setenv LSCOLORS ExGxFxdxCxegedabagExEx
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行的位置加入下面的内容 。
ServerName mail.extmail.org
启动apahce
%/usr/local/etc/rc.d/apache22.sh start
Performing sanity check on apache22 configuration:
【在FreeBSD上组建ISP级的邮件系统】Syntax OK
Starting apache22.2、安装PHP?/usr/ports/lang/php4/
%make install cleanOptions for mod_php4 4.4.2_1,1 x
x lQQqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x [ ] DEBUG Enable debug x x
x x [X] MULTIBYTE Enable zend multibyte support x x
x x [ ] IPV6 Enable ipv6 support x x
x x [X] OPENSSL Build static OpenSSL extension
在/usr/local/etc/apache22/httpd.conf 里加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
加入目录索引 index.php , 约在httpd.conf 的212行
DirectoryIndex index.HTML index.php
restart或reload Apache 使之生效
%/usr/local/etc/rc.d/apache22.sh reload
Performing sanity check on apache22 configuration:
Syntax OK
Performing a graceful restart3、安装PHP 扩展?/usr/ports/lang/php4-extensions/
%make install clean在这里建议大家 , 如果没有必要尽量不要安装GD库免得浪费时间 , 大家可据自己需要选择安装模块
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Options for php4-extensions 1.0 x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x [ ] BCMATH bc style precision math functions x x
x x [X] BZ2 bzip2 library support x x
x x [ ] CALENDAR calendar conversion support x x
x x [ ] CRACK crack support x x
x x [X] CTYPE ctype functions x x
x x [X] CURL CURL support x x
x x [ ] DBA dba support x x
x x [ ] DBASE dBase library support x x
x x [ ] DBX dbx support x x
x x [ ] DIO Direct I/O support x x
x x [ ] DOMXML DOM support x x
x x [ ] EXIF EXIF support x x
x x [ ] FILEINFO fileinfo support x x
x x [ ] FILEPRO filePro support x x
x x [ ] FRIBIDI FriBidi support
x x [X] FTP FTP support x x
x x [ ] GD GD library support x x
x x [X] GETTEXT gettext library support x x
x x [ ] GMP GNU MP support x x
x x [X] ICONV iconv support x x
x x [ ] IMAGICK ImageMagick support x x
x x [X] IMAP IMAP support x x
x x [ ] INTERBASE Interbase 6 database support (Firebird) x x
x x [ ] LDAP OpenLDAP support x x
x x [X] MBSTRING multibyte string support x x
x x [ ] MCAL Modular Calendar Access Library support x x
x x [X] MCRYPT Encryption support x x
x x [ ] MCVE MCVE support x x
x x [ ] MHASH Crypto-hashing support x x
x x [ ] MING ming shockwave Flash support x x
x x [ ] MNOGOSEARCH mnoGoSearch support x x
x x [ ] MSSQL MS-SQL database support x x
x x [X] MYSQL MySQL database support x x
x x [ ] NCURSES ncurses support (CLI only) x x
x x [ ] ODBC UnixODBC support x x
x x [X] OPENSSL OpenSSL support x x
x x [ ] ORACLE Oracle support x x
x x [X] OVERLOAD user-space object overloading support x x
x x [ ] PANDA panda support x x
x x [ ] PCNTL pcntl support (CLI only) x x
x x [X] PCRE Perl Compatible Regular Expression support x x
x x [ ] PDF PDFlib support (implIEs GD) x x
x x [ ] PFPRO PayFlow Pro support x x
x x [ ] PGSQL PostgreSQL database support x x
x x [X] POSIX POSIX-like functions x x
x x [ ] PSPELL pspell support x x
x x [ ] READLINE readline support (CLI only) x x
x x [ ] RECODE recode support x x
x x [X] SESSION session support x x
x x [ ] SHMOP shmop support x x
x x [ ] SNMP SNMP support x x
x x [ ] SOCKETS sockets support x x
x x [ ] SYBASE_CT Sybase database support x x
x x [ ] SYSVMSG System V message support x x
x x [ ] SYSVSEM System V semaphore support x x
x x [ ] SYSVSHM System V shared memory support x x
x x [X] TOKENIZER tokenizer support x x
x x [ ] WDDX WDDX support (implies XML) x x
x x [X] XML XML support x x
x x [ ] XMLRPC XMLRPC-EPI support x x
x x [ ] XSLT XSLT Sablotron support x x
x x [ ] YAZ YAZ support (ANSI/NISO Z39.50) x x
x x [ ] YP YP/NIS support x x
x x [ ] ZIP ZIP support x x
x x [X] ZLIB ZLIB support x x
4、安装phpmyadmin 管理数据库
为了去除无聊的安装过程 , 这里选择手工安装 , 先下载软件包 , 然后解压 , 再复制到/usr/local/www/apache22/data 下面
?/usr/ports/databases/phpmyadmin/
%make fetch
?/usr/ports/distfile
%tar jxvf phpMyAdmin-2.7.0-pl2.tar.bz2
%cp -r /usr/ports/distfiles/phpMyAdmin-2.7.0-pl2 /usr/local/www/apache22/data/phpmyadmin
大家注意 , 可能你下载的版本与我下载的不一样 , 不能照搬 。
设置phpmyadmin?/usr/local/www/apache22/data/phpmyadmin/
?config.default.php
将$cfg['Servers'][$i]['auth_type'] = 'config'改为
$cfg['Servers'][$i]['auth_type'] = 'http'
打开http://ip/phpmyadmin 就可以管理你的mysql 数据库了
5、安装extman
extman 是extmail用户后台管理系统,官方网站为www.extmail.org 下载解压
%tar zxvf extman-13-20060102.tar.gz
?extman-0.13-20060102/docs
%mysql -u root -p
Enter passWord:
%mysql -u root -p
Enter password:
extmail.sql添加了两个MySQL用户
1、只读用户:extmail 密码:extmail
2、读/写用户:webman 密码:webman
init.sql 里 , 对extmail数据库添加了下面的记录
a、添加了一个别名记录 support@extmail.org ->test@extmail.org
b、增加了 extmail.org 域
c、增加了test@extmail.org的邮箱密码为test 。
d、增加了extman 的管理员root@extmail.org 密码为extmail
五、安装邮件系统
安装下面三个软件要注意先后顺序
1、安装 CourIEr-IMAP?/usr/ports/mail/courier-imap/
%make install clean
选择openssl、MySQL
在/etc/rc.conf 加入
courier_authdaemond_enable="YES"
courier_imap_pop3d_enable="YES"
courier_imap_imapd_enable="YES"
修改authdaemond的权限
%/usr/local/etc/rc.d/courier-authdaemond.sh start
%chmod -Rx /var/run/authdaemond/
authdaemond 启动完成后 , 检查/var/run/authdaemond 下面是否产生socket 文件 , 因为认证时是通过这个文件读取密码的 。
设置/usr/local/etc/authlib/authdaemonrc
%mv authdaemonrc authdaemonrc.bak
ee authdaemonrc
在authdaemonrc 加入下面的内容
authmodulelist="authmysql"
authmodulelistorig="authmysql"
version="authdaemond.mysql"
daemons=5
authdaemover=/var/run/authdaemond
subsystem=mail
DEBUG_LOGIN=2
DEFAULTOPTIONS="wbnodsn=1"
上面DEBUG_LOGIN=2 是为了调试方便 , 等系统完全测试完成 , 可改为 0 , 即不显示调试信息 。
设置/usr/local/etc/authlib/authmysqlrc
%mv authmysqlrc authmysqlrc.bak
ee authmysqlrc
加入下面的内容
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWord extmail
MYSQL_PORT 0
MYSQL_OPT 0
MYSQL_DATABASE extmail
MYSQL_SELECT_CLAUSE select username,password,"",uidnumber,gidnumber,
- 微信的账单怎么快速删除
- 球球大作战星际商店在哪
- 怎么开启陌生电话拦截
- 车牌上几个螺丝
- 手环亮度怎么调节
- 在腾讯文档中导出文档保存到本地的详细步骤
- 冻干粉怎么用在皮肤上
- 朱自清荷塘月色在清华哪里 朱自清的荷塘月色是在清华哪里
- 护照去哪里办
- 0是开还是1是开 开关上0是和1谁是开
