-
Notifications
You must be signed in to change notification settings - Fork 44
Step by step installation
WARNING: this page is completely out-dated and should not be used anymore for installing GSN. Please refer to the readme file in the repository for further indications.
!!! Needs to be updated !!!
The following steps illustrate how to install GSN on a Linux host with a MySQL database. This installation requires, in addition to Sun's JDK 1.6, the following Linux packages :
- Apache ant
- MySQL server
- Subversion
(adapted from here)
GSN requires Sun's JDK 1.6. It won't work with OpenJDK, which ships with Ubuntu. It won't work neither with Sun's JDK 1.7 as some modules in GSN are not compatible with this new version.
1.1. Download the binary file from here. If you have a 32-bit Ubuntu, take this file jdk-6u37-linux-i586.bin
. On a 64-bit Ubuntu, you should use this one jdk-6u37-linux-x64.bin
.
1.2. Make the file executable and run it in order to extract its content to the current folder:
chmod +x jdk-6u37-linux-i586.bin
./jdk-6u37-linux-i586.bin
1.3. Move extracted folder to this location:
sudo mv jdk1.6.0_37 /usr/lib/jvm/
1.4. Install the new Java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_37/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_37/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_37/bin/javaws 1
1.5. Choose default Java:
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
1.6. Check the Java version:
java -version
You should get something like:
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) Client VM (build 20.12-b01, mixed mode, sharing)
1.7. Verify the symlinks all point to the new Java location:
ls -la /etc/alternatives/java*
You should get something like:
lrwxrwxrwx 1 root root 33 Dec 7 14:40 /etc/alternatives/java -> /usr/lib/jvm/jdk1.6.0_37/bin/java
lrwxrwxrwx 1 root root 34 Dec 7 14:39 /etc/alternatives/javac -> /usr/lib/jvm/jdk1.6.0_37/bin/javac
lrwxrwxrwx 1 root root 35 Dec 7 14:41 /etc/alternatives/javaws -> /usr/lib/jvm/jdk1.6.0_37/bin/javaws
Subversion is needed if you want to download GSN from the SVN repository.
sudo apt-get install subversion
MySQL server is installed by default in Ubuntu 12.04 LTS. If you need to install it manually, run the following command from a terminal prompt:
sudo apt-get install mysql-server
During the installation process you will be prompted to enter a password for the MySQL root user.
Once the installation is complete, the MySQL server should be started automatically. You can run the following command from a terminal prompt to check whether the MySQL server is running:
sudo netstat -tap | grep mysql
When you run this command, you should see the following line or something similar:
tcp 0 0 localhost:mysql *:* LISTEN 2556/mysqld
If the server is not running correctly, you can type the following command to start it:
sudo service mysql restart
Then, you need to create a database for GSN. for this you need to login as root on your MySQL server. If MySQL was installed by default, you won't need a password:
mysql -u root
If a password is required, use the extra switch -p:
mysql -u root -p
Enter password:*******
Now that you are logged in, you can create a database called 'gsn' (you can choose any other name):
mysql> create database gsn;
Query OK, 1 row affected (0.00 sec)
We allow user 'gsn' to connect to the server from localhost using the password 'gsnpassword':
mysql> grant usage on *.* to gsn@localhost identified by ‘gsnpassword’;
Query OK, 0 rows affected (0.00 sec)
And finally we grant all privileges on the 'gsn' database to this user:
mysql> grant all privileges on gsn.* to gsn@localhost ;
Query OK, 0 rows affected (0.00 sec)
Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other.
sudo apt-get install ant
The following command will install the lastest release of GSN to the 'gsn' folder:
svn co http://gsn.svn.sourceforge.net/svnroot/gsn/trunk gsn
By default, GSN uses the H2 database engine to store sensor data. In order to use MySQL, you need to change the parameters in the file conf/gsn.xml.
The H2 database is identified by this line:
<storage user="sa" password="" driver="org.h2.Driver" url="jdbc:h2:file:MyFile"/>
You have to comment the previous line and uncomment the one with MySQL, like this:
<!-- <storage user="sa" password="" driver="org.h2.Driver" url="jdbc:h2:file:MyFile"/> -->
<storage user="root" password="" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/gsn" />
In the line describing the MySQL connection, replace the user and password with the ones you created:
<!-- <storage user="sa" password="" driver="org.h2.Driver" url="jdbc:h2:file:MyFile"/> -->
<storage user="gsn" password="gsnpassword" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/gsn" />
GSN can be controlled through the ant tool through tasks defined in the file 'build.xml'. The main ant tasks available are :
- build Compiles the GSN source code.
- gsn Starts the GSN server.
- restart Stops any running GSN server and starts it again.
- stop Stops the currently runing GSN server.
- jar Creates a jar le from the source.
- clean Removes the current built files and forces a rebuild.
- cleandb Removes the redundant tables which are create for holding GSN’s internal states.
- eval-queries Evaluate the GSN throughput by generating random /multidata queries.
To run any of the aforementioned ant tasks simply write:
ant [task name]
For example, to start gsn, run the following:
ant gsn
In order to stop gsn, run the following command:
ant stop
In order to deploy your first virtual sensor, you need to put a virtual sensor description file (in XML) in the 'virtual-sensors' folder. GSN comes with sample virtual sensor description files in the samples folder (virtual-sensors/samples).
For example, you can deploy the 'memoryData' virtual sensor, which calulates the available memory by copying its description file to the appropriate folder. In GSN's main folder, run the following:
cp virtual-sensors/samples/memoryDataVS.xml virtual-sensors
GSN will detect the newly added virtual sensor, load it and deploy it.