Friday, September 11, 2015

Qmail Server step by step configuration

Qmail installation & configure procedure on RHEL

Check selinux it should be Disable.
vi /etc/selinux/config
selinux = disabled
(restart server to take effect for disable sestatus)

Before Starting the installation for Qmail.Make sure that yum is configured locally.
1. vi /etc/yum.repos.d/CentOS-Base.repo
2. Copy the base url and comment the original one.
3. On the the copied url add the localhost ip configured. i.e. baseurl=http://127.0.0.1/yum
gpgcheck=0
enabled=1
[1)Copy all cd's into one folder in /usr/local/src named setup then copy "CentOS" folder from setup folder to /var/www/html

Installation steps for httpd installation on a minimal installation :

packages required to resolve dependency issue :

1.apr-1.2.7-11.el5_3.1.x86_64.rpm
2.apr-util-1.2.7-7.el5_3.2.x86_64.rpm
3.postgresql-libs-8.1.11-1.el5_1.1.x86_64.rpm
4.mailcap-2.1.23-1.fc6.noarch.rpm

and then the finally the httpd rpm after installing the above packages for resolving depend
encies
httpd-2.2.3-31.el5.centos.x86_64.rpm



2) cd /var/www/html
3) createrepo CentOS  (It will create local yum reposatory)
4)vi /etc/httpd/conf/httpd.conf

NameVirtualhost :80
<VirtualHost (local IP):80>
   ServerAdmin admin@domain.com
   DocumentRoot /var/www/html/CentOS
   ServerName domain.com
   ErrorLog logs/domain.com-error_log
   CustomLog logs/domain-access_log common
</VirtualHost>

then install createrepo rpm
cd /var/www/html
creatrepo CentOs
Qmailtoaster Installation procedure on plain Cent-OS 64 Bit
First Download all the scripts from qmailtoaster.org
cd /usr/local/src/qmailtoaster/
1> wget http://qmailtoaster.org/distro/centos/cnt5064/current-download-script.sh
2> wget http://qmailtoaster.org/distro/centos/cnt5064/cnt5064-deps.sh
3> wget http://qmailtoaster.org/distro/centos/cnt5064/cnt5064-perl.sh
4> wget http://qmailtoaster.org/distro/centos/cnt5064/cnt5064-install-script.sh
5> wget http://qmailtoaster.org/distro/centos/cnt5064/mysql-setup.sh
Check the below available or not
rpm -qa |grep make
rpm -qa |grep zip
rpm -qa |grep tar
rpm -qa |grep ntsysv
rpm -qa |grep norff
rpm -qa |grep groff
Install through yum (from the root direcory)
yum install vim*
yum install mc*
yum install perl*
yum install php*
yum install gcc*
yum install mysql*
yum install http*
yum install bind*
yuminstall xinetd*
IMP-- Make sure that the  packages are installed evein if the rpm -qa command shows installed
yum install make*
yum install zip*
yum install tar*
yum install ntsysv
yum install groff

Make sure to remove sendmail dependencies:-
like - rpm -e exim-4.63-3.el5
possible error: Failed dependencies:
       /usr/sbin/sendmail is needed by (installed) arpwatch-2.1a13-21.el5.x86_64
       /usr/sbin/sendmail is needed by (installed) redhat-lsb-3.1-12.3.EL.el5.centos.x86_64
       /usr/sbin/sendmail is needed by (installed) redhat-lsb-3.1-12.3.EL.el5.centos.i386
       smtpdaemon is needed by (installed) mutt-1.4.2.2-3.0.2.el5.x86_64
       smtpdaemon is needed by (installed) mdadm-2.6.9-2.el5.x86_64
       smtpdaemon is needed by (installed) fetchmail-6.3.6-1.1.el5.x86_64

Remove one by one RPM like below

rpm -e arpwatch-2.1a13-21.el5.x86_64
rpm -e redhat-lsb-3.1-12.3.EL.el5.centos.x86_64
rpm -e mutt-1.4.2.2-3.0.2.el5.x86_64
rpm -e mdadm-2.6.9-2.el5.x86_64
rpm -e fetchmail-6.3.6-1.1.el5.x86_64
rpm -e exim-4.63-3.el5
rpm -e redhat-lsb-3.1-12.3.EL.el5.centos.i386
rpm -e exim-4.63-3.el5

Now Install all the .sh files which we have download.

1> /usr/local/src/qmailtoaster/ >> sh current-download-script.sh
2> /usr/local/src/qmailtoaster/ >> sh cnt5064-deps.sh
3> /usr/local/src/qmailtoaster/ >> sh cnt5064-perl.sh (Read carefully bellow instructions while installing Perl)
while installing ./cnt5064-perl.sh
First time make it NO after that all default [Yes] like below .
>>Are you ready for manual configuration? [yes]  NO

>>After that all default setting should be - [Yes]
Now install
4> /usr/local/src/qmailtoaster/ >> sh cnt5064-install-script.sh
It will ask you like below ,you have to use default [Yes]
Installing daemontools-toaster [Yes]
.
..
...
after installing all the rpm it will ask you in the end like below.
Do you want to clean /usr/src/redhat/RPMS/* ?
Shall we continue? (yes, skip, quit) [y]/s/q: s
5> /etc/init/mysqld start
Install ./mysql-setup.sh (Before that write the mysql password in the script)
Before that write the password in the script
MYSQLPW=FriscoSan20 (Password)
(change vpopmail password also)

vim /home/vpopmail/etc/vpopmail.mysql
localhost|0|vpopmail|(vpopmail passwd in mysqld script)|vpopmail

Now restart all the services
like qmail,httpd,mysql,
Next Step ....
Go to /usr/local/src/qmailtoaster/
rpm -Uvh qmail-toaster*.src.rpm
Stop the qmail (qmaictl stop)

change the sleep timing from 5 to 300 seconds at below location
cd /usr/src/redhat/SPECS (assuming you are using CentOS 5)
vi qmail-toaster.spec. find 'sleep 5' (should be line 606). change 5 to 500 (5 seconds to 300 seconds). save.

Build the RPM from the  the location  /usr/src/redhat/SPECS
(make sure which os version U r using 32 or 64 bit)
for 32 bit  == rpmbuild -bb --with cnt50 qmail-toaster.spec
for 64 bit == rpmbuild -bb --with cnt5064 qmail-toaster.spec
Then edit the chkuser file as below:
vi /usr/src/redhat/BUILD/qmail-1.03/chkuser_settings.h
comment the following 4 lines
/* #define CHKUSER_RCPT_FORMAT */
/* #define CHKUSER_RCPT_MX */
/* #define CHKUSER_SENDER_FORMAT */
/* #define CHKUSER_SENDER_MX */
#define CHKUSER_ALLOW_SENDER_CHAR_3 '/' (Enabling Blackberry Sending)
     #define CHKUSER_ALLOW_RCPT_CHAR_3 '/'   (Enabling Blackberry Sending)
Save the file and Wait for 300 Seconds after this,
Then go to following location
cd /usr/src/redhat/RPMS/x86_64
Replaced the packages of qmail using following command.
rpm -Uvh --replacefiles --replacepkgs qmail-*.rpm
#######################To check if BIG_DIR is enabled ####################
Go to the location of grep for the word BIG_DIR
grep BIG_DIR /home/vpopmail/include/config.h
find /USERS_BIG_DIR
/* #undef USERS_BIG_DIR */ (This is not correct entry means BIG DIR is NOT enabled)
#undef USERS_BIG_DIR  (entry should be like this)
#############################################################################
IF NOT THEN
###### HOW TO ENABLE BIG DIR HASH IN VPOPMAIL ########################

make sure Qmail service is stopped

Go to /usr/local/src/qmailtoaster
rpm -Uvh vpopmail-toaster-5.4.17-1.3.7.src.rpm
/usr/src/redhat/SPECS/
vim vpopmail-toaster.spec

-------------------------------------------------------------------------------------------------------------------
# Run configure to create makefile
#------------------------------------------------------------------------------------

./configure --prefix=%{vdir} \
       --enable-vpopuser=vpopmail \
       --enable-vpopgroup=vchkpw \
       --enable-libdir=%{mylibdir} \
       --disable-roaming-users \
       --enable-tcprules-prog=/usr/bin/tcprules \
       --enable-tcpserver-file=/etc/tcprules.d/tcp.smtp \
       --enable-make-seekable \
       --enable-clear-passwd \
       --disable-users-big-dir \        (You have to enable this setting like this --enable-users-big-dir)
       --enable-qmail-ext \
       --disable-ip-alias-domains \
       --enable-auth-module=mysql \
       --disable-passwd \
       --enable-logging=v \
       --enable-log-name=vpopmail \
       --disable-mysql-limits \
       --enable-valias \
       --disable-many-domains


----------------------------------------------------------------------------------------------------------------------

then
cd /usr/src/redhat/SPECS
rpmbuild -bb --with cnt5064 vpopmail-toaster.spec
then go to
/usr/src/redhat/RPMS/x86_64/
and run the below command
rpm -Uvh --replacefiles --replacepkgs vpopmail-toaster-5.4.17-1.3.7.x86_64.rpm
################################################
##################################################

###################### To disable qmailadmin toaster##############
vim /etc/httpd/conf/httpd.conf
Just at the end of the file comment the below mentioned lines
Include /etc/httpd/conf/toaster.conf
Include /etc/httpd/conf/squirrelmail.conf
then restart httpd server
##################################################################



######################For Error Reporting###############
edit the php .ini file as under
cp -pRvf /etc/php.ini /etc/php.ini-bck
vim /etc/php.ini
comment the below line
;error_reporting  =  E_ALL
Add the below line as mentioned
error_reporting  =  E_ERROR
/etc/init.d/httpd restart
qmailctl start


#############################TO DO AT MSBTE NEW SERVER #####################


########################################################
cd /var/qmail/bin
rm -rf qmail-queue -> /var/qmail/bin/qmail-dk
cp -pRvf qmail-queue.orig qmail-queue
###########################################################
1) cp -pRvf /var/qmail/supervise/smtp /usr/local/src/
2) Install
wget -c http://qtp.qmailtoaster.com/trac/downloads/2
3) cd /opt/qmailtoaster-plus/bin/
4) ./qtp-install-spamdyke
5) vi /etc/spamdyke/spamdyke.conf
(following entries should be commented)
#reject-empty-rdns
#reject-ip-in-cc-rdns
#reject-missing-sender-mx
#reject-unresolvable-rdns
###########################################################################
you can download updated rsync rpm
ftp://ftp.pbone.net/mirror/ftp.freshrpms.net/pub/freshrpms/pub/dag/redhat/el5/en/x86_64/dag/RPMS/rsync-3.0.5-1.el5.rf.x86_64.rpm
##############################################################################
For rrs installation

cd /usr/local/src/
wget -c http://gray-world.net/tools/rrs-1.70.tar.gz
tar -xvzf rrs-1.70.tar.gz
cd rrs-1.70/
make generic
make install
############################# REMI REPO #################################################
wget http://download.fedora.redhat.com/pub/epel/4/i386/epel-release-4-9.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-4.rpm
rpm -Uvh remi-release-4*.rpm epel-release-4*.rpm
You can install latest rpms provide by remi repo like below for ex
# yum --enablerepo remi install php*
######################################## MAIL MANAGEMENT FOLDER ################################
copy mailmanagement folder to new mail server
################################################################################################
To create Disk Quota
Create file in /etc/cron.daily/disk-space-alert.sh
chmod 755 /etc/cron.daily/disk-space-alert.sh
vim /etc/cron.daily/disk-space-alert.sh
#!/bin/sh
ALERT=70
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 " " $1 }' | while read output;
do
 echo $output
 usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
 partition=$(echo $output | awk '{ print $2 }' )
 if [ $usep -ge $ALERT ]; then
   echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
/bin/sendEmail -f postmaster@customer.com  -t  admin@cuostmer.com -cc support@technoinfotech.com -u "Alert: $partition out of disk space $usep%" -m "Dear Admin \n \n Following Partition Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date) please take necessary action\n \n -AutoAdmin"
fi
done
############################################################################################################
create new logo logoease.com

No comments:

Post a Comment

Linux Tables: Block All Incoming Traffic But Allow SSH

  This is very common scenario. You want to permit access to a remote machine only by SSH. You would like to block all incoming traffic to y...