OpenPLC Installation
This site has videos for installing OpenPLC and SCADABr.
The installation described on this page is used for UAH's CPE 459/559 class. Much of it will work for other purposes.
You will install and configure:
Two virtual machines with Ubuntu Desktop LTS (PLC and HMI).
Moba Xterm.
OpenPLC runtime.
OpenPLC Editor.
Arduino IDE.
SCADABr Human Machine Interface (HMI) software.
Download and install the Oracle Virtual Box.
Select the link that matches your operating system (Windows, MAC, Linux).
Run the downloaded executable and accept all defaults.
You may need to reboot your computer.
Download and install the extension pack.
Link: https://www.virtualbox.org/wiki/Downloads
Click the link under “VirtualBox 6.1.16 Oracle VM VirtualBox Extension Pack
Clink on the downloaded file, in Explorer or in your browser, and follow directions to install.
Install Ubuntu Desktop LTS
Download an Ubuntu Desktop LTS .iso file.
Click the Download link to download. The file is quite large (2GB+). It will take a while to download. Coffee break 😊
Install the .iso within VirtualBox.
Open the Oracle VirtualBox VM Manager.
Press New
Name the new VM PLC
Change the type to Linux
Select Defaults for Memory Size, Hard Disk, Hard disk file type, Storage on physical hard disk, File location and size.
Your VM is now created, but we still must install the OS on the VM.
Within the Oracle VirtualBox VM Manager, select the PLC VM, and then click Settings.
Click Storage.
Under Controller IDE select the DVD symbol.
On the far right click the DVD symbol and select Choose a disk file.
Select the .iso file downloaded from the Ubuntu website.
Start the VM and follow install instructions within the Ubuntu OS.
Remove the .iso from the VM DVD drive.
Reboot your PLC VM (this new VM).
Configure to turn off the desktop (GUI) environment.
We will run with command line to conserve computer resources.
Link: https://linuxconfig.org/how-to-disable-enable-gui-on-boot-in-ubuntu-20-04-focal-fossa-linux-desktop
Open a terminal.
Enter command sudo systemctl set-default multi-user
Enter command shutdown -r to reboot.
Clone the PLC Linux to create a second VM for your HMI.
In the Oracle VM VirtualBox Manager
Select and highlight the PLC VM
Right click and select Clone
Set the name to HMI then click Next Select Linked clone then click Clone
For the HMI VM change the MAC address to be different than the PLC VM.
In the Oracle VM VirtualBox Manager
Select and highlight the HMI VM
Right Click and select Settings
Select Network
Press the arrow to open Advanced settings
Press the button to the right of the MAC Address box to select a new random MAC address.
Install OpenPLC runtime in the PLC VM
Link: https://www.openplcproject.com/runtime/linux/
git clone https://github.com/thiagoralves/OpenPLC_v3.git
cd OpenPLC_v3
./install.sh linux
Use command ip a to note your VM’s IP address.
The OpenPLC runtime starts automatically whenever your VM boots.
Create a network proxy to access the OpenPLC runtime from your host’s browser.
In the Oracle VM VirtualBox Manager, Select the PLC VM
Click settings and select Network
Under Adapter 1, Advanced, click port forwarding.
Add a rule to forward port 8080 from the PLC VM to port 8000 on the host. Fill in the host (8000) and local (8080) port fields only.
Then in your browser navigate to http://localhost:8000 (This webpage is the control interface for your PLC)
Note: you may need to reboot the VM for the proxy to take effect.
Install MobaXterm
Link: https://mobaxterm.mobatek.net/download.html
Download the installer application.
Run the installer.
Open the MobaXterm application.
Click Start local terminal.
Record the IP address provided in the local terminal. This will be used when starting GUI applications in VM’s.
Install the OpenPLC editor in the PLC VM
Link: https://www.openplcproject.com/plcopen-editor/
sudo apt-get install git
git clone https://github.com/thiagoralves/OpenPLC_Editor
cd OpenPLC_Editor
./install.sh
To start the OpenPLC Editor:
Open a terminal in the VM.
Use the command: DISPLAY=192.168.86.63:0.0 plcopeneditor&
Note: replace the IP address above with the IP address from Mobaxterm
Install the Arduino IDE in the PLC VM
Link: https://www.arduino.cc/en/guide/linux
In your PLC VM, download https://downloads.arduino.cc/arduino-1.8.13-linux64.tar.xz
Uncompress the IDE installer (tar -xvf arduino-1.8.13-linux64.tar.xz)
cd Downloads/Arduino-1.8.13
./install.sh
To run: DISPLAY=192.168.86.63:0.0 arduino& (a window will open on the host PC)
Note: replace the IP address above with the IP address from Mobaxterm
Install SCADABr in the HMI VM
Link: https://www.openplcproject.com/reference/scadabr/
git clone https://github.com/thiagoralves/ScadaBR_Installer.git
cd ScadaBR_Installer
./install_scadabr.sh
To open SCADABr in a browser (option 1):
Open a terminal in the VM.
Use the command: DISPLAY=192.168.86.63:0.0 firefox&
Note: replace the IP address above with the IP address from Mobaxterm
Navigate to http://localhost:9090/ScadaBR
To open SCADABr in a browser (option 2):
Create a port forwarding rule to map VM port 9090 to host port 9000.
In your host’s browser Navigate to http://localhost:9000/ScadaBR
Note: you may need to reboot the VM for the proxy to take effect.
Note: There may be problems with the apache server.
Navigate to the tomcat directory (cd /opt/tomcat6/apache-tomcat-6.0.53/).
cd logs
cat catalina.out | less (look for SEVERE)
restart apache (sudo /opt/tomcat6/apache-tomcat-6.0.53/bin/startup.sh)
Linux Command Line tips:
Set your display for MOBAXTERM.
Use export DISPLAY=192.168.1.1:0.0
Change the IP address above to match your MOBAXTERM IP address. Start a local terminal in MOBAXTERM to find your MOBAXTERM IP address.
Shutdown a Linux VM with the shutdown now command.
Reboot a Linux VM with the shutdown now -r command
Capture or release mouse (move mouse control from VM to host or host to VM).
Press the capture key. This is the right CTRL key by defa