How to Setup a Complete Mail Server (Postfix) using ‘SquirrelMail’ (Webmail) on Ubuntu/Debian

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

197 Responses

  1. James says:

    I have installed Squirrelmail as per your provided instructions. However, when I connect using Firefox I get a blank page.

    Using Chromium I get connection refused by the server.

  2. MZ says:

    Login page isn’t opening for me. I have followed all the instructions. I cant access the login page. PLEASE HELP

  3. Cooper says:

    Hello Sir,

    I have followed your instruction to create the web server. But I can’t log in with the user I created and even root. I am using a virtual host. how can I create email user on the virtual host?

  4. TechNafo says:

    Error opening ../data/default_pref
    Could not create initial preference file!
    /var/local/squirrelmail/data/ should be writable by user www-data.

    Please contact your system administrator and report this error.

    I get this error and /var/local/squirrelmail/data is not exist.

    • John says:

      What I did was that I copied “squirrelmail” folder that is in /var/www/html/squirrelmail copied to /var/local and did the permissions again, I dont know if I did it right or not but it seems to be working for me after doing that, correct if I am wrong @Ravi Saive

      • Ravi Saive says:


        As per the instructions provided here, the step 4 clearly shows that squirrelmail installed under /var/www/html/squirrelmail and the data directory would be /var/www/html/squirrelmail/data.

    • Ravi Saive says:


      Please follow the Step 4: Installing SquirrelMail in Ubuntu properly…

      • John says:

        But Step 4 does not talk about directory /var/local/ at all

        • Ravi Saive says:


          Then, where you have installed your Squirrelmail? as per step 4 it will install under /var/www/html and data directory would be /var/www/html/squirrelmail/data.

          • John says:

            I followed step 4 and I ended up with a folder “squirrelmail” in /var/www/html/ because I was having that error I mentioned before, all that I did was copy that folder “squirrelmail” to /var/local then I ran the commands again for permissions and that was it, it was fixed for me, I dont know if I was supposed to manually copy the folder to /var/local or not but I did.

  5. John says:

    I am following all the steps but I am getting this error message at the end after giving full permissions.

    Error opening ../data/default_pref
    Could not create initial preference file!
    /var/local/squirrelmail/data/ should be writable by user www-data
    Please contact your system administrator and report this error.

    I checked mail.err but nothing in there

    • Ravi Saive says:


      Make the following directory writable by user www-data.

      # chown -R www-data:www-data /var/local/squirrelmail/data/
      # chmod -R 776 /var/local/squirrelmail/data/
  6. tcullen says:

    It would appear that these directions are out of date or there is a repository that should be perhaps be mentioned where php5 can be obtained from.

    [email protected]:~$ sudo apt-get install apache2 php5
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package php5 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    E: Package 'php5' has no installation candidate
    • Ravi Saive says:


      I’ve updated the article and included latest instructions for setting up complete mail server using Postfix on Ubuntu.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.