Adding Horde Webmail to Toaster
The Horde Project is a PHP framework for webmail and related applications. Go to The Horde Project for more details.
The instructions below for Centos 5.x come from a meld of a post from Anil Aliyan on the Qmail-Toaster list and The Horde Wiki.
Step 1. Install some additional applications and their dependencies to your server. Note, as far as I know all of these applications are needed.
yum install GeoIP geoip-devel gd ImageMagick ImageMagick-devel ImageMagick-perl php-mbstring php-gettext php-gd php-xml php-mcrypt php-pecl-Fileinfo php-devel php-imap
If any of the above mentioned applications cannot be found, you may want to install rpmforge.
Step 2. Install applications into the PHP extensions library. This step has 2 parts.
Run the following command and respond to requests with their defaults (note at the time of this writing, I had issues with the ImageMagick application. I found a solution on the pecl.php.net web site.
pecl install Imagick json LZF geoip
After you have successfully ran the command and answered the defaults, pecl will tell you to add some extensions to your php.ini file. Add those lines in your php.ini file under the section "Dynamic Extensions". The four lines are as follows.
extension=imagick.so extension=geoip.so extension=lzf.so extension=json.so
You will also will want to change the memory limit line in the php.ini file to read 128M. I believe by default it is set to 32M.
Step 3. Modify your Apache webserver configuration. In my case, I am installing Horde in the subfolder horde. I create the file /etc/httpd/conf.d/horde.conf with the following content which is from the horde wiki site mentioned at the top.
# # Horde # Alias /horde /var/www/html/horde <Directory /var/www/html/horde> # Uncomment the following 3 lines to make Horde locally accessible only #Order Deny,Allow #Deny from all #Allow from 127.0.0.1 Options +FollowSymLinks # horde.org's recommended PHP settings: php_admin_flag safe_mode off php_admin_flag magic_quotes_runtime off php_flag session.use_trans_sid off php_flag session.auto_start off php_admin_flag file_uploads on # Optional - required for weather block in Horde to function php_admin_flag allow_url_fopen on # If horde dies while trying to handle large email file attachments, # you are probably hitting PHP's memory limit. Raise that limit here, # but use caution # Set to your preference - memory_limit should be at least 32M # and be greater than the value set for post_max_size #php_value memory_limit 32M #php_value post_max_size 20M #php_value upload_max_filesize 10M # /usr/share/pear is needed for PEAR. /var/www/html/horde is needed for Horde itself # TODO: Set an appropriate include_path, too. Might even increase speed a bit. php_admin_value open_basedir "/var/www/html/horde:/var/www/html/horde/config:/usr/share/pear:/tmp" php_admin_flag register_globals off </Directory> <Directory /var/www/html/horde/config> Order Deny,Allow Deny from all </Directory> # Deny access to files that are not served directly by the webserver <DirectoryMatch "^/var/www/html/horde/(.*/)?(config|lib|locale|po|scripts|templates)/(.*)?"> Order Deny,Allow Deny from all </DirectoryMatch> # Deny access to the test.php files except from localhost #<LocationMatch "^/horde/(.*/)?test.php"> # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 #</LocationMatch>
The last section of the file is marked out with pound signs because we want to still test to make sure all of the php modules are installed. You will want to make sure the permission on this file is 0644.
Go ahead now and restart your web server.
service httpd restart
You are now ready to install Horde.
Step 1. Download and expand the tarball. Note that I choose the folder name horde and the version at the time of this writing is 1.2.6 so my instructions will reflect that.
cd /var/www/html wget ftp://ftp.horde.org/pub/horde-webmail/horde-webmail-latest.tar.gz tar -xzvf horde-webmail-latest.tar.gz mv horde-webmail-1.2.6 horde
Step 2. At this point, we can do some testing if you left out the section regarding the test.php from your apache configuration file. Open your web browser to your mail server and the test.php file (ie http://your-mail-server-name/horde/test.php). You should find that the php modules are all available but postgres and another optional module. If not, you will need to do some research and fix the issues.
Step 3. Change the password that horde will use to access your mysql backend. Edit the file '/var/www/html/horde/scripts/sql/create.mysql.sql' and change the password. At the top of the file it clearly states the default password and suggests that you change it. You can change the database name, username and password if you wish; I suggest only changing the password for simplicity.
Step 4. Run the setup script. It is a text based menu that is pretty easy to follow.
cd /var/www/html/horde php scripts/setup.php
a. Choose "Configure database settings", so press 1 and enter.
b. We want to use mysql, so type mysql and enter.
c. We want persistent connections, so type 1 and enter.
d. In our example the username from step 3 is horde, so type horde as the username and enter.
e. Type the password that you selected in step 3 for the password and enter.
f. We are going to use UNIX sockets to connect, so type unix and enter.
g. The default for Centos 5 for the socket is /var/lib/mysql/mysql.sock, so type it and enter.
h. In our example the db name from step 3 is horde, so type horde as the db name and enter.
i. Press enter to accept the default charset.
j. We want to use SSL to connect, so press 1 and enter.
k. Leave the Certification Authority blank and enter.
l. We are using one server, so type false and enter.
m. Now we need to create the database, so choose "Create database or tables" by pressing 2 and enter.
n. Have the application create the database, press y and enter. All of the responses should be "OK".
o. I did not do anything nor do I know about METAR weather stations, so press n and enter.
p. Press 0 to exit the text based installer.
Step 5. The installation is complete, we now need to add the user and password from Step 3 to the mysql server. This can be done many ways, below is how I do it (The password is deliminated by <> in this example. Make sure to remove the <> and use the password you decided on in Step 3. Remember that I used the default username and db name both horde)
mysql -u root -p <root mysql password> mysql> grant all on horde.* to horde@localhost; mysql> set password for horde@localhost = password('<password>'); mysql> exit;
Step 6. You should now be able to use horde by going to your mail server and the horde directory (ie http://your-mail-server-name/horde). We want to secure the installation now so that no one can ruin your installation. This is a two part process.
First uncomment out the lines at the bottom of the file /etc/httpd/conf.d/horde.conf for the test.php file and restart your web server.
service httpd restart
Second secure the files (This is taken from the horde wiki site link at the top).
chown apache:root -R /var/www/html/horde/config chown apache:root -R /var/www/html/horde/*/config chmod -R go-rwx /var/www/html/horde/config chmod -R go-rwx /var/www/html/horde/*/config chown -R root:root /var/www/html/horde/scripts chown -R root:root /var/www/html/horde/*/scripts chmod -R go-rwx /var/www/html/horde/scripts chmod -R go-rwx /var/www/html/horde/*/scripts chmod a-rwx /var/www/html/horde/test.php chmod a-rwx /var/www/html/horde/*/test.php
Everything should be configured, secure and working on your server. The username, as it is with squirrelmail is the users full email address.