Skip to main content

:: install postfix, cyrus, courier, mysql, postfixadmin, squirrelmail on opensuse

:: what is
please take a look this.

:: install dependency
+ installing berkeleyDB
+ installing MySQL
+ installing Apache
+ installing PHP

:: remove sendmail
[ root:~ ]# rpm -e sendmail --nodeps

:: build cyrus-sasl
[ root: ~ ]# wget ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.23.tar.gz
[ root: ~ ]# tar -xzf cyrus-sasl-2.1.23.tar.gz
[ root: ~ ]# groupadd mail
[ root: ~ ]# useradd -u 96 -d /usr/cyrus -g mail cyrus
[ root: ~ ]# passwd cyrus
[ root: ~ ]# cd cyrus-sasl-2.1.23/
[ root: cyrus-sasl-2.1.23 ]# export CPPFLAGS="-I/usr/local/mysql/include/mysql"
[ root: cyrus-sasl-2.1.23 ]# ./configure --enable-anon --enable-plain --enable-login --enable-sql --disable-krb4 --disable-otp --disable-cram --disable-digest --with-mysql=/usr/local/mysql --with-plugindir=/usr/lib/sasl2 --without-pam --without-saslauthd --without-pwcheck
[ root: cyrus-sasl-2.1.23 ]# make && make install

:: installing Postfix

+ download postfix
[ root:~ ]# wget http://mirror.postfix.jp/postfix-release/official/postfix-2.6.5.tar.gz
[ root:~ ]# tar -xzf postfix-2.6.5.tar.gz

+ build postfix
[ root: ~ ]# groupadd -g 1001 postfix
[ root: ~ ]# groupadd -g 1002 postdrop
[ root: ~ ]# useradd -g 1001 -u 1001 postfix -G postdrop -d /dev/null -s /bin/false postfix
[ root: ~ ]# cd postfix-2.6.5/
[ root: postfix-2.6.5 ]# ln -sf /usr/local/BerkeleyDB.4.8/include/db.h /usr/include/db.h
[ root: postfix-2.6.5 ]# ln -s /usr/local/include/sasl /usr/include/sasl
[ root: postfix-2.6.5 ]# echo '/usr/local/mysql/lib/mysql' >> /etc/ld.so.conf
[ root: postfix-2.6.5 ]# ldconfig
[ root: postfix-2.6.5 ]# make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_TLS -DUSE_CYRUS_SASL -I/usr/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/lib -lssl -lcrypto -lsasl2 -L/usr/local/BerkeleyDB.4.8/lib'
[ root: postfix-2.6.5 ]# make && make install

configure Postfix installation like this:
install_root: [/]
tempdir: [/root/postfix-2.6.5]
config_directory: [] /etc/postfix
command_directory: [] /usr/sbin
daemon_directory: [] /usr/libexec/postfix
data_directory: [] /var/lib/postfix
html_directory: [] no
mail_owner: [] 1001
mailq_path: [] /usr/bin/mailq
manpage_directory: [] /usr/local/man
newaliases_path: [] /usr/bin/newaliases
queue_directory: [] /var/spool/postfix
readme_directory: [] no
sendmail_path: [] /usr/sbin/sendmail
setgid_group: [] 1001

+ configuration Postfix on main.cf file
[ root: ~ ]# cd /etc/postfix/
[ root: postfix ]# vi main.cf
#
# on main configure,
# change these option like :
#
myhostname = mail.toxpenguin.com
mydomain = toxpenguin.com
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks_style = host
home_mailbox = Maildir/

#
# add these configuration :
#
# Configuration for MySQL
virtual_gid_maps = static:1001
virtual_uid_maps = static:1001
virtual_minimum_uid = 1001
virtual_transport = virtual
virtual_mailbox_base = /var/mail/
virtual_mailbox_limit = 112400000
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf
alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

#
# Configure for TLS
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_use_tls = yes
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_tls_key_file = /etc/ssl/smtpd.pem
smtpd_tls_cert_file = /etc/ssl/smtpd.pem
smtpd_tls_CAfile = /etc/ssl/smtpd.pem
tls_ramdom_source = dev:/dev/urandom

#
# Configure for SASL
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_application_name = smptd
smtpd_sasl_security_options = noanonymous
smtpd_banner = $myhostname ESMTP
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination,permit

+ edit master.cf
[ root: postfix ]# vi master.cf
rewrite unix - - y - - trivial-rewrite

+ make SSL for Postfix
[ root: postfix ]# cd /etc/ssl/
[ root: ssl ]# openssl req -new -x509 -nodes -out smtpd.pem -keyout smtpd.pem -days 3650

:: configure MySQL DB for Postfix
+ create database for postfix
[ root: ~ ]# /usr/local/mysql/bin/mysql -u root -p
Enter password: [ mysqlrootpass ]
mysql> create database postfix;
Query OK, 1 row affected (0.05 sec)

mysql> grant all on postfix.* to postfix@localhost identified by 'postfixpass';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

+ make virtual domains configuration files
[ root: ~ ]# cd /etc/postfix/
[ root: postfix ]# vi mysql_virtual_domains_maps.cf
#
# Add the line like :
user = postfix
password = postfixpass
hosts = localhost
dbname = postfix
query = SELECT domain AS virtual FROM domain WHERE domain='%s'

+ make virtual mailbox configuration files
[ root: postfix ]# vi mysql_virtual_mailbox_maps.cf
#
# Add the line like :
user = postfix
password = postfixpass
hosts = localhost
dbname = postfix
query = SELECT maildir FROM mailbox WHERE username='%s' AND active='1'

+ make virtual alias configuration files
[ root: postfix ]# vi mysql_virtual_alias_maps.cf 
#
# Add the lines like:
user = postfix
password = postfixpass
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias WHERE address='%s' AND active='1'

:: installing Courier-authlib
[ root: ~ ]# wget https://sourceforge.net/projects/courier/files/authlib/0.62.4/courier-authlib-0.62.4.tar.bz2/download
[ root: ~ ]# tar -xjf courier-authlib-0.62.4.tar.bz2
[ root: ~ ]# zypper in pam-devel
[ root: ~ ]# cd courier-authlib-0.62.4/
[ root: courier-authlib-0.62.4 ]# ./configure --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib"
[ root: courier-authlib-0.62.4 ]# make && make install

:: configure Courier Authlib
+ authdaemonrc
[ root: ~ ]# vi /usr/local/etc/authlib/authdaemonrc
#
# add lines like:
authmodulelist="authmysql authpam"
DEBUG_LOGIN=1
daemons=1

+ authmysqlrc
[ root: ~ ]# vi /usr/local/etc/authlib/authmysqlrc
#
# Add lines like:
MYSQL_server localhost
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfixpass
MYSQL_PORT 0
MYSQL_OPT 0
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD '1001'
MYSQL_GID_FIELD '1001'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD '/var/mail'
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir

+ configure SASL on smtpd.conf
[ root: ~ ]# vi /usr/lib/sasl2/smtpd.conf
#
# Add the lines like :
pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/usr/local/var/spool/authdaemon/socket

+ change owner of authdaemond directory
[ root: ~ ]# chown -R postfix.postfix /usr/local/var/spool/authdaemon/

+ change permisson on authdaemon directory
[ root: ~ ]# chmod o+x /usr/local/var/spool/authdaemon/

+ change owner of mail directory
[ root: ~ ]# chown -R postfix.postfix /var/mail/

:: installing Courier Imap
please compiled courier imap by ordinary users (tox) on the box.
[ root: ~ ]# su - tox
tox@suse:~> wget https://sourceforge.net/projects/courier/files/imap/4.6.0/courier-imap-4.6.0.tar.bz2/download
tox@suse:~> tar -xjf courier-imap-4.6.0.tar.bz2
tox@suse:~> cd courier-imap-4.6.0/
tox@suse:~/courier-imap-4.6.0> ./configure --prefix=/usr/local/courier --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql --with-authmysql --with-authmysql=yes --with-authchangepwdir LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib"
tox@suse:~/courier-imap-4.6.0> make
tox@suse:~/courier-imap-4.6.0> exit
logout

build courier imap by root users.
[ root: ~ ]# cd /home/tox/courier-imap-4.6.0/
[ root: courier-imap-4.6.0 ]# make install
[ root: courier-imap-4.6.0 ]# make install-configure

:: installing postfixadmin
+ build postfixadmin
[ root: ~ ]# wget http://sourceforge.net/projects/postfixadmin/files/postfixadmin/postfixadmin_2.3.tar.gz/download
[ root: ~ ]# tar -xzf postfixadmin_2.3.tar.gz
[ root: ~ ]# mv postfixadmin-2.3/ /usr/local/apache2/htdocs/postfixadmin

+ configure postfixadmin
[ root: ~ ]# cd /usr/local/apache2/htdocs/postfixadmin/
[ root: postfixadmin ]# vi config.inc.php
#
# configure on these line :
#
$CONF['configured'] = true;

$CONF['database_type'] = 'mysql';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'postfixpass';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';

+ webase installation
goto url on http://yourip/postfixadmin/setup.php
ex: http://10.100.100.35/postfixadmin/setup.php
postfixadmin automatically scan your configuration..change password for this and don't forget delete setup.php file after all done..



+ add vdomain
goto url on http://yourip/postfixadmin
login with user admin and added vdomain on it.


+ add mailbox
virtual list - add mailbox


:: starting Mail Service
[ root: ~ ]# /usr/local/sbin/authdaemond start
[ root: ~ ]# /usr/local/courier/libexec/imapd.rc start
[ root: ~ ]# /usr/local/courier/libexec/imapd-ssl.rc start
[ root: ~ ]# /usr/sbin/postfix start

:: testing
+ postfix
[ root: ~ ]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 suse.localdomain ESMTP
ehlo localhost
250-suse.localdomain
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: tix@toxpenguin.com
250 2.1.0 Ok
rcpt to: hai@toxpenguin.com
250 2.1.5 Ok
data
354 End data with .
testink from tix..

:D

.
250 2.0.0 Ok: queued as 1A75E1477F0
quit
221 2.0.0 Bye
Connection closed by foreign host.


+ courier-imap
[ root: ~ ]# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2008 Double Precision, Inc. See COPYING for distribution information.
a login hai@toxpenguin.com haipass
a OK LOGIN Ok.
a select inbox
* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\* \Draft \Answered \Flagged \Deleted \Seen)] Limited
* 3 EXISTS
* 2 RECENT
* OK [UIDVALIDITY 1258253014] Ok
* OK [MYRIGHTS "acdilrsw"] ACL
a OK [READ-WRITE] Ok
a logout
* BYE Courier-IMAP server shutting down
a OK LOGOUT completed
Connection closed by foreign host.

:: installing webmail (squirrelmail)
+ downloading squirrelmail
[ root: ~ ]# wget http://squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fprdownloads.sourceforge.net%2Fsquirrelmail%2Fsquirrelmail-1.4.19.tar.gz
[ root: ~ ]# tar -xzf squirrelmail-1.4.19.tar.gz
[ root: ~ ]# mv squirrelmail-1.4.19 /usr/local/apache2/htdocs/webmail

+ configure squirrelmail for webmail
[ root: ~ ]# cd /usr/local/apache2/htdocs/webmail/
[ root: webmail ]# ./configure
#
2. Server Settings
1. Domain
A. Update IMAP Settings
6. Authentication type : login
8. Server software : courier

B. Update SMTP Settings
7. SMTP Authentication : login
#
S Save data
Q Quit

+ access webmail
goto url on http://yourip/webmail and then login on it with your email accounts.


:: links
+ googlelinux
+ wowtutorial
+ phparchitecture

Comments

Popular posts from this blog

Simple Step Installing WordPress in Ubuntu 24.04

Using ols1clk.sh Script This step will: Install OpenLiteSpeed Install PHP Secure your server Install MySQL Set up WordPress Run the script: bash <( curl -k https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh ) -w  Configuring WordPress Open your browser and navigate to your domain: http://yourdomain.com You’ll be greeted by the famous WordPress installation wizard. Follow these steps: Select your preferred language. Enter your site title, username, and password for the WordPress admin account. Click "Install WordPress." And just like that, you’ve done it!

:: Install NginX from source

:: What is NGINX nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by  Igor Sysoev . o nginx :: How to install NGINX from source on OpenSUSE + installing dependency # zypper in pcre-devel zlib-devel libopenssl-devel + create username and group # groupadd nginx # useradd -r -g nginx nginx + compile and installing nginx # wget http://nginx.org/download/nginx-1.1.8.tar.gz # tar -xzf nginx-1.1.8.tar.gz # cd nginx-1.1.8 # ./configure --user=nginx --group=nginx --with-http_ssl_module # make && make install :: Starting / restarting httpd # /usr/local/nginx/sbin/nginx # /usr/local/nginx/sbin/nginx -s reload :: Link + Google + BlacKonsole

:: How to Recompile Nginx in Ubuntu

  Recompiling Nginx on Ubuntu can be a crucial task for those who need to customize their web server to meet specific requirements. Whether you need to add new modules, optimize performance, or apply patches, recompiling Nginx allows you to tailor the server to your needs. This guide will walk you through the process step-by-step, ensuring you have a smooth and successful recompilation.   Understanding the Need for Recompilation Why Recompile Nginx? Recompiling Nginx is often necessary when you need to add or remove modules that are not included in the default package. For instance, if you need to integrate a third-party module for enhanced security or performance, recompilation is the way to go. Additionally, recompiling allows you to apply custom patches or optimizations that can significantly improve your server's efficiency. Benefits of Custom Compilation Custom compiling Nginx offers several advantages. Firstly, it provides greater control over the server'...