In this tutorial, we will show you how to install SOGo on an Ubuntu 20.04 based virtual private server.
Prerequisites
- An Ubuntu 20.04 VPS (we’ll be using our SSD 2 VPS plan)
- Access to the root user account (or access to an admin account with root privileges)
Step 1: Log in to the Server & Update the Server OS Packages
First, log in to your Ubuntu 20.04 server via SSH as the root user:
ssh root@IP_Address -p Port_number
You will need to replace ‘IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.
Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:
apt-get update -y apt-get upgrade -y
Step 2: Install and Configure MariaDB Server
SOGo uses MariaDB, MySQL, or PostgreSQL as a database backend. So you will need to install the database server in your server.
You can install the MariaDB server by running the following command:
apt-get install mariadb-server -y
Once installed, log in to the MariaDB shell with the following command:
mysql
After login, create a database and use it for SOGo with the following command:
MariaDB [(none)]> CREATE DATABASE sogo; MariaDB [(none)]> GRANT ALL ON sogo.* TO 'sogo'@'localhost' IDENTIFIED BY 'your-secure-password';
Next, change the database to SOGo and create a required table and insert some values with the following command:
MariaDB [(none)]> USE sogo; MariaDB [sogo]> 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)); MariaDB [sogo]> INSERT INTO sogo_users VALUES ('admin1', 'admin1', MD5('your-secure-password'), 'SOGouser', 'sogo@example.com');
Next, flush the privileges and exit from the MariaDB with the following command:
MariaDB [sogo]> flush privileges; MariaDB [sogo]> exit;
Now, the MariaDB database server is installed and configured.
Step 3: Install SOGo
By default, SOGo is not available in the Ubuntu 20.04 standard repository. So you will need to download their packages from the SOGo official website. All packages are available at Sope and Sogo
You can download all the packages using the following command:
wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sogo/sogo-activesync_5.0.1.20201101-1_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sogo/sogo-dbg_5.0.1.20201101-1_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sogo/sogo-dev_5.0.1.20201101-1_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sogo/sogo_5.0.1.20201101-1_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsbjson2.3-dev_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsbjson2.3_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-appserver4.9-dev_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-appserver4.9_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-core4.9-dev_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-core4.9_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-gdl1-4.9-dev_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-gdl1-4.9_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-ldap4.9-dev_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-ldap4.9_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-mime4.9_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-xml4.9-dev_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope-xml4.9_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/libsope4.9-dev_4.9.r1664.20201016_all.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/sope4.9-appserver_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/sope4.9-dbg_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/sope4.9-gdl1-mysql_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/sope4.9-gdl1-postgresql_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/sope4.9-libxmlsaxdriver_4.9.r1664.20201016_amd64.deb wget https://packages.inverse.ca/SOGo/nightly/5/ubuntu/pool/focal/s/sope/sope4.9-stxsaxdriver_4.9.r1664.20201016_amd64.deb
Once all the packages are downloaded, run the following command to install them:
dpkg -i *.deb
Next, run the following command to install all missing dependencies:
apt-get install -f
Once SOGo is installed, start the SOGo service and enable it to start at system reboot:
systemctl start sogo systemctl enable sogo
Step 4: Install and Configure Apache
Next, you will need to install the Apache webserver for SOGo. You can install it with the following command:
apt-get install apache2 -y
Next, enable all required modules with the following command:
a2enmod proxy proxy_http headers rewrite a2enconf SOGo.conf
Next, edit the SOGo virtual host configuration file:
nano /etc/apache2/conf-enabled/SOGo.conf
Find the following lines:
RequestHeader set "x-webobjects-server-port" "443" RequestHeader set "x-webobjects-server-url" "https://%{HTTP_HOST}e" env=HTTP_HOST
And, replaced them with the following:
RequestHeader set "x-webobjects-server-port" "80" RequestHeader set "x-webobjects-server-url" "http://%{HTTP_HOST}e" env=HTTP_HOST
Save and close the file then restart the Apache service to apply the changes:
systemctl restart apache2
Step 5: Configure SOGo
Next, you will need to configure SOGo to use MariaDB for authentication. You can do it by editing the SOGo main configuration file:
nano /etc/sogo/sogo.conf
Add the following lines at the end of the file as per your database settings:
SOGoProfileURL = "mysql://sogo:your-secure-password@localhost:3306/sogo/sogo_user_profile"; OCSFolderInfoURL = "mysql://sogo:your-secure-password@localhost:3306/sogo/sogo_folder_info"; OCSSessionsFolderURL = "mysql://sogo:your-secure-password@localhost:3306/sogo/sogo_sessions_folder"; SOGoPasswordChangeEnabled = YES; SOGoUserSources = ( { type = sql; id = users; viewURL = "mysql://sogo:your-secure-password@127.0.0.1:3306/sogo/sogo_users"; canAuthenticate = YES; isAddressBook = NO; userPasswordAlgorithm = md5; } ); SOGoPageTitle = SOGo; SOGoVacationEnabled = YES; SOGoForwardEnabled = YES; SOGoSieveScriptsEnabled = YES; SOGoMailAuxiliaryUserAccountsEnabled = YES; SOGoTrustProxyAuthentication = NO; SOGoXSRFValidationEnabled = YES; SOGoSuperUsernames = (admin1, admin2); // This is an array - keep the parents!
Save and close the file when you are finished then restart the SOGo service to apply the changes:
systemctl restart sogo
Step 6: Access SOGo Web UI
Now, open your web browser and type the URL http://your-domain.com/SOGo
to access the SOGo web interface. You will be redirected to the SOGo login page as shown below:
Provide username as admin1 and password as “your-secure-password” then click on the > button. You will be redirected to the SOGo dashboard:
That’s it. You have successfully installed SOGo on your Ubuntu 20.04 based VPS.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.