Raspberry Pi SOGo Groupware
Start
SOGo is a groupware server that allows you to share agenda and contacts with others within your own private network. There is also the popular NextCloud (https://nextcloud.com) which would have been my second option. However, SOGo proved to be relatively easy to setup, I like it and am using it for some time now.
SOGo nightly builds are freely available for the public but there are no binaries or configurations available for the ARM architecture as are needed for the Raspberry Pi. Therefore we need to compile, build and install the application manually and then solve some problems.
Source with some pointers:
Assumptions:
- Apache2 (2.4+) is installed
- MariaDB (MySQL) is installed
- There is no information here concerning the creation of the sogo database tables
Compile, build and install
Download source-code
Get and extract source-code of SOPE and SOGo (the version used here is 3.2.10):
cd ~ wget https://sogo.nu/files/downloads/SOGo/Sources/SOPE-3.2.10.tar.gz tar -xvzf SOPE-3.2.10.tar.gz wget https://sogo.nu/files/downloads/SOGo/Sources/SOGo-3.2.10.tar.gz tar -xvzf SOGo-3.2.10.tar.gz mv SOGo-3.2.10 SOGo
Install needed packages for SOPE
# the GNU Objective-C compiler (gcc-objc) sudo apt-get install gnustep-make #20Mb sudo apt-get install gnustep-core-devel #34Mb # the libxml2 development headers (74Mb) sudo apt-get install libxml2-dev sudo apt-get install libwbxml2-dev # the OpenLDAP development headers (2mb) sudo apt-get install libldap2-dev # the OpenSSL development headers (10Mb) sudo apt-get install libssl-dev # the PostgreSQL development headers (1Mb) sudo apt-get install libpq-dev # the MySql (MariaDB) development headers (6Mb) # sudo apt-cache search mysql | grep "dev" sudo apt-get install libmariadbclient-dev-compat
Compile and install SOPE
Compiling (make) will take considerable time and may show some warnings which we can hopefully ignore.
cd ~/SOPE ./configure --with-gnustep --enable-debug --disable-strip --prefix=/usr/System sudo make uninstall make clean make sudo make install
Install additional needed packages for SOGo
# the libmemcached development headers (2Mb) sudo apt-get install libmemcached-dev # the libcurl development headers (1Mb) sudo apt-get install libcurl4-openssl-dev
Compile and install SOGo
cd ~/SOGo ./configure --enable-debug --disable-strip --prefix=/usr/System sudo make uninstall make clean make sudo make install
Post installation
The install script silently fails to execute some tasks, probably because there are no specific instructions for the Raspbian OS and ARM architecture. The following statements are based on the install scripts and documentation:
Create user and group 'sogo'
#Create group sudo addgroup sogo #Add new user 'sogo' to group 'sogo' (error if user sogo exists) sudo useradd -g sogo sogo #Add existing user 'sogo' to group 'sogo' sudo adduser sogo sogo
Copy some files to the right places
cd ~/SOGo sudo install -D -m 644 Scripts/sogo-default /etc/default/sogo sudo install -D -m 644 packaging/debian/sogo.overrides /usr/share/lintian/overrides/sogo sudo install -D -m 644 Apache/SOGo.conf /etc/apache2/conf-available/SOGo.conf sudo install -D -m 644 Scripts/sogo.cron /etc/cron.d/sogo sudo install -D -m 644 Scripts/logrotate /etc/logrotate.d/sogo sudo install -d -m 750 /etc/sogo/ sudo install -D -m 640 Scripts/sogo.conf /etc/sogo/sogo.conf
Apply owner and group information
sudo mkdir /var/log/sogo sudo mkdir /var/run/sogo sudo chown -R sogo:sogo /var/run/sogo sudo chown -R sogo:sogo /var/log/sogo sudo chown -R sogo:sogo /usr/lib/GNUstep/SOGo sudo chown -R sogo:sogo /etc/sogo
Install Service
For installation of the service we use the file './SOGo/Scripts/sogo-systemd-redhat':
cd ~/SOGo sudo install -D -m 644 Scripts/sogo-systemd-redhat /lib/systemd/system/sogo.service sudo systemctl daemon-reload sudo systemctl enable sogo
Other configuration
See:
- For website configuration file: Apache2 configuration for SOGo and MediaWiki
- For database and sogo.conf settings: SOGo
And maybe also:
Start the Service
sudo service sogo restart
Troubleshooting
Missing /var/run/sogo/sogo.pid
Error: sogo.service: PID file /var/run/sogo/sogo.pid not readable (yet?) after start: No such file or directory
In my case the directory /var/run/sogo is an in-memory folder (tmpfs), it is gone after reboot resulting in the above error. This might be fixed in later editions, for now we will edit systemd sogo.service file to create the directory at startup of the sogo service.
In this script 'mkdir' is allowed to fail (directory exists), by prefixing it with '-'. The option 'PermissionsStartOnly=true' is added to execute the 'ExecStartPre' commands as root. The 'ExecStart' command will still be executed as the configured user ('sogo').
Note: we also lowered PREFORK from 3 to 2 here.
More info:
sudo nano /lib/systemd/system/sogo.service
[Unit]
Description=SOGo groupware server
After=network.target
After=mariadb.service
[Service]
Type=forking
User=sogo
Environment="PREFORK=2"
EnvironmentFile=-/etc/sysconfig/sogo
#Create /var/run/sogo, as root and ignore mkdir error
PermissionsStartOnly=true
# exec with prefix - to ignore errors
ExecStartPre=-/bin/mkdir /var/run/sogo
ExecStartPre=/bin/chown -R sogo:sogo /var/run/sogo
# Start sogo
ExecStart=/usr/sbin/sogod -WOWorkersCount ${PREFORK} -WOPidFile /var/run/sogo/sogo.pid -WOLogFile /var/log/so$
PIDFile=/var/run/sogo/sogo.pid
[Install]
WantedBy=multi-user.target
Restart the service:
sudo systemctl daemon-reload sudo systemctl restart sogo sudo systemctl status sogo
Logging
SOGo service status:
service sogo status
Apache service status:
service apache2 status
Config files:
sudo ls -l /etc/sogo
SOGo log:
sudo tail -20 /var/log/sogo/sogo.log
Apache logs:
ls -l /var/log/apache2
Apache log:
sudo tail -20 /var/log/apache2/access.log | grep SOGo
sudo tail -20 /var/log/apache2/other_vhosts_access.log | grep SOGo
/etc/sogo/sogo.conf
This file need to be readable by user 'sogo', but not by others. If you edit this file as root you need to reapply owner and group:
sudo chown -R sogo:sogo /etc/sogo
Apache2
Make sure you have enabled all necessary modules.
sudo a2enmod headers sudo a2enmod proxy sudo a2enmod proxy_http sudo a2enmod headers sudo a2enmod rewrite sudo a2enmod ssl
If there is some sort of problem with the web service it could pay off to temporary increase the log level. For example, with the Apache configuration file 'raspberrypi.conf':
sudo nano /etc/apache2/sites-available/raspberrypi.conf
... LogLevel debug ...
sudo service apache2 restart
More info: