[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

install script

Michael, thank you for the fast answer.
I send you the full install script for my pgsql-qmail setup.
The script runs without any errors, however after that I cannot start any qmail daemons with the djb rc script.
(This is for my trial server, with the hostname kishonti.hu for anyuser@xxxxxxxxxxx email addresses.
I inserted a test user in the passwd table to try it.)

Thank you for the help,


cp /usr/inetdownloads/qmail-1* /usr/src
cp /usr/inetdownloads/qmail-pg* /usr/src
cd /usr/src
gunzip -d qmail-1*
tar -xvf qmail-1*
mkdir /var/qmail
groupadd nofiles
useradd -g nofiles -d /var/qmail/alias alias
useradd -g nofiles -d /var/qmail qmaild
useradd -g nofiles -d /var/qmail qmaill
useradd -g nofiles -d /var/qmail qmailp
groupadd qmail
useradd -g qmail -d /var/qmail qmailq
useradd -g qmail -d /var/qmail qmailr
useradd -g qmail -d /var/qmail qmails
gpatch -p0<qmail-pgsql-latest.patch
echo -I/usr/local/pgsql/include >/usr/src/qmail-1.03/pgsql.headers
echo -L/usr/local/pgsql/lib -lpq >/usr/src/qmail-1.03/pgsql.lib
cd /usr/src/qmail-1.03
make setup check
./config-fast kishonti.hu
useradd -d /export/home/admin -m admin
su admin -c "/var/qmail/bin/maildirmake $HOME/Maildir"
su admin -c "echo ./Maildir/ >~/.qmail"
echo admin@xxxxxxxxxxx >/var/qmail/alias/.qmail-POSTmaster echo admin@xxxxxxxxxxx >/var/qmail/alias/.qmail-root echo admin@xxxxxxxxxxx >/var/qmail/alias/.qmail-mailer-daemon
chmod 644 /var/qmail/alias/.qmail*
make sqlcreatehomedir
cp sqlcreatehomedir /usr/local/sbin
chown root:nofiles /usr/local/sbin/sqlcreatehomedir
chmod 475 /usr/local/sbin/sqlcreatehomedir
psql -d template1 -U postgres -c "CREATE USER usermgr WITH PASSWORD 'secretdb' CREATEDB;"
psql -d template1 -U postgres -c "CREATE USER userconsult WITH PASSWORD 'readonly' NOCREATEDB;"
psql -d template1 -U usermgr -c "CREATE DATABASE userdb;"
psql -d userdb -U usermgr -c "CREATE TABLE passwd (login varchar(64) NOT NULL, uid int NOT NULL, gid int NOT NULL, home varchar(200) NOT NULL, virtual_host varchar(64), password varchar(13), hardquota int DEFAULT '0', startdate datetime DEFAULT now(), stopdate datetime DEFAULT 'infinity', enabled bool DEFAULT '1', PRIMARY KEY (login,virtual_host));"
psql -d userdb -U usermgr -c "GRANT SELECT ON passwd TO userconsult;"
psql -d userdb -U usermgr -c "GRANT ALL ON passwd TO usermgr;"
psql -d userdb -U usermgr -c "CREATE TABLE locals (virtual_host varchar(64) PRIMARY KEY);"
psql -d userdb -U usermgr -c "GRANT SELECT ON locals TO userconsult;"
psql -d userdb -U usermgr -c "GRANT ALL ON locals TO usermgr;"
psql -d template1 -U postgres -c "ALTER USER usermgr NOCREATEDB;"
psql -d userdb -U usermgr -c "ALTER TABLE passwd ADD COLUMN lastlogin DATETIME;"
echo db_use yes >>/var/qmail/control/sqlserver
echo check_host yes >>/var/qmail/control/sqlserver
echo connectionstring user=userconsult password=readonly dbname=userdb >>/var/qmail/control/sqlserver
echo popconnectionstring user=usermgr password=secretdb dbname=userdb >>/var/qmail/control/sqlserver
echo dbtable passwd >>/var/qmail/control/sqlserver
echo autohomedir yes >>/var/qmail/control/sqlserver
echo virt_host_field virtual_host >>/var/qmail/control/sqlserver
echo login_field login >>/var/qmail/control/sqlserver
echo uid_field uid >>/var/qmail/control/sqlserver
echo gid_field gid >>/var/qmail/control/sqlserver
echo home_field home >>/var/qmail/control/sqlserver
echo quota_field quota >>/var/qmail/control/sqlserver
echo enabled_field enabled >>/var/qmail/control/sqlserver
echo startdate_field startdate >>/var/qmail/control/sqlserver
echo stopdate_field stopdate >>/var/qmail/control/sqlserver
echo passwd_field passwd >>/var/qmail/control/sqlserver
echo lastlogin_field lastlogin >>/var/qmail/control/sqlserver
echo localpop kishonti.hu >>/var/qmail/control/sqlserver
chown qmails:nofiles /var/qmail/control/sqlserver
chmod 440 /var/qmail/control/sqlserver
chown root:nofiles /export/virtualmail/kishonti.hu
chmod 475 /export/virtualmail/kishonti.hu
psql -d userdb -U usermgr -c "INSERT INTO passwd (login, uid, gid, home, virtual_host, password, hardquota) VALUES ('test', 10000, 10000, '/export/virtualmail/kishonti.hu/test','kishonti.hu','123456', 2000);"
echo \#!/bin/sh >>/var/qmail/rc
echo exec env - PATH=\"/var/qmail/bin:\$PATH\" \\ >>/var/qmail/rc
echo qmail-start ./Maildir/ splogger qmail >>/var/qmail/rc
chmod 744 /var/qmail/rc
exit 0