configuration squirrelmail on freebsd operating … · web view4. at options for php5-extension 1.0...

23
Procedure of Configuration SquirrelMail on FreeBSD Operating system Table of content SquirrelMail - Introduction to SquirrelMail - SquirrelMail requirement Apache - Installation of Apache22 web server PHP5 - Introduction to PHP5 - Installation of PHP5 - Configure Apache22 web server for PHP5 Postfix - Introduction to Postfix - Installation Postfix - Configuration Postfix Dovecot - Introduction to dovecot - Install Dovecot IMAP server - Configure Dovecot SquirrelMail installation and configuration - Installation of SquirrelMail - Configure SquirrelMail Virtual Host - Introduction to virtual host - Configure Virtual Host for mail server MySQL server - Install MySQL server - Configure MySQL server Postfix Admin - Install Postfix Admin - Configure Postfix Admin 1

Upload: others

Post on 21-Aug-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Procedure of Configuration SquirrelMail on FreeBSD Operating systemTable of content

SquirrelMail- Introduction to SquirrelMail

- SquirrelMail requirementApache

- Installation of Apache22 web server PHP5

- Introduction to PHP5- Installation of PHP5 - Configure Apache22 web server for PHP5

Postfix- Introduction to Postfix - Installation Postfix - Configuration Postfix

Dovecot- Introduction to dovecot- Install Dovecot IMAP server - Configure Dovecot

SquirrelMail installation and configuration - Installation of SquirrelMail- Configure SquirrelMail

Virtual Host - Introduction to virtual host - Configure Virtual Host for mail server

MySQL server- Install MySQL server - Configure MySQL server

Postfix Admin- Install Postfix Admin - Configure Postfix Admin - Example of Adding new domain

1

Page 2: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Introduction to SquirrelMailSquirrelMail is a standards-based web mail package

written in PHP. It includes built-in pure PHP support for the IMAP and SMTP protocols, and all pages render in pure HTML 4.0 (with no JavaScript required) for maximum compatibility across browsers. It has very few requirements and is very easy to configure and install. SquirrelMail has all the functionality you would want from an email client, including strong MIME support, address books, and folder manipulation. SquirrelMail requirementIn order to install and configure SquirrelMail there are some requirement:

- SquirrelMail- Apache22- PHP5- Dovecot - Postfix - Postfix Admin- MySQL server

Installation of Apache22 web server 1. Install Apache HTTP Server 2.20 by using FreeBSD Ports Collection:# cd /usr/ports/www/apache22

# make install clean

2. A Apache HTTP Server script apache22.sh is located at /usr/local/etc/rc.d to provide Apache HTTP Server start and shutdown service. To enable Apache web server to automatically start whenever after server reboots, issue the following command at CLI:echo ‘apache22_enable =”YES”‘ >> /etc/ rc.conf

2

Page 3: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

3. To start Apache HTTP web server immediately, use:# /usr/local/sbin/apachectl startor# /usr/local/etc/rc.d/apache22.sh startor# apacheclt restart

4. Testing apache service Open web browser and type http://server-ip-address”The result is “It work!”

5. Apache installation finished.

Introduction to PHP5PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in standalone graphical applications.

Installation of PHP5 1. Install by enter the following commands on FreeBSD OS command line #/usr/ports/lang/php5

#make install

2. If you’re prompted, select “use Apache 2.x instead”.

3. Continue with the following commands to install PHP5 extensions and modules to enable the support of the modules in Apache:#cd /usr/ports/lang/php5-extensions

3

Page 4: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

#make config

4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server. This is a part of the configuration for PHP, where you need to enable features of PHP that come in modules, such as ability to manage user sessions, interface with databases and many others. Default extensions such as ctype functions support, HASH Message Digest Framework support, session support and etc have been selected. Other popular extensions that you most likely to be in used are MySQL database support and GD library support. Use space bar to select or unselect the extensions and press Enter when done.

5. Continue the installation of php5-extensions with the following commands:# make install

Configure Apache22 web server1. Edit the Apache configuration file in order to enable Apache web server to load the PHP modules when initialization:

2. Go to Apache configuration file location by # cd /usr/local/etc/apache2/

3. Edit Apache configuration file by

4

Page 5: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

# ee httpd.conf

4. Search for LoadModule lines, after the last LoadModule line, but within the same section, add the following lines:

<IfModule mod_dir.c><IfModule mod_php3.c>

<IfModule mod_php5.c>DirectoryIndex index.php index.php3

index.html</IfModule><IfModule !mod_php4.c>

DirectoryIndex index.php3 index.html</IfModule>

</IfModule><IfModule !mod_php3.c>

<IfModule mod_php5.c>DirectoryIndex index.php index.html index.htm

</IfModule><IfModule !mod_php4.c>

DirectoryIndex index.html</IfModule>

</IfModule></IfModule>

AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps

5

Page 6: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Note: After you install PHP5 the LoadModule php5_module line will add automatic it mean that your php5 is work with apache

5. Copy /usr/local/etc/php.ini-dist to /usr/local/etc/php.ini (in same directory), which will enable you to tune and change the default settings of behaviors of PHP.

6. Start the Apache HTTP web server by using apachectl start (or restart Apache HTTP web server by using apachectl restart). apachectl is located in /usr/local/sbin, if you encounter

Command not found problem, try to change directory to its location.

7. PHP5 installation done.

8. Testing php installation by change to path /usr/local/www/apache22/data#cd /usr/local/www/apache22/dataCreate file and then add content below #ee test.php<? phpinfo(); ?>

Open web browser and type “http://server-ip-address/test.php”The page information display means that php5 is successful installed on your computer

6

Page 7: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Introduction to Postfix

Postfix is a free and open source mail transfer agent (MTA), a computer program for the routing and delivery of email. It is intended as a fast, easy-to-administer, and secure alternative to the widely-used Sendmail MTA.

Installation Postfix 1.Change directory to /usr/ports/mail/postfix#cd /usr/local/mail/postfix

2. Start installation postfix # make install

it will connect to internet to download package to install on your computer(so you have to connect your computer have connection with internet first) but if you have package it already you can copy this package into /usr/ports/distfiles all the necessary package will load from this location

3. Select package to install

7

Page 8: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Important packetSASL 2 TLS MySQL

4. Edit rc.conf file

Add the following line sendmail_enable=”NO”sendmail_submit_enable=”NO”sendmail_outbound_enable=”NO”sendmail_msp_queue_enable=”NO”postfix_enable=”YES”

8

Page 9: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

5. Restart postfix service

Note: In the distfiles folder is all package that use to install postfix so you can copy this package into /usr/ports/distfiles it no need to download any package for another installation

Configuration Postfix 1. Change directory to /usr/local/etc/postfix/# cd /usr/local/etc/postfix/

2. Edit file main.cf# ee main.cfAdd your domain name in line 77

Add your network in line 254

Add host name of your computer

Add ip address of your mail server

Add masquerade_domains

Restart Postfix server

Testing Postfix

9

Page 10: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Introduction to dovecotDovecot is an open source IMAP and POP3 server for Linux/UNIX-like systems, written primarily with security in mind. Developed by Timo Sirainen, Dovecot was first released in July 2002. Dovecot primarily aims to be a lightweight, fast and easy to set up open source mailserver.

Install Dovecot 1. Change directory to /usr/ports/mail/dovecot# cd /usr/ports/mail/dovecot

2. Install dovecot packet # make install

Configure Dovecot 1. Change directory to /usr/local/etc# cd /usr/local/etc

2. Copy configuration file # cp dovecot-example.conf dovecot.conf

3. Edit file dovecot.conf# ee dovecot.conf

Make sure that protocols is imap and pop3 on line 24

Checkout “#” from socket listen in line 985

Checkout “#” from client in line 990

Add the following line at client {

10

Page 11: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Edit /etc/rc.conf file and add this line in order to enable dovecot service

Installation of SquirrelMail1. Chang directory to /usr/ports/mail/squirrelmail# cd /usr/ports/mail/squirrelmail

2. Install SquirrelMail packet # make install

Configure SquirrelMail1. Change directory to /usr/local/www/squirrelmail# cd /usr/local/www/squirrelmail

2. Configure SquirrelMail # ./configure

You can defines your Organization Preferences, Server setting, folder Defaults and other information depend on you requirement of your Company/OrganizationExample:

setting on Organization

11

Page 12: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

type 1 press enter keytype 1 press enter key

Write your Organization Name. press enter key.Example: SquirrelMail press enter key

press S to save setting.press R to return to main menu.

Example: Change domain name setting .press key 2 press key 1 enter your domain name for example abcd.com.khpress s to save configuration press r to return back

3. Create /usr/local/etc/apache22/Includes/squirrelmail.conf file with below content :

Alias /squirrelmail/ "/usr/local/www/squirrelmail/"<Directory "/usr/local/www/squirrelmail"> AllowOverride None Options None Order allow,deny Allow from all</Directory>

4. Open web browser and type http://server-ip-address/webmail/config

12

Page 13: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

5. Login in to SquirrelMail

Introduction to virtual host

Virtual hosting is a method that servers such as web servers use to host more than one domain name on the same computer, sometimes on the same IP address.

Configure Virtual Host for mail server 1. Change directory to /usr/local/etc/apache22/# cd /usr/local/etc/apache22/

2. Edit httpd.conf # ee httpd.confEdit on line 455 add Include file

3. Change directory to /usr/local/etc/apache22/extra/# cd /usr/local/etc/apache22/extra/

4. Copy the template Virtual host configuration file# cp httpd-vhosts.conf mail.abcd.com.kh.conf

13

Page 14: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

5. Edit mail.abcd.com.kh.conf file

Add ip address for mail server into Name Virtual host

Add Virtual host information

6. Restart apache service # apachectl restart

Restart dovecot service# /usr/local/etc/rc.d/dovecot restart

7. Access to mail web site Open web browser with http://mail.abcd.com.kh

14

Page 15: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Introduction to MySQLMySQL is a relational database management system (RDBMS)[1] which has more than 11 million installations.[2] The program runs as a server providing multi-user access to a number of databases.

Install MySQL server

1. Change directory to /usr/ports/databases/mysql50-server/# cd /usr/ports/databases/mysql50-server/

2. Install MySQL packet # make install

Configure MySQL server1. Restart MySQL service # /usr/local/etc/rc.d/mysql-server restart

2. Add MySQL admin user and password # mysqladmin -u root -p password P@ssw0rd

3. Login MySQL# mysql –p

Note: MySQL command useful 1. To create database: create database database-name;2. View database: show databases;3. Delete database: drop database database-name;

Introduction to postfix admin

15

Page 16: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

Postfix Admin is a web based interface used to manage mailboxes, virtual domains and aliases. It also features support for vacation/out-of-the-office messages.

Install Postfix Admin1. Change directory to /usr/ports/mail/postfixadmin/# cd /usr/ports/mail/postfixadmin/

2. Install PostfixAdmin packet # make install

Configure Postfix Admin

1. Change directory to /usr/local/www/postfixadmin/images/#cd /usr/local/www/postfixadmin/images/

2. Assign permissions #chmod 777 *.gif *.png

3. Change directory to /usr/local/www/postfixadmin/languages/# cd /usr/local/www/postfixadmin/languages/

4. Assign permission #chmod 777 *.lang

5. Change directory to /usr/local/www/postfixadmin/templates/# cd /usr/local/www/postfixadmin/templates/

6. Assign permission #chmod 640 *.tpl7. Change directory to /usr/local/www/postfixadmin/users/# cd /usr/local/www/postfixadmin/users/

8. Assign permission #chmod 777 *.php

9. change directory to /usr/local/www/postfixadmin#cd /usr/local/www/postfixadmin

10. Add MySQL database #mysql -u root < DATABASE_MYSQL.TXT

11. Change directory to /usr/local/www/postfixadmin/# cd /usr/local/www/postfixadmin/

12. Configure PostfixAdmin file

16

Page 17: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

# ee config.inc.phpFind like below and add this content

$CONF['default_language'] = 'en';$CONF['database_type'] = 'mysql';$CONF['database_host'] = 'localhost';$CONF['database_user'] = 'postfixadmin';$CONF['database_password'] = 'postfixadmin';$CONF['database_name'] = 'postfix';$CONF['encrypt'] = 'md5crypt';$CONF['domain_path'] = 'YES';$CONF['domain_in_mailbox'] = 'NO';$CONF['quota'] = 'YES';$CONF['footer_text'] = 'Return to mail.abcd.com.kh‘;$CONF['footer_link'] = 'http://mail.abcd.com.kh';

13. Open web browser and type: http://mail.abcd.com.kh/postfixadmin/adminit require username and password of postfixadmin user

Add New domain via Postfix admin 1. Open postfixadmin page => select New Domain and then add new domain name

17

Page 18: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

2. Change directory to /etc/namedb

3. Add new zone configuration for chuanwei.com.kh domain

4. change directory to /etc/namedb/master

18

Page 19: Configuration SquirrelMail on FreeBSD Operating … · Web view4. At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache web server

5. create new zone for chuanwei.com.kh

6. Add configuration for chuanwei.com.kh zone

7. Open web browser and type http://mail.chuanwei.com.kh

The End!

19