这一套脚本测试–除163邮箱外,其他邮箱测试均通过
#!/bin/bash -
#关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
#关闭防火墙
service iptables stop
service ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
#安装工具
yum -y install automake libedit-devel pcre-devel pkgconfig python-docutils python-sphinx vim wget links make gcc gcc-c++ \
gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 \
libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 \
bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel \
libidn libidn-devel openssl openssl-devel gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap lsof
#修改本地主机名HOSTNAME=localhost.localhostdomain -->HOSTNAME=mail.yy89.net
#如果此处的主机名不是这个切记要更改此选项中内容
sed -i 's/HOSTNAME=localhost.localhostdomain/HOSTNAME=mail.yy89.net/g' /etc/sysconfig/network
#添加本地hosts,这里的IP需要更改
sed -i '$a 164.52.11.90 mail.yy89.net' /etc/hosts
#一般情况下,系统自带postfix软件,无需安装,若不自带yum安装一下 mailx 使用mail命令测试邮件发送
yum -y install postfix mailx
shutdown -r now
#!/bin/bash -
#搭建LAMP环境,使用rpm包完成
yum -y install links httpd mysql mysql-devel mysql-server php php-pecl-Fileinfo php-mcrypt php-devel php-mysql php-common php-mbstring php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc pcre pcre-devel dovecot dovecot-devel dovecot-mysql
#设置软件开机启动
chkconfig httpd on
chkconfig mysqld on
chkconfig dovecot on
#创建一个vmail用户,用作管理虚拟邮箱的文件夹
useradd -u 2000 -d /var/vmail -m -s /sbin/nologin vmail
#配置apache和php
sed -i '$a AddType application/x-httpd-php .php' /etc/httpd/conf/httpd.conf
sed -i '$a PHPIniDir \"/etc/php.ini\"' /etc/httpd/conf/httpd.conf
sed -i '$a ServerName localhost:80' /etc/httpd/conf/httpd.conf
sed -i 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.php index.html index.html.var/g' /etc/httpd/conf/httpd.conf
sed -i 's/User apache/User vmail/g' /etc/httpd/conf/httpd.conf
sed -i 's/Group apache/Group vmail/g' /etc/httpd/conf/httpd.conf
#测试是否配置成功
cd /var/www/html
touch index.php
cat >index.php <<end
<?php
phpinfo();
?>
end
service httpd start
links 127.0.0.1