- A+
所属分类:Linux相关
1、Linux最小化安装
2、配置网卡,配置DNS,配置seLinux,配置防火墙,配置ssh。
1 2 3 4 5 6 7 8 9 10 11 12 |
DEVICE=eth0 HWADDR=00:0C:29:8F:FF:18 TYPE=Ethernet UUID=4862300c-8431-4d10-b380-8a005a234a4a ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=172.16.70.20 NETMASK=255.255.255.0 GATEWAY=172.16.70.1 DNS1=8.8.8.8 DNS2=8.8.4.4 |
配置防火墙
1 2 3 4 5 |
iptables -A INPUT -p tcp --dport 21 -j ACCEPT iptables -A INPUT -p tcp --dport 25 -j ACCEPT iptables -A INPUT -p tcp --dport 110 -j ACCEPT iptables -A INPUT -p tcp --dport 53 -j ACCEPT iptables -A INPUT -p udp --dport 53 -j ACCEPT |
3、安装开发库
1 |
yum groupinstall "Development Libraries" "Development Tools" "Server Platform Development" --skip-broken |
下载编译所需要的安装包:
courier-unicode-1.4.tar.bz2
postfix-3.0.3.tar.gz
mysql-community-release-el6-5.noarch.rpm
extmail-1.2.tar.gz
extman-1.1.tar.gz
Unix-Syslog-1.1.tar.gz
courier-authlib-0.66.3.tar.bz2
postfix-3.0.3.tar.gz
mysql-community-release-el6-5.noarch.rpm
extmail-1.2.tar.gz
extman-1.1.tar.gz
Unix-Syslog-1.1.tar.gz
courier-authlib-0.66.3.tar.bz2
安装相关软件包
1 |
# yum install httpd mysql mysql-server mysql-devel openssl-devel dovecot perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel expect libicu libicu-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker perl-cgi |
启动httpd mysqld服务
1 2 3 4 5 6 7 |
[root@Qserver ~]# service httpd start [root@Qserver ~]# service mysqld restart [root@Qserver ~]# chkconfig httpd on [root@Qserver ~]# chkconfig mysqld on [root@Qserver ~]# netstat -tupln |grep httpd [root@Qserver ~]# netstat -tupln |grep mysqld [root@Qserver ~]# mysqladmin -u root -p password '123' 为数据库设置密码 |
安装dns服务器相关的软件包
1 |
yum install bind-chroot caching-nameserver |
编辑/etc/named.conf添加以下内容
1 2 3 4 5 |
zone "extmail.cn" IN { type master; file "extmail.cn.zone"; allow-update {none;}; }; |
修改其中的内容
1 2 3 4 5 6 7 8 9 |
options { listen-on port 53 { any; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { any; }; allow-query-cache { any; }; |
将/var/named/下的named.localhost等文件全部转移到 /var/named/chroot/var/named/下,否则会出错。
1 |
mv /var/named/named.* /var/named/chroot/var/named/ |
添加文件 extmail.cn.zone
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
@ IN SOA extmail.cn. root.extmail.cn. ( 2007041501 ;Serial 3600 ;Refresh 1800 ;Retry 604800 ;Expire 86400 ;Minimum TTL ) IN NS ns.extmail.cn. IN A 172.16.70.25 ns IN A 172.16.70.25 mail IN A 172.16.70.25 pop3 IN CNAME mail smtp IN CNAME mail @ IN MX 10 ns.extmail.cn. |
安装courier-authlib-0.66.3
1 2 3 4 5 6 7 8 9 |
#tar jvxf courier-unicode-1.4.tar.bz2 #cd courier-unicode-1.4 #./configure #make && make install #cd .. #tar jvxf courier-authlib-0.66.3.tar.bz2 #cd courier-authlib-0.66.3 #./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir --without-authuserdb --without-authpam --without-authldap --without-authpwd --without-authshadow --without-authvchkpw --without-authpgsql --without-authcustom --with-authmysql --with-mysql-libs=/usr/lib/mysql/ --with-mysql-includes=/usr/include/mysql/ --with-redhat #make && make install |
安装postfix
1 2 3 4 |
#wget http://down1.chinaunix.net/distfiles/postfix-2.8.7.tar.gz #tar zxvf postfix-2.8.7.tar.gz #make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql' 'AUXLIBS=-L/usr/lib/mysql -lmysqlclient -lz -lm' #make && make install |
修改main.cf文件
1 2 3 4 5 |
myhostname = mail.extmail.cn mydomain = extmail.cn myorigin = $mydomain mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mynetworks = 127.0.0.0/8 |
修改postfix,并赋予权限。
1 2 3 4 5 6 7 8 |
# newaliases 生成别名二进制文件,这个步骤如果忽略,会造成postfix效率极低 # cd /etc/init.d/ # mv postfix.bak postfix # chown -R postfix /var/lib/postfix/ # chown -R postfix /var/spool/postfix/private/ # chown -R postfix /var/spool/postfix/public/ # service postfix restart # netstat -tupln |grep 25 |
新建文件/etc/sasl2/smtpd.conf
1 2 3 4 |
pwcheck_method: authdaemond log_level: 3 mech_list: PLAIN LOGIN authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket |
重启服务,添加到开机启动
1 2 3 4 |
# chkconfig saslauthd on # chkconfig postfix on # service saslauthd start # service postfix restart |
再次编辑main.cf
1 2 3 4 5 6 7 8 |
# vim /etc/postfix/main.cf 添加以下内容 broken_sasl_auth_clients = yes smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_host name,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,re ject_unauth_pipelining,reject_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_security_options = noanonymous smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available! |
5、安装extmail
- 我的微信
- 扫一扫加我好友
-
- 微信公众号
- 谈点儿别的
-