/*
说明:网络上的安装qmail的文章很多都是残缺不全,或者是不符合使用的,今天这个文章是我朋友花了两个月时间研究出来的东西,试验了很多遍,可以说是非常经典的东西,特别发在这里,希望在安装和摸索安装qmail的朋友能够看看!
另外,后续转两篇网上最好的文章给大家看,希望大家能学会安装!
by heiyeluren
*/
step1:Qmail
cd /usr/ports/mail/qmail
make install
make disable-sendmail
make enable-qmail
ee /var/qmail/rc
env env - PATH="/var/qmail/bin:/usr/local/bin" qmail-start ./Maildir/
chmod +x /var/qmail/rc
/var/qmail/configure/config-fast 5aaa.com
step2:MySQL
cd /usr/ports/databases/mysql41-server
make install
reboot
mysqladmin create vpopmail
mysql
use mysql;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,FILE,INDEX,ALTER,SHOW DATABASES,CREATE TEMPORARY TABLES,LOCK TABLES ON *.* TO vpopmail@"localhost" IDENTIFIED BY "vpopmail" WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
FLUSH PRIVILEGES;
step3:vpopmail
cd /usr/ports/mail/vpopmail
make WITH_MYSQL=yes WITH_MYSQL_SERVER=localhost WITH_MYSQL_USER=vpopmail WITH_MYSQL_PASSWD=vpopmail WITH_MYSQL_DB=vpopmail WITH_MYSQL_LIMITS=yes install
ee /usr/local/vpopmail/etc/vpopmail.mysql
host|port|user|password|database
host|port|user|password|database
cd /usr/local/vpopmail/bin
./vadddomain 5aaa.com
./vadduser demo@5aaa.com
step4:QmailAdmin
cd /usr/ports/mail/qmailadmin
make install
step5:daemontools
cd /usr/ports/sysutils/daemontools
make install
mkdir -p /var/log/qmail/qmail-smtpd
mkdir -p /var/log/qmail/qmail-pop3d
mkdir -p /var/log/qmail/qmail-send
chmod -R 755 /var/log/qmail
chown -R qmaill:wheel /var/log/qmail
mkdir /service
chmod 755 /service
cp supervise /var/qmail/
chmod -R 755 /var/qmail/supervise
chmod +t /var/qmail/supervise/*
ln -s /var/qmail/supervise/* /service/
rm qmail.sh
vi qmail.sh
chmod +x /usr/local/etc/rc.d/qmail.sh
step6:apache+php
cd /usr/ports/www/apache2
make install
tar -zxvf php-4.3.9.tar.gz
cd php-4.3.9
./configure --prefix=/usr/local/php4 --with-apxs2=/usr/local/sbin/apxs --with-mysql=/usr/local
make install
ee /usr/local/etc/apache2/httpd.conf
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html
User vpopmail
Group vchkpw
step7:igenus
mkdir /tmp/igenus
cd /tmp
chmod -R 0755 igenus
chown -R vpopmail:vchkpw igenus
ee /path/to/apache/igenus/config/config_inc.php
$CFG_BASEPATH = "/path/to/igenus";
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'vpopmail';
$CFG_MYSQL_PASS = 'vpopmail';
$CFG_MYSQL_DB = 'vpopmail';
$CFG_TEMP = "/tmp/igenus";
/usr/local/vpopmail/bin/vdeldomain olddomain.com
mysql -u root -p use vpopmail
drop table vpopmail;
drop table lastauth;
CREATE TABLE `address` ( `id` int(11) unsigned NOT NULL auto_increment, `pw_id` int(5) NOT NULL default '0', `name` varchar(64) NOT NULL default '', `email` varchar(128) NOT NULL default '', UNIQUE KEY `id` (`id`), KEY `pw_id` (`pw_id`) ) TYPE=MyISAM PACK_KEYS=1 ;
CREATE TABLE `admin` ( `id` int(10) unsigned NOT NULL auto_increment, `site_id` int(10) unsigned NOT NULL default '0', `domain` varchar(128) NOT NULL default '', `quota` smallint(5) unsigned NOT NULL default '0', `total` smallint(5) unsigned NOT NULL default '0', `createtime` timestamp(14) NOT NULL, `login` char(1) NOT NULL default '', `cur_total` smallint(5) NOT NULL default '0', `cur_quota` smallint(5) NOT NULL default '0', `gid` varchar(11) NOT NULL default '', `expiration_time` timestamp(14) NOT NULL, `flag` int(10) unsigned NOT NULL default '0', `maxmsg` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `domain` (`domain`)) TYPE=MyISAM PACK_KEYS=1 ;
CREATE TABLE `card` ( `id` int(5) unsigned NOT NULL auto_increment, `pw_id` int(5) unsigned NOT NULL default '0', `LinkMan` varchar(64) NOT NULL default '', `CompanyName` varchar(100) NOT NULL default '', `Address` varchar(255) NOT NULL default '', `Position` varchar(32) NOT NULL default '', `PhoneNumber` varchar(16) NOT NULL default '', `Mobile` varchar(12) NOT NULL default '', `Email` varchar(128) NOT NULL default '', `Partaker` varchar(32) NOT NULL default '', `Memo` varchar(255) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM ;
CREATE TABLE `lastauth` ( `user` char(32) NOT NULL default '', `domain` char(64) NOT NULL default '', `remote_ip` char(18) NOT NULL default '', `timestamp` bigint(20) NOT NULL default '0', PRIMARY KEY (`user`,`domain`)) TYPE=MyISAM;
CREATE TABLE `logs` ( `pw_id` int(5) default '0', `ip` varchar(15) NOT NULL default '', `action` varchar(15) NOT NULL default '', `time` datetime default NULL, `content` varchar(64) NOT NULL default '', `email` varchar(128) NOT NULL default '') TYPE=MyISAM;
CREATE TABLE `message` ( `id` int(5) unsigned NOT NULL auto_increment, `title` varchar(255) NOT NULL default '', `body` text NOT NULL, `createtime` datetime NOT NULL default '0000-00-00 00:00:00', `updatetime` datetime NOT NULL default '0000-00-00 00:00:00', `pw_domain` varchar(64) NOT NULL default '', UNIQUE KEY `id` (`id`)) TYPE=MyISAM ;
CREATE TABLE `personal` ( `id` int(11) unsigned NOT NULL auto_increment, `pw_id` int(5) NOT NULL default '0', `truename` varchar(10) NOT NULL default '', `fax` varchar(20) NOT NULL default '', `telephone` varchar(15) NOT NULL default '', `sex` int(1) NOT NULL default '0', `year` int(4) NOT NULL default '0', `MONTH` int(2) NOT NULL default '0', `DAY` int(2) NOT NULL default '0', `education` varchar(4) NOT NULL default '', `marital` int(1) NOT NULL default '0', `occupation` varchar(15) NOT NULL default '', `companyname` varchar(30) NOT NULL default '', `province` varchar(6) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM PACK_KEYS=1 ;
CREATE TABLE `scheduler` ( `id` int(11) unsigned NOT NULL auto_increment, `begin_time` int(11) unsigned default NULL, `end_time` int(11) unsigned default NULL, `title` varchar(255) NOT NULL default '', `body` varchar(255) NOT NULL default '', `pw_id` int(11) unsigned NOT NULL default '0', PRIMARY KEY (`id`)) TYPE=MyISAM ;
CREATE TABLE `stow` ( `id` int(5) unsigned NOT NULL auto_increment, `pw_id` int(5) unsigned NOT NULL default '0', `Name` varchar(128) NOT NULL default '', `http` varchar(255) NOT NULL default 'http://', `memo` varchar(255) NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM ;
CREATE TABLE `vpopmail` ( `pw_id` int(5) unsigned NOT NULL auto_increment, `pw_name` varchar(32) NOT NULL default '', `pw_domain` varchar(64) NOT NULL default '', `pw_passwd` varchar(40) NOT NULL default '', `pw_uid` int(11) default NULL, `pw_gid` int(11) default NULL, `pw_gecos` varchar(48) default NULL, `pw_dir` varchar(255) default NULL, `pw_shell` varchar(20) default NULL, `createtime` timestamp(14) NOT NULL, PRIMARY KEY (`pw_id`), KEY `pw_name` (`pw_name`,`pw_domain`)) TYPE=MyISAM PACK_KEYS=1 ;
ee /usr/local/php4/lib/php.ini
max_execution_time=60
memory_limit=20M
post_max_filesize=10M
file_uploads=on
upload_max_filesize=10M
register_globals=On
session.bug_compat_42=0
session.bug_compat_warn=0
Sendmail = /var/qmail/bin/qmail-inject
#cd /usr/ports/mail/sqwebmail
#make WITH_VCHKPW=YES WITH_ISPELL=YES install
根据提示:
#make configure
#make clean
#ee /etc/crontab
增加以下:
40 * * * * root /usr/local/share/sqwebmail/cleancache.pl
#cd /usr/local/share/sqwebmail/
#cp authdaemonrc.dist authdaemonrc
#/usr/local/libexec/sqwebmail/authlib/authdaemon start