I decided to build a website for my domain and Bruce’s domain, and install a mail server for Bruce’s.  I wanted to make a combo website server and email server using CentOS, but my only spare computer is an old laptop that was a prize for Great Computer Deals who the wi-fi doesn’t work with CentOS, so I used Linux Mint because the wi-fi works with that.  Linux Mint is also my primary computer.  Even though the ethernet on it works with CentOS but because the room it is in doesn’t have any cables I decided not to use it. Also I assigned the Linux Mint laptop on the wi-fi guest network that does not touch my normal wifi and cables.  I like that.

I built a simple wordpress site for my domain, a single picture and easy-to-install iRedMail for the complete mail server for Bruce’s domain.  Since iRedMail uses Roundcube as the webmail, after several attempts to build basic Roundcube myself, I finally did it.  Here are the steps.

After installing Linux Mint, install LAMP (Linux, Apache, MySQL, PHP) with Postfix mail server and Dovecot IMAP and POP3 email server, create a database in MySQL for roundcube and then download and run the installer for roundcube.

There are two methods to install LAMP, Postfix and Dovecot.  The first method is by installing Webmin, a web-based interface for administrator Unix/Linux, or the second method by manually installing with the command line.  I usually prefer installing them with Webmin but I do them manual for this blog.

mail server name: mailserver
mail domain name: brgrafix.com

Install Apache:

sudo apt-get install apache2

Install MySQL:

sudo apt-get install mysql-server mysql-client

While installing MySQL it will ask for a password. After installing MySQL make it more secure by:

sudo mysql_secure_installation

Put the password for MySQL then enter.

Say N for the next prompt and choose Yes for the rest of the prompts until you’re done.

Enter current password for root (enter for none): Type root password
Change the root password? N
Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y.

Install PHP5 and other modules:

sudo apt-get install php5 php5-mysql php-pear php5-mcrypt php5-intl

Install Postfix

sudo apt-get install postfix

While installing postfix, it first give your options first and then it will ask for the mail domain:

Postfix Options
Postfix Options

Tab to Ok and click on it.   Then select Internet Site.  Then will ask you the mail ‘domain’ site.  I typed in brgrafix.com.

 

domain name
domain name

 

Install Dovecot:

sudo apt-get install dovecot-imapd dovecot-pop3d

While installing it will ask to create an SSL certificate.  Enter on the default “Yes”.

SSL?
SSL?

Then it will ask you the host name for the SSL certicate.   Take the default of “localhost”.

 

Configured MySQL for roundcube:

With MySQL you can set up the database by issuing the following commands:

sudo mysql -u root -p
CREATE DATABASE roundcubemail;
GRANT ALL PRIVILEGES ON roundcubemail.* TO username@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit

I used rcmadmin for the username and usmc1234 for the password.

Configuring roundcube:

For some unknown reason you have make a /var/mail RWX for all.  I googled alot and it seems to have do that to get roundcube to see the mail.   I dunno…

sudo chmod -R 777 /var/mail

Next make a directory for roundcube on the webserver. I used webmail.

sudo mkdir /var/www/html/webmail

Next download the complete roundcube from the roundcube.net and extract it.   I extracted it to my Downloads folder and copied all the data to the webmail.

cd Downloads
sudo cp -r roundcubemail-1.1.4/* /var/www/html/webmail

Then change to webmail owner and group from root to www-data, and then change the permissions:

sudo chown -hR www-data:www-data /var/www/
sudo chmod -R 755 /var/www

Installing roundcube:

Go to http://locahost/webmail/installer and make sure you have no red NOT OK.  If you do you will need to install something or enable something.

Check Environment
Check Environment

Go to the bottom of the page and click Next.

Put in your roundcubemail username and password for MySQL and other options, and then click on CREATE CONFIG.

Create Config
Create Config

 

If the username and password is right for MySQL, it should say at the top “The config file was saved successfully into RCMAIL_CONFIG_DIR directory of your Roundcube installation.”

Note:  If you want the default folders to show in roundcube webmail (sent, trash, inbox, etc.) place the following at the end of webmail/config/config.inc.php at the webserver:

// automatically create the default folders on login
$rcmail_config['create_default_folders'] = TRUE;

 

Then click on Next at the top to go Test Config.  Near the top you should see

“Check DB Config
DSN (write): OK
DB Schema: NOT OK (Database not initialized)

Initial Database ”

Click on Initialize database and roundcube should be ready to test.

Test Config
Test Config

I created a username of test for the Linux Mint mailserver and typed in ‘Test SMTP Config’ username as ‘test@brgrafix.com’ and my email address.  I received an email for test@brgrafix.com.

For the ‘Test IMAP config’ I used ‘test’ as username and it’s password.  I got an OK.

If both works, it’s ready!  Go to you http:{your ip number}/webmail.  I would use this an only internal webmail because the it’s not setup for HTTPS. Also make sure you delete the installer folder from the webserver.

But if one or both fails check the roundcube.net website and/or google/bing it for possible answers.

Note:

Since this is non-virtual roundcube it uses the actual logins for the server and not username@yourdomain, and it will also use username@localhost in roundcube.  But there are easy way to change to username@yourdomain in roundcube by click on the Setting at the top right when you’re logged in and click on Identities, and changing it to username@yourdomain.  As far as know there is no way to change them all in one setting.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s