How to install SOGo on Ubuntu 14.04 VPS

Install SOGo on Ubuntu 14.04 VPS
In the following article we’ll explain how to install SOGo on Ubuntu 14.04 VPS. SOGo is a fully supported and trusted groupware server with a focus on scalability and open standards. SOGo is released under the GNU GPL/LGPL v2 and above. SOGo provides a rich AJAX-based Web interface and supports multiple native clients through the use of standard protocols such as CalDAV, CardDAV and GroupDAV, as well as Microsoft ActiveSync.

Sogo Diagram

SOGo is the missing component of your infrastructure; it sits in the middle of your servers to offer your users a uniform and complete interface to access their information. It has been deployed in production environments where thousands of users are involved.


REQUIREMENTS

We assume you already have the following services installed and running on your virtual server. If you’re using one of our Managed VPS Hosting services, please submit a support ticket about this and we’ll install and setup everything for you.

  • Active Directory/Domain Controller Server (e.g. Samba)
  • Messaging Application Programming Interface (MAPI) (e.g. OpenChange)
  • Database server (e.g. PostgreSQL or MySQL);
  • LDAP server (e.g. OpenLDAP);
  • SMTP server (e.g. Postfix);
  • IMAP server (e.g. Cyrus or Dovecot)

0. SSH TO YOUR UBUNTU VPS

First thing to do is to login to your virtual server via SSH and optionally fire up a screen/tmux session. For example:

ssh YOUR_VPS_IP -p YOUR_VPS_SSH_PORT
screen -U -S sogo-screen

1. UPDATE YOUR UBUNTU VPS

Next, it’s recommended to fully update your virtual server using the distribution package manager apt:

apt-get autoclean
apt-get update
apt-get upgrade

2. ADD SOGO REPOSITORY

Create a new file in /etc/apt/sources.list.d/sogo.list and add the following line in it:

deb http://inverse.ca/ubuntu-v3 trusty trusty

or use the following command to achieve the same thing:

echo 'deb http://inverse.ca/ubuntu trusty trusty' >> /etc/apt/sources.list.d/sogo.list

3. IMPORT SOGO GPG PUBLIC KEY

SOGo builds are signed. In order to verify their signature, their GPG public key has to be added into apt keyring. To do so, run the following command:

apt-key adv --keyserver keys.gnupg.net --recv-key 0x810273C4

once the key is added, refresh your sources using the following apt command:

apt-get update

4. INSTALL SOGO

SOGo can be easily installed using your virtual server package manager. For example:

apt-get install sogo

5. INSTALL DATABASE SERVER

SOGo requires a database server. You can either use MySQL/MariaDB or PostgreSQL. In this case we’re going to use the MySQL server, so install it via:

apt-get install mysql-server

Now run the following command to post-configure the MySQL database server in your Ubuntu VPS:

mysql_secure_installation

It is recommended to accept the default action for all questions which is yes. For example:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next, create the SOGo database in MySQL:

mysql -u root -p

mysql> CREATE DATABASE `sogodb` CHARACTER SET='utf8';
mysql> CREATE USER 'sogo'@'localhost' IDENTIFIED BY 'RANDOM_PASSWORD';
mysql> GRANT ALL PRIVILEGES ON `sogodb`.* TO 'sogo'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

6. CONFIGURE SOGO

Switch to the sogo user and execute the following commands to setup its configuration. Feel free to tune any parameter to suit your needs:

su - sogo -s /bin/bash
defaults write sogod SOGoTimeZone "Europe/Amsterdam"
defaults write sogod OCSFolderInfoURL "mysql://sogo:[email protected]:3306/sogodb/sogo_folder_info"
defaults write sogod SOGoProfileURL "mysql://sogo:[email protected]:3306/sogodb/sogo_user_profile"
defaults write sogod OCSSessionsFolderURL "mysql://sogo:[email protected]:3306/sogodb/sogo_sessions_folder"
defaults write sogod OCSEMailAlarmsFolderURL "mysql://sogo:[email protected]:3306/sogodb/sogo_alarm_folder"

defaults write sogod SOGoUserSources '({CNFieldName = givenName;  IDFieldName = uid; UIDFieldName = uid; IMAPHostFieldName =; baseDN = "ou=people,dc=mydomain,dc=net"; bindDN = "uid=ldapsearch,ou=services,dc=mydomain,dc=net"; bindPassword = MY_PASSWORD; canAuthenticate = YES; displayName = "Shared Addresses"; hostname = "ldap.mydomain.com"; id = public; isAddressBook = YES; port = 389;})'

defaults write sogod SOGoLoginModule "Calendar"

defaults write sogod WONoDetach YES
defaults write sogod WOLogFile -
defaults write sogod WOPidFile /tmp/sogo.pid
defaults write sogod SOGoDraftsFolderName "Drafts"
defaults write sogod SOGoSentFolderName "Sent"
defaults write sogod SOGoTrashFolderName "Trash"
defaults write sogod SOGoIMAPServer "localhost:143"
defaults write sogod SOGoSieveServer "sieve://127.0.0.1:4190"
defaults write sogod SOGoSieveScriptsEnabled "YES"

If you also like SOGo users to be able to add their own/external IMAP accounts run the following:

defaults write sogod SOGoMailAuxiliaryUserAccountsEnabled YES

Logout the SOGO user by running:

exit

7. START SOGO SERVICE

Before starting the SOGO service, let’s patch its init script by running the following sed command:

sed -i 's/start-stop-daemon -c/start-stop-daemon -b -c/g' /etc/init.d/sogo

now restart the SOGo service using:

service sogo restart

8. CYRUS IMAP SERVER INSTALLATION

You can install the Cyrus IMAP server using the following command:

apt-get -y install cyrus-admin-2.4 cyrus-imapd-2.4 sasl2-bin

SASLAUTH CONFIGURATION

Cyrus needs to use Saslauth system in order to authenticate the users. So, let’s configure it:

vim /etc/default/saslauthd

and change the following:

START=yes
MECHANISMS="ldap"

create /etc/saslauthd.conf with the command below:

vim /etc/saslauthd.conf

do not forge to tune the options according to your setup:

ldap_servers: ldap://ldap.mydomain.com
ldap_search_base: ou=people,dc=mydomain,dc=net
ldap_filter: (uid=%u)
ldap_version: 3
ldap_auth_method: bind
ldap_bind_dn: uid=ldapsearch,ou=services,dc=mydomain,dc=net
ldap_bind_pw: MY_PASSWORD
ldap_scope: sub

Restart the service:

service saslauthd restart

Test the authentication using:

testsaslauthd -u stambol -p qwerty

 

Cyrus Configuration

Edit cyrus main configuration file and add the following in the SERVICES section:

vim /etc/cyrus.conf

imapnoauth      cmd="imapd -U 30 -N" listen="127.0.0.1:144" prefork=0 maxchild=100

9. INSTALL NGINX HTTP SERVER

Next, install the NGINX HTTP server on your Ubuntu 14.04 VPS using the following command:

apt-get install nginx

create the following virtual host directive / server block:

vim /etc/nginx/sites-available/sogo.conf
server {
    listen 80;

    server_name sogo.lan;

    location ~ ^/sogo { rewrite ^ http://$host/SOGo; }
    location ~ ^/SOGO { rewrite ^ http://$host/SOGo; }

    # For IOS 7
    location = /principals/ {
        rewrite ^ http://$server_name/SOGo/dav;
        allow all;
    }

    location ^~ /SOGo {
        proxy_pass http://127.0.0.1:20000;
        #proxy_redirect http://127.0.0.1:20000/SOGo/ /SOGo;
        # forward user's IP address
        #proxy_set_header X-Real-IP $remote_addr;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header Host $host;
        proxy_set_header x-webobjects-server-protocol HTTP/1.0;
        #proxy_set_header x-webobjects-remote-host 127.0.0.1;
        #proxy_set_header x-webobjects-server-name $server_name;
        #proxy_set_header x-webobjects-server-url $scheme://$host;
    }

    location ^~ /Microsoft-Server-ActiveSync {
        proxy_pass http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync;
        proxy_redirect http://127.0.0.1:20000/Microsoft-Server-ActiveSync /;
    }

    location ^~ /SOGo/Microsoft-Server-ActiveSync {
        proxy_pass http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync;
        proxy_redirect http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync /;
    }

    location /SOGo.woa/WebServerResources/ {
        alias /usr/lib/GNUstep/SOGo/WebServerResources/;
    }
    location /SOGo/WebServerResources/ {
        alias /usr/lib/GNUstep/SOGo/WebServerResources/;
    }
    location ^/SOGo/so/ControlPanel/Products/([^/]*)/Resources/(.*)$ {
        alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
    }
}

enable the newly created server block using:

ln -s /etc/nginx/sites-available/sogo.conf /etc/nginx/sites-enabled
nginx -t
service nginx restart

If you’re one of our Linux VPS Hosting customers we can help you install SOGo on your virtual server for you free of charge. Just contact us and some of our experts will complete your request immediately.

2 thoughts on “How to install SOGo on Ubuntu 14.04 VPS

  1. The function of the site depends, to some degree, on the amount off time the journalist is
    willing to devote to it. Unlike a dedicated server that is expensive, a VPS or VDS allows customeers to control and manage a server.
    Choose ylur compression type (None, Zipped, GZipped) and then click Go to begin the export.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>