Debian

How to Install SOGo Groupware on Debian 10

SOGo Groupware is a free and modern scalable collaboration software. It allows users to share calendars, emails, and address books with the community through a web interface. SOGo web interface supports various native clients such as Mozilla Thunderbird and Lightning using the same standard protocols such as Microsoft ActiveSync, CardDAV, and GroupDAV. It is mostly used in production environments where we are dealing with several users. In this post, we will describe how to install SOGO Groupware on the Debian system.

Note: We will be explaining the commands and procedure on Debian 10 (Buster) system. You should

Installing SOGo Groupware on Debian 10

Step 1: Install Apache

Firstly, update the system repository index as follows:

$ sudo apt update

Enter the sudo password.

Now install Apache using the below command in Terminal:

$ sudo apt install apache2

Step 2: Install and Configure MariaDB

We will need to install MariaDB as a database backend for SOGo. Execute the below command to install the MariaDB server on your system:

$ sudo apt install mariadb-server

Now you might be prompted with the Y/n choice to carry on the installation of MariaDB. Press Y to proceed.

Now execute the below command in Terminal to improve the security of your MariaDB installation:

$ sudo mysql_secure_installation

When asked to enter the current password for root, just press Enter. After that, you will be asked to set a new root password so that no one can login as a MariaDB root user without authentication. Press y if you want to set a new password for MariaDB root. Then enter the password twice.

Now press y for all subsequent questions also shown highlighted in the following screenshot.

Step 3: Install SOGo

Sogo can be installed easily via an apt command-line utility. However, we will first need to add its repository to our system’s local repositories. Follow the below steps to do so:

To install SOGo in your Debian system, first, add the SOGo repository to the sources.list file. In the Terminal, execute the below command to edit the sources.list file:

$ sudo nano /etc/apt/sources.list

Now to add the SOGo repository, add the below line at the end of the file:

deb http://packages.inverse.ca/SOGo/nightly/2/debian/ buster buster

Now save and close the sources.list file.
Add key for SOGo repository using the following command:

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

After adding a new repository, you will need to update the local repository index. Use the below command to do so:

$ sudo apt update

Once the update is completed, you can install SOGo as follows:

$ sudo apt install sogo

Now you might be prompted with Y/n (yes/no) option for proceeding with the installation. Press Y to proceed.

Once SOGo is installed, start its service using the below command:

$ sudo systemctl start sogo

To automatically start the SOGo service at boot, execute the below command in Terminal:

$ sudo systemctl enable sogo

Now start MySQL using the below command in Terminal:

$ sudo mysql

Now we will create a database and a user. Issue the following to create a database “sogo”:

$ CREATE DATABASE sogo;

Now create a user named “sogo” with the password “password”.

$ GRANT ALL ON sogo.* TO 'sogo'@'localhost' IDENTIFIED BY 'password';

First, connect to the database to run subsequent commands:

$ USE sogo;

Then create a database table to hold user information.

$ CREATE TABLE sogo_users (c_uid VARCHAR(10) PRIMARY KEY, c_name VARCHAR(10), c_password VARCHAR(32), c_cn VARCHAR(128), mail VARCHAR(128));

Now add an entry in the table for a user:

$ INSERT INTO sogo_users VALUES ('sim', 'sim', MD5('sim123'), 'Sim Sam', sim@ domain.com');
$ flush privileges;
$ exit;

Now we will have to enable some of the Apache modules. Execute the below command in Terminal to do so:

$ sudo a2enmod proxy proxy_http headers rewrite

After the modules are enabled, restart apache as follows:

$ sudo systemctl restart apache

Step 4: SOGo Configuration

Now we will configure SOGo to make it use the MySQL database that we have created in previous steps. We will do configurations under the user “sogo”. For this purpose, issue the following command to change the user:

$ su sogo

Then execute the below commands for SOGo configurations. Make sure to replace the Country/Region with your timezone, and domain.com with your actual domain. Also, replace password with the password you have set during database creation.

$ defaults write sogod SOGoTimeZone "Country/Region"
$ defaults write sogod SOGoMailDomain "domain.com"
$ defaults write sogod SOGoLanguage "English"
$ defaults write sogod SOGoUserSources '({canAuthenticate = YES; displayName = "SOGo Users"; id = users; isAddressBook = YES; type = sql; userPasswordAlgorithm = md5; viewURL ="mysql://sogo:<strong>password</strong>@127.0.0.1:3306/sogo/sogo_users";})'
$ defaults write sogod SOGoProfileURL 'mysql://sogo:[email protected]:3306/sogo/sogo_user_profile'
$ defaults write sogod OCSFolderInfoURL 'mysql://sogo: password @127.0.0.1:3306/sogo/sogo_folder_info'
$ defaults write sogod OCSSessionsFolderURL 'mysql://sogo: password @127.0.0.1:3306/sogo/sogo_sessions_folder'
$ defaults write sogod SOGoLoginModule Calendar
$ defaults write sogod SOGoSieveScriptsEnabled YES
$ defaults write sogod SOGoAppointmentSendEMailNotifications YES
# The default port for SOGoSieveServer was 2000 but now it is 4190
$ defaults write sogod SOGoSieveServer sieve://localhost:4190
$ defaults write sogod SOGoVacationEnabled YES
$ defaults write sogod SOGoMailMessageCheck every_5_minutes
$ defaults write sogod SOGoFirstDayOfWeek 1
# following is the configuration for mailbox
$ defaults write sogod SOGoSentFolderName "INBOX.Sent"
$ defaults write sogod SOGoTrashFolderName "INBOX.Trash"
$ defaults write sogod SOGoDraftsFolderName "INBOX.Drafts"
$ defaults write sogod NGImap4ConnectionStringSeparator "."
$ exit

Now restart SOGo service using the below command:

$ sudo systemctl restart sogo

Now modify the SOGo configuration file for apache to use localhost with no SSL. You can find the SOGo configuration file for Apache at /etc/apache2/conf.d/SOGo.conf.

Edit the file using the below command:

$ sudo nano /etc/apache2/conf.d/SOGo.conf

Now find the following lines and replace 443 with 80 and yourhostname with localhost.

RequestHeader set "x-webobjects-server-port" "<strong>443</strong>"
RequestHeader set "x-webobjects-server-name" "<strong>yourhostname</strong>"
RequestHeader set "x-webobjects-server-url" https://yourhostname

It should now look like this:

RequestHeader set "x-webobjects-server-port" "80"
RequestHeader set "x-webobjects-server-name" "localhost"
RequestHeader set "x-webobjects-server-url" "http://localhost"

Then to check for any configuration errors, execute the below command in Terminal:

$ sudo apachectl configtest

If you receive the following output, it means configurations are fine.

Syntax OK

Now restart the Apache server as follows to apply the configuration changes:

$ sudo systemctl restart apache2

Now access the following address in any web browser from the same system on which SOGO is installed:

http://localhost/SOGo

You should now see the SOGo login page where you can log in using your admin username and password, which are ‘sim’ and ‘sim123’.

Uninstalling SOGo

In case you no longer need SOGo Groupwarw, you can easily remove it from your system. Execute the below command in Terminal to uninstall SOGo from your Debian system:

$ sudo apt remove sogo

When you install SOGo, some dependencies are also installed with it. To remove those dependencies too, execute the below command in Terminal:

$ sudo apt remove --auto-remove

Alternatively, if you want to uninstall SOGo along with all configuration files, execute the below command in Terminal:

$ sudo apt purge sogo

Then to remove the dependencies too, execute the below command in Terminal:

$ sudo apt purge --auto-remove

That is all there is to it! In this post, you have learned how to install and configure SOGo groupware on Debian OS. For advanced configurations, visit SOGo official documentation.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.