Wednesday, February 24, 2016

Life with qmail - document

What is qmail?

qmail is an Internet Mail Transfer Agent (MTA) for UNIX-like operating systems. It's a drop-in replacement for the Sendmail system provided with UNIX operating systems. qmail uses the Simple Mail Transfer Protocol (SMTP) to exchange messages with MTA's on other systems.



3. Why use qmail?

Your operating system included an MTA, probably Postfix or Sendmail, so if you're reading this document you're probably looking for something different. Some of the advantages of qmail over vendor-provided MTA's include:

3. Security

qmail was designed for high security. Sendmail has a long history of serious security problems. When Sendmail was written, the Net was a much friendlier place. Everyone knew everyone else, and there was little need to design and code for high security. Today's Internet is a much more hostile environment for network servers.Sendmail's author, Eric Allman, and the current maintainer, Claus Assman, have done a good job of tightening up the program, but nothing short of a redesign can achieve true security.

3.2. Performance

qmail parallelizes mail delivery, performing up to 20 deliveries simultaneously, by default.

3.3. Reliability

Once qmail accepts a message, it guarantees that it won't be lost. qmail also supports a new mailbox format that works reliably even over NFS without locking.

3.4. Simplicity

qmail is smaller than any other equivalently-featured MTA.

Note: The official qmail web page, http://cr.yp.to/qmail.html covers the advantages of qmail more extensively.

4. History

qmail was written by Dan Bernstein (DJB), http://en.wikipedia.org/wiki/Daniel_J._Bernstein, a math professor now at the University of Illinois in Chicago. Dr. Bernstein is also well known for his work in the field of cryptography and for his lawsuit against the U.S. government regarding the publishing of encryption source code. Seehttp://en.wikipedia.org/wiki/Bernstein_v._United_States or http://cr.yp.to/export.html for information regarding the lawsuit.
The first public release of qmail, beta version 0.70, occurred on January, 24, 96. The first gamma release, 0.90, was on August, 96.
Version 0, the first general release, was announced on February, 20, 97. The current version, 03, was released on June, , 98.
The next release is expected to be an evaluation version of 2.0. Some of things that might appear in version 2 are covered at http://cr.yp.to/qmail/future.html.

5. Features

The qmail web page, http://cr.yp.to/qmail.html, has a comprehensive list of qmail's features. This section is based heavily on that list.

5. Setup

  • Automatic adaptation to your UNIX variant--no porting needed
  • Automatic per-host configuration
  • Quick installation--no big list of decisions to make

5.2. Security

  • Clear separation between addresses, files, and programs
  • Minimization of setuid code
  • Minimization of root code
  • Five-way trust partitioning--security in depth
  • Optional logging of one-way message hashes, entire message contents, etc. (See What is QUEUE_EXTRA? in Appendix E.)

5.3. Message construction

  • RFC 822 and RFC 23 compliant
  • Full support for address groups
  • Automatic conversion of old-style address lists to RFC 822 format
  • sendmail command for compatibility with current user agents
  • Header line length limited only by memory
  • Host masquerading (See defaulthost)
  • User masquerading (See MAILUSER and MAILHOST)
  • Automatic Mail-Followup-To creation (See QMAILMFTFILE)

5.4. SMTP service

  • 8-bit clean
  • RFC 93/ident/TAP callback--can help track spammers/forgers
  • Relay control--stops unauthorized relaying by outsiders
  • No interference between relay control and aliases
  • Automatic recognition of local IP addresses
  • Per-buffer timeouts
  • Hop counting
  • Parallelism limit (via ucspi-tcp)
  • Refusal of connections from known abusers (via ucspi-tcp)
  • Relaying and message rewriting for authorized clients
  • Optional RBL/ORBS support (via rblsmtpd)

5.5. Queue management

  • Instant handling of messages added to queue
  • Parallelism limits
  • Split queue directory--no slowdown when queue gets big
  • Quadratic retry schedule--old messages tried less often (see Appendix E)
  • Independent message retry schedules
  • Automatic safe queueing--no loss of mail if system crashes
  • Automatic per-recipient checkpointing
  • Automatic queue cleanups
  • Queue viewing (See qmail-qread)
  • Detailed delivery statistics (via qmailanalog)

5.6. Bounces

  • QSBMF bounce messages--both machine-readable and human-readable
  • HCMSSC support--language-independent RFC 93 error codes
  • Double bounces sent to postmaster

5.7. Routing by domain

5.8. SMTP delivery

5.9. Forwarding and mailing lists

  • Sendmail .forward compatibility (via dot-forward)
  • Hashed forwarding databases (via fastforward)
  • Sendmail /etc/aliases compatibility (via fastforward)
  • Address wildcards (See .qmail-default)
  • Mailing list owners--automatically divert bounces and vacation messages
  • VERPs--automatic recipient identification for mailing list bounces
  • Delivered-To--automatic loop prevention, even across hosts

5.. Local delivery

  • User-controlled address hierarchy--fred controls fred-anything mbox delivery
  • Reliable NFS delivery (See maildir)
  • User-controlled program delivery: procmail etc. (See qmail-command)
  • Optional new-mail notification (See qbiff)
  • Optional NRUDT return receipts (See qreceipt)
  • Conditional filtering (See condredirect and bouncesaying)

5.. POP3 service

  • RFC 39 compliant
  • UIDL support
  • TOP support
  • APOP hook
  • modular password checking (via checkpassword)

6. Related packages

qmail follows the classic UNIX philosophy that each tool should perform a single, well-defined function, and complex functions should be built by connecting a series of simple tools into a "pipeline". The alternative is to build more and more complex tools that re-invent much of the functionality of the simpler tools.
It's not surprising, then, that qmail itself doesn't do everything everyone might want it to do. Here, then, are some of the most popular add-ons written for qmail. Of course, many standard UNIX utilities can also be plugged into qmail.
  • dot-forward--a Sendmail .forward file compatibility add-on
  • fastforward--a Sendmail alias database compatibility add-on
  • ucspi-tcp--an inetd replacement
  • daemontools--a set of tools for managing daemons and their logs
  • qmailanalog--a set of qmail log file analysis tools
  • serialmail--tools for mailing over slow networks
  • mess822--tools for parsing Internet mail messages
  • ezmlm--a mailing list manager for qmail

7. Architecture

Appendix D covers qmail's functional and physical structure. In a nutshell, qmail consists of a series of programs (modules) that perform different tasks.

8. License

As of 2007--30, qmail 03 is in the public domain. See http://cr.yp.to/qmail/dist.html. This means that there are no legal limits to what you can do with it: you can copy it, give it away, sell it, modify it, rename it, or use pieces of it in copy-protected works, without any restrictions.
Other packages by Dan Bernstein, such as daemontools and ucspi-tcp, are copyrighted by the author, and are not distributed with a statement of user's rights. Inhttp://cr.yp.to/softwarelaw.html, he outlines what he thinks your rights are under U.S. copyright law. See also http://en.wikipedia.org/wiki/License-free_software.

9. Comparison with other MTA's

A book could be written about this topic, but it would be tedious reading. Here's a quick comparison of qmail with some of the most common UNIX MTA's.
MTA
Maturity
Security
Features
Performance
Sendmailish
Modular
qmail
medium
high
high
high
addons
yes
Sendmail
high
low
high
low
x
no
Postfix
medium
high
high
high
yes
yes
exim
medium
low
high
medium
yes
no
Courier
low
medium
high
medium
optional
yes
Sendmailish means the MTA behaves like Sendmail in some ways that would make a switch from Sendmail to the alternative MTA more user-transparent, such as the use of .forward files, /etc/aliases, and delivery to /var/spool/mail.
Jonathan de Boyne Pollard has reviews of many Unix MTAs at http://homepages.tesco.net/~J.deBoynePollard/Reviews/UnixMTSes/. Another detailed comparison is available at http://www.geocities.com/mailsoftware42/.

. Documentation

. man pages

The qmail distribution comes with a complete set of man pages. After installation, they're in /var/qmail/man. You'll probably need to add that directory to your MANPATHenvironment variable.
Shell
Command
Bourne (/bin/sh)
MANPATH=$MANPATH:/var/qmail/man; export MANPATH
bash, Korn
export MANPATH=$MANPATH:/var/qmail/man
C Shell
setenv MANPATH $MANPATH:/var/qmail/man
At this point, commands in the format "man name-of-qmail-man-page" should display the appropriate man page.
The man pages are also available on-line in HTML format from:

Note: The qmail man pages are loaded with information, but they require careful reading because they're written in a very dense, technical style. You might want to print off a set and read them through once to familiarize yourself with what's there and where it is. Very little information is repeated on multiple pages, so if you don't know where something is covered, it can be hard to find it.

.2. Docs

The qmail distribution includes a series of documents that are installed under /var/qmail/doc. They include:
  • FAQ: Frequently Asked Questions, with answers
  • INSTALL*: Installation documentation
  • PIC.*: Descriptions of how qmail performs key tasks. See the Architecture appendix for more information.
  • Various other installation-related documentation
These docs are also available on-line from:

.3. FAQs

There are two official FAQ (Frequently Asked Questions, with answers) documents:
The web FAQ is more complete.

.4. Books

.4. The qmail Handbook

Dave Sill, the author of Life with qmail, has written a qmail book for Apress (http://www.apress.com/). This book, The qmail Handbook, covers everything in this guide, but goes into much more detail and also covers a lot of new ground.
For more information, see http://www.apress.com/catalog/book/935402/. To order this book from my bookstore, in association with Amazon.com, seehttp://www.amazon.com/exec/obidos/ASIN/935402/davesill.

.4.2. Qmail Quickstarter: Install, Set Up and Run your own Email Server

Kyle Wheeler has written a qmail book for Packt (http://www.packtpub.com/). As the title suggests, this book is designed to help people new to qmail to set up a mail server.
To order this book from my bookstore, in association with Amazon.com, see http://www.amazon.com/exec/obidos/ASIN/4750/davesill.

.4.3. qmail

John Levine has written a qmail book for O'Reilly & Associates (http://www.oreilly.com/). See http://qmail.gurus.com/ for more info including the Table of Contents and a sample chapter.
To order this book from my bookstore, in association with Amazon.com, see http://www.amazon.com/exec/obidos/ASIN/65926285/davesill.

.4.4. Running qmail

Richard Blum has written Running qmail, which is published by Sams. This book has received mixed reviews on the qmail mailing list.
For more information or to order this book, see http://www.amazon.com/exec/obidos/ASIN/06723454/davesill.

.4.5. qmail: Yuksek Performansli E-Posta Sunucu

Ismail Yenigul, et al, have written a Turkish-language qmail book. See http://www.acikakademi.com/catalog/qmail/.

.5. List archives

The qmail e-mail mailing list, maintained by Dan Bernstein, is a valuable source of information. Web archives of the lists messages are kept at:
Most questions about qmail can be answered by searching the list archives first.

.6. Other Web Sites

. Support

. Mailing lists

The following lists reside on list.cr.yp.to. In order to prevent harvesting of e-mail addresses by spammers, I'm avoiding the use of complete, valid addresses and "mailto" URL's.
The lists are managed by ezmlm, which uses different addresses to perform different functions:
  • listname@list.cr.yp.to: the submission address. Messages sent here go out to all members of the list. Do not send subscribe/unsubscribe requests here: they won't work, and they'll annoy the subscribers.
  • listname-help@list.cr.yp.to: the "help" address. Returns a list of command addresses and general usage information.
  • listname-subscribe: send a blank message here to subscribe.
  • listname-unsubscribe: send a blank message here to unsubscribe.
To specify a subscription/unsubscription address, say joe@example.com, send the message to:
  • listname-subscribe-joe=example.com@list.cr.yp.to.

qmail

The main qmail mailing list. For discussion and questions/answers on most things related to qmail, except those with their own lists. Read Charles Cazabon's " Steps to qmail List Bliss" at http://pyropus.ca/personal/writings/-steps-to-qmail-list-bliss.html before posting. Also read the FAQs and search the list archives before posting a question. When you ask questions, please try to include sufficient details to make it possible for people to respond:
  • What did you do? What's your configuration? Include qmail-showctl output if you're not sure what's important. What action did you take? If this is a new installation, tell how you installed qmail.
  • What did you expect to happen? What was the outcome you were trying to achieve? Don't assume the reader can guess.
  • What did happen? Describe the actual result. Include log file clippings and copies of messages, with headers.

Note: The qmail list uses a utility called qsecretary to verify that messages posted to the list are not spam. Each message posted to the list will result in an e-mail confirmation request from qsecretary. Read the message and follow the directions to confirm your message--usually just replying to the qsecretary message will do the trick. Regular list posters often automate this process using autoresponders like Charles Cazabon's pymsgauth, available fromhttp://pyropus.ca/software/pymsgauth/pymsgauth verifies that message sent to the qmail list really came from you, so it won't automatically confirm forged messages sent to the list in your name.

.2. qmailannounce

The qmail announcement mailing list. New releases are announced here. There's no submission address: it's a read-only list.

.3. serialmail

For discussion of the serial mail package.

.4. ezmlm

For discussion of the ezmlm mailing list manager.

.2. Consultants

See http://www.qmail.org/top.html#paidsup for a list of commercial support providers.

.3. FAQTS Knowledgebase

A database of qmail-related questions and answers is available at http://qmail.faqts.com/. If you have a question that the FAQ doesn't answer, try searching this knowledgebase. It's especially good at answering "how to" questions


How do I increase the open files limit for a non-root users in RHEL/CentOS and Amazon Linux

Each user will have a separate file under /etc/security/limits.d

# cd /etc/security/limits.d

edit the name of the user with the required ulimit value. Here am setting it to 10000
#vim bharath.conf

bharath   - nofile 10000
bharath   - nproc  65536

save and close the session. login again.

run #ulimit -a or ulimit -n

It will reflect for the user bharath. 

Monday, February 22, 2016

Running Tomcat on port 80 on RHEL/CentOS/Amazon Linux

INSTALLING TOMCAT

We’ll need the tomcat6 package to run Tomcat’s core components, as well as the tomcat6-admin-webapps package since we’ll use Tomcat’s Manager Application for application deployments, either thru Maven’s Cargo component or thru the web-browser. Since we’ll compile the authbind application from its sources, we’ll also need gcc, the GNU C Compiler package which contains all components to build an application on Linux. To install all this, grab a terminal and execute:
yum -y install tomcat6 tomcat6-admin-webapps gcc
Usually a web server is started automatically on system boot. This can be achieved by
/sbin/chkconfig --levels 235 tomcat6 on

LISTENING ON PORTS<1024 IN LINUX WITH AN UNPRIVILEGED USER

There are more options to achieve this:
-    By using authbind which authorizes specific users to specific ports under 1024
-    By using Jsvc, a set of libraries and applications for making Java applications run on UNIX more easily (Jsvc allows Tomcat application to perform some privileged operations as root (e.g. bind to a port < 1024), and then switch identity to a non-privileged user.)
-    By configuring iptables to re-route the packets from port 80 to 8080
This article describes the 
authbind approach. But first, let's tell Tomcat to listen on port 80 instead of 8080.

CHANGING TOMCAT'S DEFAULT HTTP PORT

The default HTTP port is defined in /etc/tomcat6/server.xml:
We need to change this default port to 80 in server.xml. Either replace by hand, or automatically: to replace the occurrences of port=”8080” to port=”80”, execute the following script:
sed -i 's/port\=\"8080\"/port\=\"80\"/' /etc/tomcat6/server.xml
The same for port 8443, which will be replaced with port 443:
sed -i 's/port\=\"8443\"/port\=\"443\"/' /etc/tomcat6/server.xml
We'll start Tomcat with authbind. This can be achieved by changing Tomcat's init-script in /etc/init.d, replacing the line
TOMCAT_SCRIPT="/usr/sbin/tomcat6"
with
TOMCAT_SCRIPT="exec authbind --deep /usr/sbin/tomcat6"
Again, it can be automated like this:
sed -i  's/TOMCAT_SCRIPT=\"\/usr\/sbin\/tomcat6\"/TOMCAT_SCRIPT=\"exec authbind  --deep \/usr\/sbin\/tomcat6\"/' /etc/init.d/tomcat6
We have to tell Tomcat to use the IPv4 stack by default. This can be done by appending the line CATALINA_OPTS="-Djava.net.preferIPv4Stack=true" to /etc/tomcat6/tomcat6.conf:
sed -i '$ a\CATALINA_OPTS=\"-Djava\.net\.preferIPv4Stack=true\"\n' /etc/tomcat6/tomcat6.conf

INSTALLING AND CONFIGURING AUTHBIND

Authbind is installed the usual way, with the help of gcc and make. Please note: For this step to succeed, the gcc package is needed. It is already installed with the command yum install gcc earlier, when tomcat was installed.
cd ~
http://ftp.debian.org/debian/pool/main/a/authbind/authbind_1.2.0.tar.gz
tar xzf authbind_1.2.0.tar.gz
cd authbind_1.2.0
make
make install
Authbind is configured with some special files, for which we can assign our arbitrary permissions for the users we want to give access to. Since Tomcat is running with the Tomcat user, we'll tell authbind to allow connections to the HTTP port 80 and the HTTPS port 443 for this account:
touch /etc/authbind/byport/80
chmod 500 /etc/authbind/byport/80
chown tomcat /etc/authbind/byport/80
touch /etc/authbind/byport/443
chmod 500 /etc/authbind/byport/443
chown tomcat /etc/authbind/byport/443
For the changes to take effect, Tomcat has to be restarted:
/etc/init.d/tomcat6 restart

Install Postfix Mail Server with Dovecot and Squirrelmail on CentOS/RHEL

A commonly used Mail Transfer Agent (MTA) is postfix and this is the default MTA of RHEL. The key benefits are Easy to control, Secure and Faster MTA

Prerequirements
In order to install postfix you need to remove the other MTA’s
[root@myserver ~]# yum install postfix -y
Configuring Postfix
Open Postfix config file /etc/postfix/main.cf and find and edit the following lines
## Line no 75 – Uncomment and set your mail server FQDN ##
myhostname = server.myserver.com
## Line 83 – Uncomment and Set domain name ##
mydomain = myserver.com
## Line 99 – Uncomment ##
myorigin = $mydomain
## Line 116 – Set ipv4 ##
inet_interfaces = all
## Line 119 – Change to all ##
inet_protocols = all
## Line 164 – Comment ##
#mydestination = $myhostname, localhost.$mydomain, localhost,
## Line 165 – Uncomment ##
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
## Line 264 – Uncomment and add IP range ##
mynetworks = 192.168.1.0/24, 127.0.0.0/8
## Line 419 – Uncomment ##
home_mailbox = Maildir
Don’t forget to save the files before exit. Now you can start your postfix service.
[root@myserver ~]# /etc/init.d/postfix start
[root@myserver ~]# /etc/init.d/postfix status master (pid  1290) is running…
[root@myserver ~]# chkconfig postfix on
Now you can test your postfix server. Access the server via telnet and enter the commands shown in cots, First we need to create a test user called “bharath”
[root@myserver ~]# useradd bharath
[root@myserver ~]# passwd bharath
[root@myserver ~]# telnet localhost smtp
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
220 server.myserver.com ESMTP Postfix
ehlo localhost”
250-server.myserver.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<bharath>”
250 2.1.0 Ok
rcpt to:<bharath>”
250 2.1.5 Ok
data”
354 End data with <CR><LF>.<CR><LF>
welcome to myserver mail system”
.”
250 2.0.0 Ok: queued as 3E68E284C
quit”
221 2.0.0 Bye
Connection closed by foreign host.

That's it.


su vs su - on linux server

su gives you root permissions but it does not change the PATH variable and current working directory. so you can't execute files in /usr/sbin folder.

su - changes the PATH too... and root's home becomes your current working directory. you become proper root and can execute all commands.

$ su 
$ echo $PATH
$ pwd

note down the output of path and pwd. now execute su - 

Check the difference.

Friday, January 30, 2015

How to configure qmail E-Mail Server on RHEL(Redhat)/CentOS


QMAIL INSTALLATION :-
Packages needed for Qmail Installation
1. The Apache Web Server
2. PHP
3. Perl
4. GCC
5. OpenSSL
6. OpenSSL-devel
7. wget
8. patch & patchutils


Login to the server where you are going to install qmail and do the following settings.
# vi /etc/sysconfig/selinux and set
selinux=disabled
Part I – Downloading Qmail
#mkdir /downloads
#cd /downloads
Dowload the qmailrocks package from the following site,
#wget ftp://10.1.30.120/pub/qmailrocks.tar.gz
#tar zxvf qmailrocks.tar.gz
Part 2 - Installing Qmail Itself
This shell script takes care of the first portion of getting qmail, ucspi-tcp and daemontools intalled:
So Run this script.
#/downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script
#/downloads/qmailrocks/scripts/util/qmail_big_patches.script
#cd /usr/src/qmail/qmail-1.03
#make man && make setup check
#./config-fast dev02.newindia.com(ex: ./config-fast mail.mydomain.com)
#make cert
make cert will ask some options, fill it up:
#chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
Installing ucspi-tcp-0.88:
#cd /usr/src/qmail/ucspi-tcp-0.88/
#patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
#make && make setup check
Installing Daemontools:
#cd /package/admin/daemontools-0.76
#cd /package/admin/daemontools-0.76/src
#patch < /downloads/qmailrocks/patches/daemontools-0.76.errno.patch
#cd /package/admin/daemontools-0.76
#package/install
Part 3 – Ezmlm
When we install Qmailadmin later on, the EZmlm integrates seamlessly into Qmailadmin to provide a very user friendly mailing list management interface:
#cd /downloads/qmailrocks/
#tar zxvf ezmlm-0.53-idx-0.41.tar.gz
#cd ezmlm-0.53-idx-0.41
#make && make setup
Part 4 – Autoresponder
It allows to set up autoresponders for mailboxes and so forth:
#cd /downloads/qmailrocks
#tar zxvf autorespond-2.0.5.tar.gz
#cd autorespond-2.0.5
#make && make install


Part 5 – Vpopmail
Vpopmail is one of the major components of this installation. Vpopmail allow to do virtual domain mail hosting:
#cd /downloads/qmailrocks
#tar zxvf vpopmail-5.4.13.tar.gz
#cd vpopmail-5.4.13
#./configure --enable-logging=p
#make && make install-strip
Part 6 – Vqadmin
Vqadmin is simply a nice web based interface that will used to manage Vpopmail. Through the interface we can create new domains, new users, net quotas, enable services and much more:
#cd /downloads/qmailrocks
#tar zxvf vqadmin-2.3.6.tar.gz
#cd vqadmin-2.3.6
#./configure --enable-cgibindir=/var/www/cgi-bin --enable- htmldir=/var/www/html
#make && make install-strip
Add the following to the server's Apache configuration file:
#vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/cgi-bin/vqadmin">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>
Create a .htaccess file to password protect the Vqadmin interface at the vqadmin directory and configure the following:
#cd /var/www/cgi-bin/vqadmin/
#vi .htacess
AuthType Basic
AuthUserFile /var/www/cgi-bin/vqadmin/.htpasswd
AuthName vQadmin
quire valid-user
stisfy any
#chown apache .htaccess
#chmod 644 .htaccess
Create a corresponding .htpasswd file that's going to contain the username and encrypted password for the Vqadmin administrator...
#htpasswd -bc /var/www/cgi-bin/vqadmin/.htpasswd admin qmailctl(password)
#chmod 644 /var/www/cgi-bin/vqadmin/.htpasswd
Now restart Apache...
#apachectl stop
#apachectl start
Access vqadmin in this following page,
http://10.1.30.103/cgi-bin/vqadmin/vqadmin.cgi
username /password – As given above to .htpasswd
Part 7- Maildrop
Maildrop is a mail filtering agent which can be used to filter messages as they arrive on the server:
#cd /downloads/qmailrocks
#tar zxvf maildrop-1.6.3.tar.gz
#cd maildrop-1.6.3
#./configure --prefix=/usr/local --exec-prefix=/usr/local --enable-maildrop-uid=root --enable- maildrop-gid=vchkpw --enable-maildirquota
#make && make install-strip && make install-man
Part 8 – Qmailadmin
Qmailadmin provides nice web based interface for administering mail accounts once they are setup through Vpopmail (or Vqadmin). From Qmailadmin we can create mailboxes, aliases, fowards, mail robots, mailing lists:
#cd /downloads/qmailrocks
#tar zxvf qmailadmin-1.2.9.tar.gz
#cd qmailadmin-1.2.9
#./configure --enable-cgibindir=/var/www/cgi-bin --enable-htmldir=/var/www/html
#make && make install-strip
Open the browser, http://10.1.30.103/cgi-bin/qmailadmin and login as ,
user – postmaster
domain – newindia.com
password – as given to .htpasswd
Part 9 - Finalizing Qmail
Run the script, after that change the files to following:
#/downloads/qmailrocks/scripts/finalize/linux/finalize_linux.script
#vi /var/qmail/supervise/qmail-pop3d/run
Find "mail.example.com" and change it to your server's hostname.
For example: linux0103.dev02.newindia.com
# /var/qmail/supervise/qmail-smtpd/run
Find "mail.example.com" and change it to your server's hostname
Stop the Qmail process..
#qmailctl stop
Setting up selective relaying for localhost...
#echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
#qmailctl cdb
Create the common system aliases. These aliases are going to tell Qmail what to do with common server-generated mails.
#echo sysadmin-india > /var/qmail/alias/.qmail-root
#echo sysadmin-india > /var/qmail/alias/.qmail-postmaster
#echo sysadmin-india > /var/qmail/alias/.qmail-mailer-daemon
#ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
#chmod 644 /var/qmail/alias/.qmail*
Part 10 - Uninstalling Sendmail
Removing Sendmail:
#/etc/rc.d/init.d/sendmail stop (to stop Sendmail)
#mv /usr/lib/sendmail /usr/lib/sendmail.old
#mv /usr/sbin/sendmail /usr/sbin/sendmail.old
#chmod 0 /usr/lib/sendmail.old /usr/sbin/sendmail.old
Establishing an "artificial" Sendmail path:
#ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
#ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
Part 11 - Starting qmail
Run this script that will check the key components of the installation and make sure everything is alright. If its not right it will show the options to check:
#/downloads/qmailrocks/scripts/util/qmr_inst_check
If the result is "congratulations" type of message, everything is fine
Restart the Qmail services.
#qmailctl stop
#qmailctl start
#qmailctl stat
/service/qmail-send: up (pid 29956) 2 seconds
/service/qmail-send/log: up (pid 29960) 2 seconds
/service/qmail-smtpd: up (pid 29963) 2 seconds
/service/qmail-smtpd/log: up (pid 29968) 2 seconds
/service/qmail-pop3d: up (pid 29971) 2 seconds
/service/qmail-pop3d/log: up (pid 29972) 2 seconds
messages in queue: 0
messages in queue but not yet preprocessed: 0




Checking the connections:
#telnet localhost 110
Trying 10.1.30.103...
Connected to 10.1.30.103.
Escape character is '^]'.
+OK <16658.1054485137@yourserver.com>
user postmaster@newindia.com
+OK
pass <password>
+OK
quit
+OK
Connection closed by foreign host.




#telnet localhost 110
Trying 10.1.30.103...
Connected to 10.1.30.103.
Escape character is '^]'.
+OK <16658.1054485137@yourserver.comt>
user postmaster@newindia.com
+OK
pass <password>
+OK
list
+OK
1 323 (there's your message!)
quit
+OK
Connection closed by foreign host.




And now let's test SMTP service to make sure the TLS functionaltiy is there...
#telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 somewhere.anywhere.com ESMTP
ehlo localhost
250-somewhere.anywhere.com
250-AUTH LOGIN CRAM-MD5 PLAIN
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-STARTTLS
250-PIPELINING
250 8BITMIME
starttls
220 ready for tls
quit
quit
Connection closed by foreign host.

#chown vpopmail:qmail /var/qmail/control/servercert.pem
Part 12 - Installing Courier IMAP & IMAP SSL
#cd /downloads/qmailrocks/
#tar jxvf courier-authlib-0.55.tar.bz2
#cd courier-authlib-0.55
#./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authldap -- without-authmysql --disable-root-check --with-ssl --with- authchangepwdir=/usr/local/libexec/authlib --with-redhat
#make && make check
#make install-strip && make install-configure
Adding services to start automatically when the system starts up.
#vi /etc/rc.local
Add the following line:
#/usr/local/sbin/authdaemond start
INSTALLING COURIER-IMAP:
#cd /downloads/qmailrocks/
#tar jxvf courier-imap-4.0.2.tar.bz2
#useradd courier
#chown -R courier:wheel courier-imap-4.0.2
#cd /downloads/qmailrocks/courier-imap-4.0.2
#su courier
#./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw –without- authldap -- without-authmysql --disable-root-check --with-ssl –with- authchangepwdir=/usr/local/libexec/authlib --with-redhat
Note: the configure process will take a few minutes..
#make && make check
#exit
#make install-strip && make install-configure
Now let's create an SSL certificate for the IMAP-SSL server...
#/usr/local/sbin/mkimapdcert
#vi /usr/local/etc/imapd.cnf
change postmaser@example.com an administrative email address
Save and exit
Changing the setting for imap
#vi /usr/local/etc/imapd
Make sure that the following configuration exists: IMAPDSTART=YES
#vi /usr/local/etc/imapd-ssl
Make sure that the following configuration exists: IMAPDSSLSTART=YES
Make sure that the following configuration exists: TLS_CERTFILE=/usr/local/share/imapd.pem
Save and exit the file.
Changing the options for authdaemonrc
#vi /usr/local/etc/authlib/authdaemonrc
Find authmodulelist and delete other than the folowing,
authmodulelist="authvchkpw"
Save and exit the file.
Now we create the startup scripts...
#cp /usr/local/libexec/imapd.rc /etc/rc.d/init.d/imap
#cp /usr/local/libexec/imapd-ssl.rc /etc/rc.d/init.d/imaps
Now start Authdaemond, IMAP and IMAPS. To be safe we'll stop each service before starting it...
#/usr/local/sbin/authdaemond stop
#/usr/local/sbin/authdaemond start
#/etc/rc.d/init.d/imap stop
#/etc/rc.d/init.d/imaps stop
#/etc/rc.d/init.d/imap start
#/etc/rc.d/init.d/imaps start
Run "nmap localhost", to see both 143 and 993 is now open and listening.
Now test imap connection....
#telnet localhost 143
Trying 10.1.30.103...
Connected to 10.1.30.103.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE STARTTLS] Courier-IMAP ready. Copyright 1998-2003 Double Precision, Inc. See COPYING for distribution information.
a login postmaster@mydomain.com my_password
a OK LOGIN Ok. (successful login!)
a logout (logs you out)
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.

Part 13 - Installing Squirrelmail
Download the squirrelmail version and copy it to /var/www/html
#tar zxvf /path/to/squirrelmail-x.x.x.tar.gz
Now rename the untarred folder
#mv squirrelmail-x.x.x webmail
Configuring Squirrelmail...
#mkdir /var/sqattachements
#chown -R apache:apache /var/sqattachements (or whatever user apache runs as)
#cd webmail
#chown -R apache:apache data (or whatever user apache runs as)
#cd config
#./conf.pl
For our Setup we can download webmail on following:
link: ftp://10.1.30.120/pub/webmail.tar.gz
We need to change “ data “ folder to
#chown apache.apache data/ -R






This will run the Squirrelmail setup script which will allow to customize the installation as well as server settings.
General
-----------
1. Domain : newindia.com
2. Invert Time : false
3. Sendmail or SMTP : SMTP

IMAP Settings
-------------------
4. IMAP Server : localhost
5. IMAP Port : 143
6. Authentication type : login
7. Secure IMAP (TLS) : false
8. Server software : other
9. Delimiter : detect

SMTP Settings
--------------------
4. SMTP Server : localhost

5. SMTP Port : 25
6. POP before SMTP : false
7. SMTP Authentication : login (with IMAP username and password)
8. Secure SMTP (TLS) : false
9. Header encryption key :



There are probably about a million ways to do this, but here's what I do. I edit the httpd.conf Apache configuration file and add the following block:
<VirtualHost 10.1.30.103:80>
ServerName linux0103.dev02.newindia.com
ServerAlias mail.*
ServerAdmin sysadmin-india@newindia.com
DocumentRoot /var/www/html/webmail
</VirtualHost>

To open the link, follow this,
Part 13 - Installing Fastforward
Download Fastforward to /var/qmail and install it.
To install fastforward follow these steps,
#cd /var/qmail
#tar -zxvf fastforward-x.xx.tar.gz
#cd fastforward-x.xx
#vi error.h
Remove the line extern int errno; and insert #include<errno.h> and save it.
#make setup check
or
#vi error.h
Only to add into file conf-cc.
-include /usr/include errno.h
Like follows.
cc -O2 -include /usr/include/errno.h
ALIASES:
#vi /etc/aliases
Update the aliases in this file and run,
#/var/qmail/fastforward-x.xx/newaliases


How to install MySQL Database using binary source on RHEL(Redhat)/CentOS

MYSQL INSTALLATION AND CONFIGURATION
The following stable production release of mysql should be downloaded from mysql.org mysql-standard-5.0.37-linux-1686-glibc23.tar.gz

Select a machine on which you want to install mysql.
Create a separate partition on the machine named /mysql-db
Copy the tar file and untar into /mysql-db.
After untaring the binary, you may get a directory named mysql-standard-5.0.15-linux-1686-glibc23.
Create a soft link for the same as follows:
#ln -s mysql-standard-5.0.15-linux-1686-glibc23 mysql
#cd /mysql-db/mysql
#cp scripts/mysql_install_db /mysql-db/mysql
#groupadd mysql
#useradd -g mysql -c “MySQL DB User” mysql
#./mysql_install_db –user=mysql

#vi data/my.cnf and make the following changes or copy the my.cnf (backup) file into the following location - /mysql-db/mysql/data/,

[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
# Uncomment the following if you are using InnoDB tables
datadir = /mysql-db/mysql/data
innodb_data_home_dir = /mysql-db/mysql/data
innodb_file_per_table
innodb_data_file_path = ibdata1:100M:autoextend
innodb_log_group_home_dir = /mysql-db/mysql/data/
innodb_log_arch_dir = /mysql-db/mysql/data/
   
Change the user permission for /mysql-db
chown -R mysql.mysql /mysql-db
#vim /etc/init.d/mysql and change the base directory and data directory according to our mysql structure.

Start MySQL
#/etc/ini.d/mysql start

Open the log err-log file present in /mysql-db/mysql/data directory if mysql doesn't started or if error message shown.
If no errors, Mysql have started successfully.
Thast it. we have configured MySQL from binary.