Ubuntu 12.04 / java 1.7.0_09 / librxtx-java / mango automation Installation How-to
-
Since i struggled too long with installing this application to get everything right (and i definitely think it’s worth looking into it) i wrote this step by step how-to hoping to save someone else
s time. Although i found this sentence: “Mango Installations are usually very easy and we provide good instruction in the documentation section“, on this web site i actually couldn
t find any for linux installation.
And somehow i got feeling that lack of installation documentation is not because of company’s trying to commercialize whole mango project (there is nothing wrong with that) and to make users pay for support (there is nothing wrong with that also but installation should be straight forward so more time can be spent on exploring application rather than troubleshooting linux issues) so if im right and not ruining someone’s business plan here
s basic how-to for ubuntu installation:I wanted to run this on clean install of ubuntu 12.04 server using old unused hardware. I needed headless cheap system for logging information from device with modbus capability and then automate things like mailing daily reports, connecting to it over internet to see real time values and similar. All that (and much more) is possible with mango. I installed this on old motherboard with serial port, amd barton PCU running at 2,8GHz and with 2GB RAM. I tried also on old P3 machine (700MHz) with 256 MB RAM but its painfully slow and actually not useable. I would like to see someone writes down minimum hardware specs for this application.
**
STEP 1: Install ubuntu 12.04 server edition** with only openssh package selected (i wanted to run this as headless server connected to my modbus device) - you will find this during installation setup.Note: This installation is done with 32 bit ubuntu version - there are issues with librxtx-java (if you need serial port) if installed on 64-bit.
During installation define servers name, your user name, network etc. Be sure to have your server connected to your LAN during installation for automatic network setup (if you have DHCP) or do it manually during install or later.
After installation is finished and network configured you can connect to your new server over ssh (i use putty for that) from some other machine in your LAN.
To get audio signal from pc speaker that your system is up and ready after startup/reboot (since it will not have monitor connected to it) do following steps in your terminal window:sudo apt-get install beep
- add line "pcspkr" in file "/etc/modules":
sudo pico /etc/modules
- add line "beep -l 900 -r 1 -f 500" in file "/etc/rc.local" before "exit 0":
sudo pico /etc/rc.local
(You can try your pc speaker with “beep” command)
**
STEP 2: Installing java from oracle.com **
I installed java according to these instructions with slight modifications (/etc/profile is not the recommended way for adding system variables but rather /etc/environment):
http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux
Following are mostly copy / paste commands from above site:sudo mkdir -p /usr/local/java
Now download java sdk and jre from oracle (i used at the time latest 7u9 version from http://www.oracle.com/technetwork/java/javase/downloads/index.html).
(to do downloads over terminal window i use method of starting download in my firefox browser and then stopping it and copying download link with right clicking in downloads window and selecting “Copy Download Link”. Then in servers terminal window i use wget + paste. If downloaded file name is mixed up correct it with mv command or similar)
Copy the Oracle Java downloaded binaries into the /usr/local/java directory.
Write following to your terminal window:sudo -s cp -r jdk-7u9-linux-i586.tar.gz /usr/local/java sudo -s cp -r jre-7u9-linux-i586.tar.gz /usr/local/java cd /usr/local/java sudo -s chmod a+x jdk-7u9-linux-i586.tar.gz sudo -s chmod a+x jre-7u9-linux-i586.tar.gz sudo -s tar xvzf jdk-7u9-linux-i586.tar.gz sudo -s tar xvzf jre-7u9-linux-i586.tar.gz ls –a
you should see two directories:
• jdk1.7.0_09
• jre1.7.0_09add system variables JAVA_HOME, JRE_HOME and M2M2_HOME to environment file:
sudo pico /etc/environment
add lines under PATH:
JAVA_HOME=/usr/local/java/jdk1.7.0_09 JRE_HOME=/usr/local/java/jre1.7.0_09 M2M2_HOME=/home/”your user name”/mango
add at the end of PATH following :/usr/local/java/jdk1.7.0_0_09/bin:/usr/local/java/jre1.7.0_09/bin”
save /etc/environment (ctrl+x in pico)
for this changes to take effect you need to logout/login to your user account
after login do following:sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_09/bin/java" 1
• this command notifies the system that Oracle Java JRE is available for use
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_09/bin/javac" 1
• this command notifies the system that Oracle Java JDK is available for use
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jre1.7.0_09/bin/javaws" 1
• this command notifies the system that Oracle Java Web start is available for use
sudo update-alternatives --set java /usr/local/java/jre1.7.0_09/bin/java
• this command will set the java runtime environment for the system
sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_09/bin/javac
• this command will set the javac compiler for the system
sudo update-alternatives --set javaws /usr/local/java/jre1.7.0_09/bin/javaws
• this command will set Java Web start for the system
java -version
• This command displays the version of java running on your system
• You should receive a message which displays:
• java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b09)
Java HotSpot(TM) Server VM (build 23.1-b03, mixed mode)javac -version
• This command lets you know that you are now able to compile Java programs from the terminal.
• You should receive a message which displays:
• javac 1.7.0_09STEP 3: Install librxtx-java
To use your serial port for connecting to (in my case) modbus device over rs232->rs485 adapter you need to do following:
according to this site: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux install librxtx-javasudo apt-get install librxtx-java
then copy files librxtxSerial.so and RXTXcomm.jar to following directories:
sudo cp /usr/lib/jni/librxtxSerial.so /usr/local/java/jdk1.7.0_09/jre/lib/i386 sudo cp /usr/share/java/RXTXcomm.jar /usr/local/java/jdk1.7.0_09/jre/lib/ext
STEP 4: Install mango automation
Now we can download mango automation full core and modbus ip & serial data source from here: http://infiniteautomation.com/index.php/download.html
after download finishes do following:cd /home/”your user name”/ sudo mkdir mango sudo apt-get install unzip unzip ma-full-core-2.0.3.zip –d mango
copy “modbus IP & serial data source” module to mango/web/modules and start mango
sudo cp m2m2-modbus-1.4.1.zip mango/web/modules sudo chmod +x mango/ma-start.sh sudo ./mango/ma-start.sh
Now mango should start and you can connect to it with your browser on any computer inside LAN over address yourserversname:8080
You should be able to add serial modbus (RTU) data source, select appropriate serial port and add data points.
Explore and customize your system. Have fun. -
Thanks very much for this. It will be very helpful for other users. We actually have a Linux service and installer package coming out soon that will help simply this. When I install on Ubuntu server I usually just install tomcat along with ssh which also then installs Java 1.6, after that it's just a matter of unziping the files and starting. Mango doesn't officially support Java 1.7 was their a reason you didn't install 1.6 as recommended?
Thanks again,
Joel.
-
I just moved my install from a windows 7 to Ubuntu 12.04 Server and I just installed SSH and tomcat. I can login, but all my graphs are now broken images. Are the graphs saves somewhere else other then the mango folder?
-
I followed these instructions and it all seems to work quite well.
I have installed Ubuntu 64 bit so selected jdk and jre x64. The version was also 1.7.0_10
I also installed the rxtx per your instructions but in mango under the modbus serial data source I get: "no rxtxSerial in java.library.path"
Because of the x64 java there is no usr/local/java/jdk1.7.0_09/jre/lib/i386 so i used usr/local/java/jdk1.7.0_09/jre/lib/amd64
Any other thoughts on the rxtx?
Thanks,
Joel. -
You
re welcome. Thank you for sharing this SCADA. No special reason for 1.7. I just wanted latest available software packages, and as for tomcat - it
s not needed for latest mango, right?
I also tried installing with openjdk but had some problems regarding librxtx so decided to drop it and install from oracle.
Cheers! -
Right, tomcat is not needed but it installs the JDK along with it which save time.
I'm going to do some testing but still can't figure out the rxtx thing?
Joel.
-
copied from http://rxtx.qbang.org/wiki/index.php/Download#x64_Binaries
x64 Binaries
Should you wish to use RxTx on a x64 based computer, note that the downloads on this page will not work, for x64 compiled binaries go to: Cloudhopper RxTx page. Binaries have been tested successfully on Windows Server 2008 R2, although they are slightly outdated (december 2008), and known to crash when unplugging an USB serial adapter. Another option obtaining prebuilt binaries for x64 is one of the #Known RXTX forks below.
-
I have tried the 64bit version of RXTX several times. The serial ports show fine in mango but when Mango tries to actually send data on one Java crashes with this error:
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x00007f3d05dca5da, pid=13353, tid=139900081764096
JRE version: 7.0_10-b18
Java VM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04 mixed mode linux-amd64 compressed oops)
Problematic frame:
C [librxtxSerial.so+0x75da] Java_gnu_io_RXTXPort_nativeDrain+0xea
Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
An error report file with more information is saved as:
/opt/mango/hs_err_pid13353.log
If you would like to submit a bug report, please visit:
http://bugreport.sun.com/bugreport/crash.jsp
I decided to try 32 bit Ubuntu and follow your instructions. I've done it twice now and when I try to start mango I get
./ma-start.sh: 40: ./ma-start.sh: /usr/local/java/jdk1.7.0_10: Permission denied
java -version looks right and I'm running as root and can't figure out why permission would be denied, I didn't have this problem when using 64bit.
Thanks,
Joel. -
Ok just figured out the permission denied error. I had a extra space in the path of the JAVA_HOME environmental variable : )
RXTX works fine on 32bit.
Also something that might be useful to know, I'm running on a fairly low power single board atom computer and Mango runs much much faster when using the Oracle java vs the OpenJDK. I would not have thought to test them side by side like this so thanks. On higher power servers OpenJDK seems just fine.
Joel.
-
Maybe i should mention in first post that i used 32 bit ubuntu. I had no idea that it would matter regarding rxtx issues.
Do you have any clue what would be minimum hardware specifications for running mango smoothly?
-
There really are no minimum requirement because it all depends on what you want to do. I have not done these test myself but there have been several companies testing Mango on small ARM computers and Mango will run on all of them. The UI of Mango can be quite slow when running on a low power CPU, if your application does not require logging into Mango very much then these could work fine. Note: DGLux is a client side technology so you can still develop high quality dashboards to view data from the low power computer without taxing the CPU very much. Other factors are how fast you need to be logging data and if you need to view detailed data over long periods of time.
To supporter: For Mango to carry out it's operations of collecting or publishing data it takes very little CPU or Ram. To view the data on DGLux dashboards also does not take much. For the Mango UI to be fast and to do large history pulls of data take more CPU.
I hope this helps. There is currently still quite a bit of R&D going on to answer these questions.
Joel.
-
Firstly, very helpful tutorial, ime, thanks.
I am trying to get Mango working on Ubuntu 12.04 64bit VPS.
I have followed your install guide, except swapping the most recent package for each software (so JDK and JRE 1.7.0_17, Mango 2.0.6, modbus IP 1.4.2).
When I run ./ma-start.sh the script starts.
Firstly, it gives:
INFO 2013-03-30 15:38:52,032 (com.serotonin.util.properties.ReloadingProperties.checkForReload:142) - (env) Found updated file(s) at [/home/myuser/mango/classes/env.properties]. Reloading properties
WARN 2013-03-30 15:38:52,444 (com.serotonin.m2m2.Main.getProperties:607) - Module /home/myuser/mango/web/modules/_save: module.properties not found in module directory. Module not loaded.
It then continues and then hangs indefinitely at: ```
INFO 2013-03-30 15:38:56,813 (com.serotonin.util.properties.ReloadingProperties.checkForReload:142) - (dglux) Found updated file(s) at [/home/myuser/mango/web/modules/dglux/classes/dglux.properties]. Reloading propertiesI have tried it with both M2M2_HOME and MA_HOME set at the mango installation directory. I have not installed Tomcat, as I understand that is now no longer needed. I have checked in classes, and 8080 is set as the port. Any suggestions? I am quite stumped. Thanks. EDIT - I can, however, log-in to the Mango installation, at 8080. Is it safe to assume I can ignore these errors?
-
Hi, I have exactly the same problem as yours, my log stops at
INFO 2013-06-05 10:42:17,685 (com.serotonin.util.properties.ReloadingProperties
.checkForReload:142) - (dglux) Found updated file(s) at [/home/paolo/mango/web/m
odules/dglux/classes/dglux.properties]. Reloading propertiesFurthermore, however, I cannot log-in to the Mango installation, at 8080. Did you solve this issue ?
thanks,
-
If you can log in then it's save to assume its running fine.
Joel.
-
I can log-in as Joel says so I assume it's fine. However, I never got to the bottom of it.
I don't know why you wouldn't be able to log-in to the installation at 8080. Can you give any other information?
Joel: I should probably mention that once up and running it is quite a pleasure to use, btw.
-
I followed these instructions and it all seems to work quite well.
I have installed Ubuntu 64 bit so selected jdk and jre x64. The version was also 1.7.0_10
I also installed the rxtx per your instructions but in mango under the modbus serial data source I get: "no rxtxSerial in java.library.path"
Because of the x64 java there is no usr/local/java/jdk1.7.0_09/jre/lib/i386 so i used usr/local/java/jdk1.7.0_09/jre/lib/amd64
Any other thoughts on the rxtx?
-
I've never figure out how to get rxtx to work on 64 bit Ubuntu. It works fine on 32 bit just fine.
Joel.