Installation and configuration of LinuxWebmailIMP

Source: Internet
Author: User
Installation and configuration of LinuxWebmailIMP-Linux Enterprise Application-Linux server application information. For details, refer to the following section. 1. Overview

Webmail IMP allows Web-based access to IMAP/POP3 servers. It also provides address book and LDAP directory queries, and supports sending and receiving attachments, there are also many features that can be found in common desktop email client programs. If you have installed an Apache server that supports SSL, you can send and read emails securely through SSL. In this article, we configure Webmail IMP to use PostgreSQL and use IMAP to connect. Webmail also supports many other databases. If you like, you can use MySQL, Oracle, Sybase, and other SQL database servers. Of course, you can also choose POP3 instead of IMAP.

2. Notes

All the following commands are Unix-compatible commands.

The Source Path is "/var/tmp" (other paths can also be used in actual situations ).

Installed in RedHat Linux 6.1 and 6.2.

Use the "root" user for installation.

The Horde version is 1.2.0.

The version of Webmail IMP is 2.2.0.

The PHPLib version is 7.2b.

3. Source of the software package

Webmail IMP home page: http://www.horde.org/imp/

Download: horde-1.2.0-pre11.tar.gz

Download: imp-2.2.0-pre11.tar.gz

PHPLib home page: http://phplib.netuse.de/index.php3

Download: phplib-7.2b.tar.gz

4. Preparations before installation

* Install the Apache server first.
* Install PHP4
* If you want to add SQL support for Webmail IMP, you must install PostgreSQL or other database servers.
* Install the IMAP/POP server
* PHPLIB 7.2 or later

5. Install PHPLib required by Webmail IMP

To run Webmail IMP on a Linux server, you must install PHPLib (a toolkit for PHP developers to develop Web applications ). Follow these steps to install PHPLib:

6. Software Packages

PHPLib home page: http://phplib.netuse.de/index.php3

Download: phplib-7.2b.tar.gz

[Root @ deep/] # cp phplib-7.2b.tar.gz/home/httpd/
[Root @ deep/] # cd/home/httpd/
[Root @ deep httpd] # tar xzpf phplib-7.2b.tar.gz

Step 1

Go to the DocumentRoot directory of the Web server and use the following command to create the "/home/httpd/php" directory:

[Root @ deep/] # cd/home/httpd/
[Root @ deep httpd] # mkdir php

Step 2

Decompress PHPLib and copy the file in PHPLib to the "php" directory:

[Root @ deep/] # cd/home/httpd/phplib-7.2b/php/
[Root @ deep php] # cp */home/httpd/php/
[Root @ deep php] # cd/home/httpd/
[Root @ deep httpd] # rm-f phplib-7.2b.tar.gz
[Root @ deep httpd] # rm-rf Co., phplib-7.2b/

Note: After copying all the files to the "php" directory, delete the tar compressed package and the "phplib-verison" directory.

7. Compile

Follow these steps to install Webmail IMP on the server.

Step 1

Copy javashorde-1.2.0-pre11.tar.gz to the DocumentRoot (/home/httpd) Directory of the Web server and run the following command:

[Root @ deep/] # cp horde-version.tar.gz/home/httpd/
[Root @ deep/] # cd/home/httpd/
[Root @ deep httpd] # tar xzpf horde-version.tar.gz
[Root @ deep httpd] # mv horde-version horde
[Root @ deep httpd] # rm-f horde-version.tar.gz

Note: After we change "horde-version" to "horde", we will delete the compressed horde file.

Step 2

Use the following command to copy imp-2.2.0-pre11.tar.gz to the new "horde" Directory (/homte/httpd/horde), decompress it, and rename "imp-version" to "imp ":

[Root @ deep/] # cp imp-version.tar.gz/home/httpd/horde/
[Root @ deep/] # cd/home/httpd/horde/
[Root @ deep horde] # tar xzpf imp-version.tar.gz
[Root @ deep horde] # mv imp-version imp
[Root @ deep horde] # rm-f imp-version.tar.gz

Note: The "imp" directory is under the "horde" directory, otherwise Webmail will not work. After renaming the "imp-version" directory to "imp", you can delete the compressed files of IMP.

Step 3

Change the owner of all files in the "horde" directory and Its subdirectories and directories to "root ".

[Root @ deep/] # chown-R 0.0/home/httpd/horde/

Step 4

Run the following command to copy the "/home/httpd/horde/phplib/*. ihtml" file to the new "php" (/home/httpd/php) directory:

[Root @ deep/] # cp/home/httpd/horde/phplib/*. ihtml/home/httpd/php/

8. Configure and create the SQL database of Webmail IMP

We must configure the database so that Webmail IMP can be used with the SQL database. You can use the scripts written in the "/home/httpd/horde/imp/config/scripts" directory. Taking PostgreSQL as an example, follow these steps:

Step 1

First, edit "pgsql_create. SQL" in the "/home/httpd/horde/imp/config/scripts" directory and change the default httpd user name to "www ".

Edit the "pgsql_create. SQL" file (vi/home/httpd/horde/imp/config/scripts/pgsql_create. SQL) and put the following line:

Grant select, INSERT, update on imp_pref, imp_addr TO nobody;

Changed:

Grant select, INSERT, update on imp_pref, imp_addr TO www;

Step 2

We must grant the Apache running user "www" the permission to create the Webmail IMP database in our PostgreSQL database.

Use the PostgreSQL "createuser" command to set the httpd user name to "www" in the database ":

[Root @ deep/] # su postgres
[S @ deep/] $ createuser

Enter name of user to add ---> www
Enter user's second s ID or RETURN to use unix user ID: 80-> [Press Enter]
Is user "www" allowed to create databases (y/n) y
Is user "www" a superuser? (Y/n) n
Createuser: www was successfully added

Step 3

Once the httpd user "www" is added to the PostgreSQL database, log on with the "postgres" user, run the script file "pgsql_create. SQL", and automatically add the Webmail IMP database to PostgreSQL.

Use the following command to create a Webmail IMP database in PostgreSQL:

[Root @ deep/] # cd/home/httpd/horde/imp/config/scripts/
[Root @ deep scripts] # su postgres
[S @ deep scripts] $ psql template1 <pgsql_create. SQL

// IMP database creation script for postgreSQL
// Author: barce@lines.edu
// Date: Aug-29-1998
// Notes: replace "nobody" with yours httpd username
// Run using: psql template1 <pgsql_create. SQL
Create database horde;
CREATEDB
Connect horde
Connecting to new database: horde
Create table imp_pref (
Username text,
Sig text,
Fullname text,
Replyto text,
Lang varchar (30)
);
CREATE
Create table imp_addr (
Username text,
Address text,
Nickname text,
Fullname text
);
CREATE
Grant select, INSERT, update on imp_pref, imp_addr TO www;
CHANGE
EOF

Step 4

Restart the PostgreSQL server to make the changes take effect.

Run the following command to restart PostgreSQL:

[Root @ deep/] #/etc/rc. d/init. d/postgresql restart
Stopping postgresql service: [OK]
Checking postgresql installation: looks good!
Starting postgresql service: postmaster [1, 13474]

Step 5

Copy "/home/httpd/horde/phplib/horde_phplib.inc" to "/home/httpd/php/local. inc ":

[Root @ deep/] # cp/home/httpd/horde/phplib/horde_phplib.inc/home/httpd/php/local. inc
Cp: overwrite'/home/httpd/php/local. inc '? Y

Edit the phplib configuration file "local. inc" to set the running status of phplib.

Edit the "local. inc" file (vi/home/httpd/php/local. inc), remove the comment, and modify the following lines to set the default database:

/* To use an SQL database, uncomment and edit the following :*/
Class HordeDB extends DB_ SQL {
Var $ Host = 'localhost ';
Var $ Database = 'horde ';
Var $ User = 'www ';
Var $ Password = 'some-password ';
Var $ Port = '000000 ';
Function halt ($ msg ){
Printf ("Database error (HordeDB): % s

", $ Msg );
}
}
Class HordeCT extends CT_ SQL {
Var $ database_class = 'hordedb'; // Which database class to use...
Var $ database_table = 'Active _ session'; // and find our data in this table.
}

Note: Do not forget to remove the notes for the memory type used by Webmail IMP, and you can only select one storage type. We select SQL as memory. You must also set the parameters "var $ User =", "var $ Password =", and "var $ Port =" for the SQL database ". "Var $ User =" corresponds to the httpd User Name ("www" in our example), and "var $ Password =" corresponds to the "www" User Password in PostgreSQL, "var $ Port =" is the IP Port connecting to the SQL database.

Step 6

Finally, edit the "/home/httpd/php/prepend. php3" file and set the default database type.

Edit the "prepend. php3" file (vi/home/httpd/php/prepend. php3) and change the following lines to set the database type to PostgreSQL:

Require ($ _ PHPLIB ["libdir"]. "db_mysql.inc ");

Changed:

Require ($ _ PHPLIB ["libdir"]. "db_pgsql.inc ");

9. Configure the PHP4 configuration file "php. ini"

Set the PHP4 configuration file "/etc/httpd/php. ini ". These settings are used to set which modules (for example, IMAP, PostgreSQL, or others) PHP4 automatically loads ). Because we use PostgreSQL as our database and use IMAP, we must set it in "php. ini.

Step 1

Edit the "php. ini" file (vi/etc/httpd/php. ini) and set it in the "Dynamic Extensions" section. We choose to support IMAP and PostgreSQL:

Extension = imap. so; Added for IMAP support
Extension = pgsql. so; Added for PostgreSql support
Extension = mysql. so; Added for MySql support
Extension = ldap. so; Added for LDAP support

Step 2

We also need to tell "php" where to find these files when there is no absolute path for the files contained, and automatically set the "prepend" of phplib. add the content of the php3 file to the front of each file and disable magic quotes.

Edit the "php. ini" file (vi/etc/httpd/php. ini) and add parameters in the following lines:

Magic_quotes_gpc = Off
Auto_prepend_file = "/home/httpd/php/prepend. php3"
Export de_path = "/home/httpd/horde:/home/httpd/php"

10. Configure Apache to recognize Webmail IMP

Once the Webmail IMP is installed in the system, the following lines must be added to the "httpd. conf" file.

Step 1

Edit the "httpd. conf" file (vi/etc/httpd/conf/httpd. conf) and add these lines to and:

Alias/horde/"/home/httpd/horde /"

Options None
AllowOverride None
Order allow, deny
Allow from all


Alias/imp/"/home/httpd/horde/imp /"

Options None
AllowOverride None
Order allow, deny
Allow from all


Step 2

Restart Apache Web server to make these changes take effect.

Run the following command to restart the instance:

[Root @ deep/] #/etc/rc. d/init. d/httpd restart
Shutting down http: [OK]
Starting httpd: [OK]

11. Configure Webmail IMP in a browser

Webmail IMP can be configured in many ways. We choose to use a new installation engine named "setup. php3. You can configure IMP in a browser.

Step 1

For security reasons, it is best to disable it, but you can use the following command to make it take effect.

Run the following command to make "setup. php3" take effect:

[Root @ deep/] # cd/home/httpd/horde/
[Root @ deep horde] # sh./install. sh
Your blank configuration files have been created, please go
The configuration utitlity:
Your install path url/setup. php3

Step 2

Once the new Webmail IMP installation engine takes effect, you can use this URL in your browser: http: // my-web-server/horde/setup. php3. Now, you can use the graphical installation interface to install and configure IMP.

Note: "my-web-server" is the address of your Apache server, and "setup. php3" is under the "/horde" directory.

Step 3

After using the Webmail IMP installation engine, you must disable it for security reasons.

Use the following command to disable "setup. php3 ":

[Root @ deep/] # cd/home/httpd/horde/
[Root @ deep horde] # sh./secure. sh

I have made your configuration files, and libraries mode 0555
Which is read/execute for everyone.
And the setup. php3 is mode 0000 which is no access period.

Step 4

Verify that the Webmail IMP is running properly. Allow the browser to access this address: http: // my-web-server/horde /. "My-web-server" is the address of your Apache server. "/Horde" is the directory of the Webmail IMP program.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.