|
#!/bin/bash ################################################################################################ # Somthing to say # # Author:sosogh # # Date:2007.2.10 # # The script will ask you some questions(it is the software asking you question in fact) , # so "donot" go anywhere when excute this script # # This script is just to implement the setup of the mail system . It is not to show the usage # of every software.The usage of every software leaves to you. # # I have test the scrpit on my vmware and my real pc,it worked well.If u want to use this script, # # MAKE SURE THAT TEST IT ON YOUR VMWARE BEFORE YOU INSTALL IT ON YOUR REAL PC. # # AND I DON'T GUARANTEE THAT IT WILL WORK WELL ON YOUR PC # ################################################################################################ ########################################################################################### # # I leave it up to you for any other issues. Absolutely no warranty of any kind. # Use entirely at your own risk. # The author accepts no responsibility for any loss or damage caused by the use, lack of use, # or misuse, of information contained in this script # ############################################################################################# ############################################################################################ # # postfix2.1.5 cyrus-sasl couirer(auth imap pop maildrop) postfixadmin # Amavis-new Spamassasin Clamav squirrelmail # #############################################################################################
###################### # Some notes: ###################### ############################################################################################## # # The course of SMTP authentication is illustrated as follow: # # client pc -- postfix --- sasl -- authdaemon ------ authmysql -------- Mysql # # ############################################################################################### ############################################################################################### # # The course of POP3 authentication is illustrated as follow: # # client pc --- POP3 --- authdaemon ------ authmysql -------- Mysql # # ###############################################################################################
########################################################### # # My source list is : # deb http://debian.cn99.com/debian/ stable main # ########################################################### ##<---------- SECTION 1 prepation -------## ############## # prepation ############## sed -i '/^deb http:\/\/security.debian.org/s/\(.*\)/#\1/' /etc/apt/sources.list apt-get update apt-get -y install sudo groupadd -g 108 vmail useradd -g 108 -u 108 vmail ##<---------- SECTION 2 pop3Server -------## ################################### # Install and set the pop3 server ################################### apt-get -y install courier-pop courier-authmysql sed -i 's/^authmodulelist=.*/authmodulelist="authmysql"/' /etc/courier/authdaemonrc chmod x /var/run/courier/authdaemon mkdir /vmail chown vmail.vmail /vmail ########################### # Configure the Authmysqlrc ########################### mv /etc/courier/authmysqlrc /etc/courier/authmysqlrc.bakup echo -e 'MYSQL_SERVER\tlocalhost' >> /etc/courier/authmysqlrc echo -e 'MYSQL_USERNAME\tpostfixadmin' >> /etc/courier/authmysqlrc echo -e 'MYSQL_PASSWORD\tpostfixadmin' >> /etc/courier/authmysqlrc echo -e 'MYSQL_SOCKET\t/var/run/mysqld/mysqld.sock' >> /etc/courier/authmysqlrc echo -e 'MYSQL_OPT\t0' >> /etc/courier/authmysqlrc echo -e 'MYSQL_DATABASE\tpostfix' >> /etc/courier/authmysqlrc echo -e 'MYSQL_USER_TABLE\tmailbox' >> /etc/courier/authmysqlrc echo -e 'MYSQL_CRYPT_PWFIELD\tpassword' >> /etc/courier/authmysqlrc echo -e 'MYSQL_UID_FIELD\t108' >> /etc/courier/authmysqlrc echo -e 'MYSQL_GID_FIELD\t108' >> /etc/courier/authmysqlrc echo -e 'MYSQL_LOGIN_FIELD\tusername' >> /etc/courier/authmysqlrc echo -e "MYSQL_HOME_FIELD\t'/vmail/'" >> /etc/courier/authmysqlrc echo -e 'MYSQL_NAME_FIELD\tname' >> /etc/courier/authmysqlrc echo -e 'MYSQL_MAILDIR_FIELD\tmaildir' >> /etc/courier/authmysqlrc echo -e "MYSQL_WHERE_CLAUSE\tactive='1'" >> /etc/courier/authmysqlrc ##<---------- SECTION 3 apache-------## ########################### # Install apache2 ########################### apt-get -y install apache2 apache2-mpm-prefork #################################### # Install PHP4 Support For Apache2 #################################### apt-get -y install libapache2-mod-php4 php4-cli php4-common php4-cgi ##################################### # Configure apache2 for PHP4 Support ##################################### mkdir /etc/apache2/modules cp /usr/lib/apache2/modules/libphp4.so /etc/apache2/modules/ echo 'AddType application/x-httpd-php .php' > /etc/apache2/conf.d/php4.conf ##<---------- SECTION 4 Mysql -------## #################################### # Install Mysql-Server-4.1 #################################### apt-get -y install mysql-server-4.1 ####################################### # Preption for Mysql and Postfixadmin ####################################### m='/usr/bin/mysql' pa='postfixadmin' ################################################################## # Init Mysql and set a root account for Mysql password 123456 ################################################################## /usr/bin/mysql_install_db /usr/bin/mysqladmin -u root password '123456' ################################################ # Install and Configure Mysql Module for PHP4 ################################################ apt-get -y install php4-mysql sed -i 's#^\(extension=\)\(mysql.so\)#\1/usr/lib/php4/20020429/\2#' /etc/php4/apache2/php.ini echo 'extension_dir = "./"' >> /etc/php4/apache2/php.ini /etc/init.d/apache2 restart ##<---------- SECTION 5 postfixadmin -------## #################################### # Download postfixadmin-2.1.0 #################################### cd /var/www/ wget -c http://high5.net/page7_files/postfixadmin-2.1.0.tgz tar zxf postfixadmin-2.1.0.tgz mv postfixadmin-2.1.0 pa ########################################## # Import the Mailbox infor into Mysql ########################################## /usr/bin/mysql -uroot -p123456 < /var/www/pa/DATABASE_MYSQL.TXT #################################### # Change some permissions #################################### chown -R www-data.www-data /var/www/pa cd /var/www/pa/ chmod 640 *.php *.css cd /var/www/pa/admin/ chmod 640 *.php .ht* cd /var/www/pa/images/ chmod 640 *.png cd /var/www/pa/languages/ chmod 640 *.lang cd /var/www/pa/templates/ chmod 640 *.tpl cd /var/www/pa/users/ chmod 640 *.php #################################### # Init Postfixadmin #################################### cd /var/www/pa/ cp config.inc.php.sample config.inc.php /usr/bin/php4 /var/www/pa/setup.php > /dev/null
|