Ubuntu Server 10.4 Lucid – Upgrading Feng Office (Community Edition)

It turns out that upgrading Feng Office is actually very simple. I had installed Feng Office Community Edition version 1.7.4 recently and a few days ago found out that version 1.7.5 had been released.

It is advisable to backup your current installation before upgrading.

Log in to Feng Office as Admin and then click the Administration link:

Click the Upgrade button:

Click Start automatic upgrade:

Wait a couple of minutes and then log back in to your new version of Feng Office.

Ubuntu Server 10.4 Lucid – Installing and Configuring the Feng Office Backup v1.0 Plugin

In my previous post I configured Ubuntu Server with a set of scripts and cron jobs to backup (and restore) the Feng Office installation folder and the MySQL database to a Windows share.

The Feng Office wiki mentions an alternative backup method – in the form of a plugin that can be installed and configured from the Administration panel. The current version of the backup is v1.0 and it can be downloaded from here.

The plugin does include a basic readme.txt file but it does not clearly detail the steps that are needed to install the plugin.

First you will need to have wget and unzip installed on your server:

sudo apt-get update
sudo apt-get install wget unzip

You can either download the plugin (if the version has changed since this post was written) and upload it to your Feng Office server or use wget to download the file as follows:

wget http://sourceforge.net/projects/opengoo/files/plugins/backup/

Extract the plugin to your Feng Office installation folder – for me this is /var/www/feng_community:

sudo unzip backup_1.0.zip -d /var/www/feng_community/

Now open a browser and log in to Feng Office as the Administrative user.

Copy and paste the following URL to install the backup plugin (replace <server-ip> with the IP address of your Feng Office server):


You should now see that the plugin is successfully installed:

Click the back to opengoo link to return to Feng Office and then click the Administration link:

In the Administration Panel click the Backup icon:

Click the Launch backup process link:

Once the backup is complete you can download it to your local machine and then delete the backup from the server:

If you check the Cron Events section of the Administration Panel you will see that the backup plugin can be scheduled and enabled quite simply.

The only problem that I see is that the backups are saved locally on the Feng Office server – this still requires the Admin user to download the backups to store them somewhere else.

Sadly as far as I can tell restoring the backup is a manual process. While it doesn’t look too taxing it would involve copying the backup to the Feng Office installation folder and then manually restoring the MySQL database backup.

While this backup process seemed to work quite nicely (and it is nice to be able to do from within the Feng Office interface) I plan to use the scripts and cron jobs that I already have set up to back up Feng Office.

Ubuntu Server 10.4 Lucid – Backing up Feng Office 1.7.4 (Community Edition)

The Feng Office Wiki has instructions for backing up the Feng Office installation folder and the MySQL database. This can either be done with scripts and a cron job or with a plugin that allows for configuration via the Administration web console and a cron job.

In this post I will look at the scripts and cron job – I intend to look at the plugin later on.

Backing up Feng Office for me this means backing up /var/www/feng_community as well as the fengdb database.

In my previous post I mounted a share on my Windows Home Server in Ubuntu Server using the following mount point /mnt/whs-backup.

Note: Your Feng Office installation folder, database variables and backup destination may differ so adjust them as required.

To run a nightly backup I need two brief scripts, a secure file that contains the MySQL username and password, and two cron entries to run the backups.

Update: In the comments potion pointed out that the cp command does not file owner/group or permissions. So I have added his suggested scripts for the tar command.

Here are the explanations of the tar switches used:

-c, --create               create a new archive
-f, --file=ARCHIVE         use archive file or device ARCHIVE
-x, --extract, --get       extract files from an archive

Note: the following two scripts are saved in my /home/username folder.

The first script will back up /var/www/feng_community:

Original script:

#!/bin/bash sudo cp -R /var/www/feng_community /mnt/whs-backup

Tar script:

today=$(date '+%d_%m_%y')
sudo tar -cf /mnt/whs-backup/"$today"_feng_community.tar 

I saved this file as backup-feng-community.sh

The second script will backup the fengdb database and query a secured file /etc/fengdb.cnf for MySQL credentials:

mysqldump --defaults-extra-file=/etc/fengdb.cnf fengdb >

I saved this file as backup-fengdb.sh.

Now we need to make these two scripts executable:

chmod +x backup*.sh

Create a file called /etc/fengdb.cnf:

sudo nano /etc/fengdb.cnf

Add the following lines using your MySQL fengdb username and password:

host = localhost
user = fenguser
password = yourfengdbpassword

In nano press Ctrl + O and then Enter to save and then Ctrl + X to exit.

Secure /etc/fengdb.cnf as follows:

sudo chmod 600 /etc/fengdb.cnf

At this point we could execute the two scripts manually and backup Feng Office to our Windows share.

To automate the backup we use cron. This is what my cron settings look like (my two scripts are set to run everyday around 1am).

# m h  dom mon dow   command
15 1 * * * /home/username/backup-feng-community.sh
*  1 * * * /home/username/backup-fengdb.sh

Change username to your Ubuntu Server username.

To edit your cron settings use the following command:

sudo crontab -e

You can use my settings or you can easily generate your own cron settings using the online cron generator.

If you have configured Feng Office to communicate with email accounts such as Gmail be prepared for the backup of /var/www/feng_community to take a little while (depending of how many email and attachments have been downloaded).

As with any backup we also need to know how to restore the backups. For this we need two scripts. The first I named restore-feng-community.sh:

#!/bin/bash sudo cp -R /mnt/whs-backup/feng_community /var/www

Tar command:

sudo tar -xf /mnt/whs-backup/*_feng_community.tar 

In the tar restore above the * refers to the date of the backup.

The second script (to restore the MySQL database) I named restore-fengdb.sh:

mysql --defaults-extra-file=/etc/fengdb.cnf fengdb <

Again, make both of these scripts executable:

chmod +x restore*.sh

For the record I did test the restore process before posting! Please take precautions when you test restoring your backups (and make sure that you change the appropriate variables in the scripts to match your environment).

Sources: Feng Office Wiki, serverfault.

Configuring Feng Office 1.7.4 Community Edition To Send Email Via Gmail – Ubuntu Server 10.4 Lucid

In my previous post I installed Feng Office 1.7.4 Community Edition on Ubuntu Server 10.4 Lucid.

With the installation complete, I wanted to configure Feng Office to send and receive emails and found that the best option (for me) was to configure Feng Office to use Gmail.

I set up an additional Gmail account for the Feng Office Administrator to use as I already had a Gmail account for myself.

Note: I did also configure Feng Office to connect to my Hotmail / Windows Live account – but currently Feng Office only allows me to receive emails from this account.

The first step that you need to complete once you have a Gmail account is to enable IMAP. Log in to Gmail and then click Options cog at the top right of the screen – then click the Mail Settings link.

Click the Enable IMAP radio button and then click the Save Changes button.

That is all we need to do on the Gmail side of things so the next step is to configure the Feng Office Admin account to send emails via our Gmail account. This will enable users to receive reminders and other system generated emails.

Log in to Feng Office as the Administrator and then click the Administration link:

Click the Configuration button:

Click on the Mailing link:

Below you can see how I set the options to connect to my Gmail account. Obviously you will need to change the Gmail email address to the one that you want to use. Click Save.

Setting up a Gmail account for a user is a little different. If you need to add a user just click Administration followed by the Add user link:

Type in the User name and their Gmail address and then click Add user:

Click Administration again and then click Add Email account:

This is how I configured the incoming email settings for my user account (I have removed the first part of my gmail address). You will need to use an email address that is different from the Admin user Gmail address:

Below is my configuration for the SMTP settings:

Update: This seemed to be enough to get things working until I upgraded to Feng Office 1.7.5 – though I cannot be sure that upgrading was the trigger that prevented the Feng Office admin account from sending emails.

If we first look at the cron settings in the Admin panel in Feng Office (Log in as Admin and click Administration then Cron events) we can see that it is set to check for emails every ten minutes:

The solution was to create a cronjob that calls on the cron.php file which resides in the root of the Feng Office installation folder, as follows:

sudo crontab -e

I set my cron job to run every minute as signified by the five asterisks – followed by the script to call on cron.php.

* * * * * sudo wget -O - -q http://<server-ip>/feng_community/cron.php

You can change this to run the cron job as often as you would like – you will need to change the IP address to that of your server – and you may need to adjust the path to cron.php depending on your installation.

The frequency of this cron job can over-ride the settings that you specify within the Cron events page in the Feng Office admin panel. For example, if you configure a cron job to run every five minutes, and you configure the cron event to check for upgrades every one minute, it will only be able to check for upgrades every five minutes.

This setup was enough to get the Admin user to send notifications to Feng Office users and for me to be able to send and receive emails within Feng Office.

There are plenty of other options that can be set and so I would recommend that you read the Feng Office Wiki pages that deals with Setup and  Email here and here.

Support is also available from the Feng Office Forum.

Ubuntu Server 10.4 Lucid – Installing Feng Office 1.7.4 Community Edition

Feng Office is a web based suite of collaborative applications (groupware) that includes notes, email, contacts, calendar, documents, tasks and weblinks. As an administrator you can setup users and collaborative workspaces and users can work in their own workspace as well as the collaborative workspace(s) that they have access to. I will be installing the current stable version of Feng Office which is 1.7.4 (although you can download and install 1.7.5 if you want to).

Note: I had to look around for a solution for enabling innoDB on Ubuntu 10.4 Lucid and fortunately did find a work-around that enabled me to install Feng Office. Having said that InnoDB should be enabled by default – it appears that MySQL seems to disable it if your InnoDB log files get corrupted. When you remove the log files they are recreated, allowing InnoDB to start again. This will be covered during the tutorial below if you also encounter this issue.

I installed Feng Office in a VMware vSphere virtual machine on an existing Ubuntu 10.4 Lucid LAMP server.

If you do not have Ubuntu Server 10.4 already installed you just need to choose the LAMP and SSH roles during installation. On an existing server without these roles installed enter the following command at the terminal (and then select the LAMP and SSH roles and make a note of your MySQL password for later):

sudo tasksel

Assuming that we now have the LAMP and SSH roles installed we can now connect remotely to the server using Putty (Windows) or SSH (Linux).

First install php5-gd, php5-cli and nano:

sudo apt-get install php5-gd php5-cli nano

Next check the memory_limit setting in php.ini.

sudo nano /etc/php/apache2/php.ini

Make sure that the memory_limit setting is set to at least 32 MB.

Install Unzip (so that we can unzip Feng Office after we download it):

sudo apt-get install unzip

Now change directory to /var/www and download Feng Office:

cd /var/www/
sudo wget http://downloads.sourceforge.net/project/opengoo/

Unzip Feng Office:

sudo unzip fengoffice_1.7.4.zip -d /var/www/feng_community

Feng Office will now be extracted to the folder feng_community in the /var/www directory.

Give ownership of the feng_community directory to Apache:

sudo chown -R www-data:www-data /var/www/feng_community

The next step is to create a MySQL database for Feng Office:

mysql -u root -p

Enter your MySQL password when prompted.

At the mysql> prompt type the following commands – make sure you change ‘fengsqlpassword‘ to a password of your own:

create database fengdb;
create user 'fenguser'@'localhost' identified by 'fengsqlpassword';
grant all on fengdb.* to 'fenguser'@'localhost';

Now restart Apache:

sudo /etc/init.d/apache2 restart

If you want to quickly check that InnoDB is running at this point you can do this as follows:

mysql -u root -p
mysql> show engines;

If InnoDB is not running then issue the following commands:

sudo /etc/init.d/mysql stop
sudo mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak
sudo mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak
sudo /etc/init.d/mysql start

For good measure I rebooted – and then found that InnoDB was running:

sudo reboot

To complete the installation open browser and goto http://<server-ip>/feng_community/ where <server-ip> is the IP address of your server.

Click Next:

You should pass the Environment checks – click Next:

Confirm the following details as per the screen-shot below.

Hostname: localhost
Username: fenguser
Password: The fengsqlpassword you defined earlier
Database name: fengdb

Click Next:

Click Finish to complete the installation:

Browse to http://<server-ip>/feng_community/

Define an Admin username, email address, password and Company name and then click Submit:

Welcome to your new Feng Office installation:

Sources: howtoforge, turnkeylinux forum, Feng Office Wiki and innodb forum.