Community
OpenEnergyMonitor

Community

Install EmonCMS on Ubuntu 18LTS with scripts

Continuing the discussion from Error in update emoncms:

Updated 3 Oct 19

The new scripts work for installing Emoncms on Ubuntu. This worked for me on a VM with 1804LTS server.

The new install script is here.

Before starting, you need to set the current user so no password is required when using sudo. To do this

sudo echo $USER' ALL=(ALL) NOPASSWD: ALL' | sudo tee /etc/sudoers.d/$USER && sudo chmod 0440 /etc/sudoers.d/$USER

Then follow the install instruction from here.

  • When it asks if you want to review the config say y
  • I used the config below. The file is found in /opt/openenergymonitor/EmonScripts/install/.
  • You need to add the user and hostname to the config.ini.
  • Once you have edited the config.ini, in that same folder run ./main.sh to install.
  • Post install you are likely to need to edit the settings.inifile.

And that’s all there is to it!

My config.ini for an Ubuntu install.

Note -

  • To not install the config (for emonhub) and WiFi modules, I have commented them out.
  • I do not install the demanshaper module (commented out).
  • This installs the master branch of everything - you might wish to use stable.
# Components enabled
apt_get_upgrade_and_clean=true
install_apache=true
install_mysql=true
install_php=true
install_redis=true
install_mosquitto=true
install_mosquitto_server=true
install_mosquitto_client=true
install_emoncms_core=true
install_emoncms_modules=true
# EmonHub: comment out line above "emoncms_modules[config]=stable" if
# you do not wish to have the emoncms emonhub config module installed
install_emonhub=false
# RaspberryPi emonSD applicable items
# set to false if not needed
install_firmware=false
install_emonpilcd=false
install_emonsd=false
install_wifiap=false

openenergymonitor_dir=/opt/openenergymonitor
emoncms_dir=/opt/emoncms

emoncms_www=/var/www/emoncms
emoncms_log_location=/var/log/emoncms
emoncms_datadir=/var/opt/emoncms

# usernames and passwords below are for default raspberrypi installation
# these can all be changed to own preference

# emonSD
# - Change user to reflect your OS user
# - Set emonSD_pi_env=0 if not a raspberrypi
user=brian
hostname=emonpiVM
emonSD_pi_env=0

# MySQL
mysql_user=emoncms
mysql_password=emonpiemoncmsmysql2016
mysql_database=emoncms

# MQTT
mqtt_user=emonpi
mqtt_password=emonpimqtt2016

# Default branches
emoncms_core_branch=master
emonhub_branch=emon-pi
log2ram_branch=rsync_mods

# Modules installed in $emoncms_www/Modules
# Configure branches as applicable
declare -A emoncms_modules
#emoncms_modules[config]=master
emoncms_modules[graph]=master
emoncms_modules[dashboard]=master
emoncms_modules[app]=master
#emoncms_modules[wifi]=master
emoncms_modules[device]=master

# Modules installed in $emoncms_dir/modules
# Configure branches as applicable
declare -A symlinked_emoncms_modules
#symlinked_emoncms_modules[demandshaper]=master
symlinked_emoncms_modules[sync]=master
symlinked_emoncms_modules[backup]=master
symlinked_emoncms_modules[usefulscripts]=master
symlinked_emoncms_modules[postprocess]=master

# git repositories
declare -A git_repo
git_repo[emoncms_core]=https://github.com/emoncms/emoncms.git
# main modules
git_repo[config]=https://github.com/emoncms/config.git
git_repo[graph]=https://github.com/emoncms/graph.git
git_repo[dashboard]=https://github.com/emoncms/dashboard.git
git_repo[app]=https://github.com/emoncms/app.git
git_repo[wifi]=https://github.com/emoncms/wifi.git
git_repo[device]=https://github.com/emoncms/device.git
# symlinked modules
git_repo[demandshaper]=https://github.com/emoncms/demandshaper.git
git_repo[sync]=https://github.com/emoncms/sync.git
git_repo[backup]=https://github.com/emoncms/backup.git
git_repo[usefulscripts]=https://github.com/emoncms/usefulscripts.git
git_repo[postprocess]=https://github.com/emoncms/postprocess.git
# emonhub 
git_repo[emonhub]=https://github.com/openenergymonitor/emonhub.git
# emonpi/rpi specific tools
git_repo[emonpi]=https://github.com/openenergymonitor/emonpi.git
git_repo[log2ram]=https://github.com/openenergymonitor/log2ram.git
git_repo[avrdude-rpi]=https://github.com/openenergymonitor/avrdude-rpi.git
git_repo[RFM2Pi]=https://github.com/openenergymonitor/RFM2Pi
1 Like

these steps are all I have to do to install emoncms ?

With a bit of luck - yes. Note it really needs to be a fresh Ubuntu installation else the problems with Mosquitto will just repeat.

I have found one additional problem with demandshaper; it is the same as the service-runner service in that it uses the User=pi.

sudo systemctl edit demandshaper.service
sudo systemctl daemon-reload
sudo systemctl restart demandshaper.service

You could select not to install it in the config.ini. to do so comment out this line in config.ini

symlinked_emoncms_modules[demandshaper]=master

in addition to the changes I made in the config.ini in the original post.

1 Like

Thanks for testing the install script on a Ubuntu VM @borpin. Will look through the issues that you have raised.

1 Like

Updated top post 3/10/19

1 Like

Is the section “emonpi/rpi specific tools” on the config still required for an ubuntu VM?

If you mean this

No set to false.

Set this to zero as well

Which us exactly as per the sample I posted above.

I meant this part:

# emonpi/rpi specific tools
git_repo[emonpi]=https://github.com/openenergymonitor/emonpi.git
git_repo[log2ram]=https://github.com/openenergymonitor/log2ram.git
git_repo[avrdude-rpi]=https://github.com/openenergymonitor/avrdude-rpi.git
git_repo[RFM2Pi]=https://github.com/openenergymonitor/RFM2Pi

No you can leave these alone as they are only used if the module is installed.