Instalar MANGO em Board ALIX 2D com arduino

Boas pessoal escrevi um tuturial para ajudar aqueles que queiram tentar criar uma pequena soluçao embebed para optimizar recursos
Escrevi em ingles para poder ser mais universal e tambem esta publicada no site do MANGO.
Para ja apenas complementa a instalaçao do MANGO pois tive dificuldades com a instalaçao do SCADABR com o script de instalaçao.
Estou usando o arduino nesta configuraçao e funciona muito bem.
Esta board cria uma coluçao muito barata e compacta, inda estou testando a comportamento dela mas pra ja tou contente com ela:)
Se alguem quizer pegar neste manual e melhora-lo seria optimo
Obrigado a todos

This tuturial is for thoose want to build a small box to run Mango or ScadaBr
Since I was looking for a small pc I remember to use a Alix board that is more cheap than a pc and more compact and try to build a linux debian based system and them install MANGO
In this tuturial I will try to explain the steeps I take to sucssefuly install the debian and then the Mango. My choise of using mango was because I can’t get ScadaBr running because of the installer script so I turn to Mango

In my configuration I will use:

An Arduino Duemilanove
an Alix Board 2D from PC Engines GmbH, can be bought at http://pcengines.ch/alix.htm
1 CF card 4Gb (for debian instalation and MANGO)

After a seach on google I found a website with some instrutions that help me to get all up and running
You can see all the instrutions where http://www.gooze.eu/howto/debian-installation-on-alix-board-howto/setting-time but for now I will try to resume some of then.
In case you have some dificult I sugest you to read the instrutions on the above link.
You will need a pc with a CFcard reader to start the instalation on the CFcard, in my case I’m using a Linux Mint distro but any other will do
I will assume you have some linux experience and soo I will not go to deep
Soo insert the CFcard on your reader.You will need to know waht was the /dev/sdXXX your system give to the CFcard. There are diferent ways to see this, I will describe 2 ways:
before insert the card open a console and type: “tail -f /var/log/messages” then insert the CFcard, you will see the text will flick and there you can read the /dev/sdXX that was assigned to your card
after that just hit CTRL+C to exit from the tail.Now you know the id of your device
Another way is just use the gparted wich is a disk tool to manage partitions on linux with a nice GUI.there you can also see the “/dev” id of your card

we will use the “dd” command to copy an image to CFcard with a prebuild of a debian instalation
open again a console in case you close the last one and download the image
$wget http://download.gooze.eu/embedded/debian/images/debian.tar.gz
then extact the tar using:
$tar -xvf debian.tar.gz
After that we can transfer the image to the CFcard using:
$ dd if=debian.img of=/dev/sd[b,c,d]
double check the command because if you make some mustake you can delete or harddrive!!!
it will take a while so just wait until you get the prompt again with the details of the duration and speed of the copy
After that remove the card and insert the CFcard on the alix board.Before you power it you will need a Serial cable to connect the alix board to your computer
You will also need a hiperterminal client, I had used gtkterm but you can use “screen” ou putty, its up to you.
The baud is 38400N,8,1
Open the port with with configuration and the power the alix board.
You should start to see some lines of a test memory wich is normal on the alix board and the wait until you see the debian instalation menu.This can take a while , do not remove the power, if soo perhaps you will need to reinstall the image of the last step
Follow the setup as normal(if you have trouble read the instrutions on the link I give above)
After the instalation is complete install ssh for remote acess.I will assume you already have internet conection on the alix
$apt-get install openssh-server
If you want to install mysql to support the Mango databases you can just install it by using:
$apt-get install mysql-server

Mango needs to have JAVA installed
In my case using “apt-get install sun-java6-jdk” it give me a message no package found then I had need to add a source to a new repository
use vi or nano and add the folowing line to /etc/apt/sources.list “deb http://archive.canonical.com/ lucid partner” without the " of course
Save it and update all sources using “apt-get update”
after that you should be able to install java then type “apt-get install sun-java6-jdk”
Then install a ntp package to automaticaly update the time of your system
$apt-get install ntpdate
$ntpdate pt.pool.ntp.org

In my case I’m using a Portuguese NTP server, adapt to your needs
after that confirm the date and time using
$date
It must display the right time and date now.
Now that we have all the requirements lets move to the MANGO instalation.
Visit the link http://mango.serotoninsoftware.com/download.jsp
Here we can find the parts we need
Open a console again and choose a location to store the instalation.I had installed on /usr
$cd /usr/local
Lets Dowload the TOMCAT:
$wget http://mango.serotoninsoftware.com/downloads/apache-tomcat-6.0.20.tar.gz
Extract it:
tar -xvf apache-tomcat-6.0.20.tar.gz
Rename the folder to tomcat just to be more simple
$ mv -R apache-tomcat-6.0.20 tomcat
$ cd tomcat/bin

For test the apachTomCat lets fireup it and see if it runs.To do this just do:
$ ./startup.sh
This will start the Service and now he would be able to open the welcome page of tomcat opening http://ip_of_box:8080
If you see the page you are ok, close it and lets stop it for now using :
$ ./shutdown.sh
Now we need to remove some folders inside the webapps/ROOT folder to store the MANGO
to do this use:
$cd /usr/local/tomcat/webapps/ROOT
Remove all folders using:
$rm -R
This will remove all folders and files on this location, we need to remove it because this is the root dir of tomcat, this are the files and folder displayed when you start Tomcat, since we want just the MANGO lets now dowload it for this directory and extact it were
Assuming you stil are in the same folder ("/usr/local/tomcat/webapps/ROOT") download the MANGO
$wget http://mango.serotoninsoftware.com/downloads/mango-1.13.0.tar.gz
Extact it :
$tar -xvf mango-1.13.0.tar.gz
To confirm all files and folder are now here just do an “ls -al” to list the directory:
$ls -al
you should see something like this:

root@supervisao:/usr/local/tomcat/webapps/ROOT# ls -al
total 28532
drwxr-xr-x 10 root root 4096 Jan 1 2000 .
drwxr-xr-x 7 root root 4096 May 14 2009 …
drwxr-xr-x 12 root root 4096 Dec 19 15:52 WEB-INF
drwxr-xr-x 3 root root 4096 Dec 19 15:52 audio
drwxr-xr-x 3 root root 4096 Jan 1 2000 backup
-rw-r–r-- 1 root root 6619 Mar 6 2011 customViewExample.jsp
drwxr-xr-x 2 root root 4096 Dec 19 15:52 exception
drwxr-xr-x 18 root root 4096 Dec 18 23:34 graphics
drwxr-xr-x 3 root root 4096 Dec 19 15:52 images
-rw-r–r-- 1 root root 1712 Mar 6 2011 index.jsp
-rw-r–r-- 1 root root 29117044 Dec 19 15:52 mango-1.13.0.zip
drwxr-xr-x 3 root root 4096 Dec 19 15:52 resources
-rw-r–r-- 1 root root 2436 Mar 6 2011 soundmanager2.swf
-rw-r–r-- 1 root root 8119 Mar 6 2011 soundmanager2_flash9.swf
drwxr-xr-x 2 root root 4096 Jan 19 12:15 uploads

If this is your output to you are almost finish the instalation.
In my case In using an arduino to comunicate to outside world via USB port.In this case I need to include a file on java dir to be able to comunicate with serial ports (“dev/ttyUSB0 in my case”)
If this is also your case lets just download the librxtxSerial.so and import it:
$wget http://mango.serotoninsoftware.com/downloads/librxtxSerial.so
Now we need to save in <jdk1.6-home>/jre/lib/i386
To find this location on your instalation just use:
$updatedb
$locate /jre/lib/i386
This will display the path of you java, now lets move the librxtxSerial.so to that location.Im my case it was:
$mv librxtxSerial.so /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/

It’s everything done
Lets start the Tomcat and test it on your alix Board
$cd /usr/local/tomcat/bin
$./startup.sh

In the first run the system will build the MANGO database soo it can take a while until the page loads.
It could take about 40 secounds soo be patient
When the page loads just enter the default login :admin admin and your MANGO small box is ready!!

I hope this tuturial help those you want to test it on a alix board.
I not a linux expert then it is possible to some steps could be wrong and could be a better way to do it.
This manual can be modified to get better and sugestions are acepted

email:hugo.santos@i9box.net

Thanks!

This is a great tutorial.