Installing Emoncms on Raspberrry Pi 2

Emoncms can do some great input processing and visual dashboards, along with many other things. Below is the process I used to install it on a Raspberry Pi 2 using Raspian.

Install Dependencies

Install all the dependencies.

During this install, it will prompt you for further information. Install pecl dependencies (redis and swift mailer)

Add pecl modules to php5 config

Configure dependencies

Redis

Configure redis to run without logging or data persistence.

Comment out redis log file and all the redis saving.

Then restart the Redis service

Apache2

Emoncms uses Apache to route requests, so modrewrite needs to be enabled.

Modify the Apache2 config to allow rewrite.

Change (line 7 and line 11), AllowOverride None to AllowOverride All. Comment out line # CustomLog ${APACHE_LOG_DIR}/access.log combined Comment the access log to other-vhosts (add #)

Now Reboot the Pi

Install Emoncms

For the install Emoncms, it will be installed from the git repository for Emoncms. First, lets setup the web directory and permissions.

Download Emoncms from the git repository. For this we’re using a cloning a specialised version of Emoncms which has been designed to write less to the SD Card.

Configure Emoncms

Mysql

Lets setup the mysql database for Emoncms. If you would like to move the mysql database to another location (for easier backup,etc), now is the time to do it. For this, I’ve chosen to move the Mysql database to /home/pi/data/mysql. I first create the directory and then copy the mysql data accross.

Now update the mysql configuration file to use the new location.

change line datadir to /home/pi/data/mysql Create the Emoncms database.

This will prompt you for a password and the following SQL will create the database.

Now create a user and assign permissions that Emoncms will use to access the mysql databse. In the commands below, update username and password to suit your choice.

Data directory

Now we create some directories were the Emoncms’ feed engines ( phpfina and phptimeseries) will store data. I chose /home/pi/data/.

Emoncms Configuration settings

Lets setup the configuration file for Emoncms. We copy the default.settings.php to settings.php.

Now we update the settings to suit this installation of Emoncms.

Update the following things: Database Settings. Update these to the username and password you created previously when setting up Mysql.

If you chose a different location to store your data directory earlier, update these lines to suit your data directories.

Setup the feedwriter script as a service.  Copy the service script to /etc/init.d/, update permissions and enable for service.

Now go to a web browser and go to the emoncms website. Update the IP-Address below to your host.

Click Register and create yourself a new Admin user. After you have successfully logged in and do not want to create any other users for this Emoncms, it is best to disable the register functionality. To do this, we edit the settings again.

And change $allowusersregister to FALSE.

As you have now gone through the initial setup for Emoncms, you can also disable the dbtest.

Monitoring/Debugging/Troubleshooting

The following log entries should be created and help with this.

References

https://github.com/emoncms/emoncms/blob/master/readme.md
https://github.com/emoncms/emoncms/blob/bufferedwrite/docs/install.md
http://emoncms.org/