My goal was to set up the latest JBoss version (7.1) and MySQL 5.5 working together. Specifically using a datasource. The installation of JBoss was more troublesome than expected, since you find many tutorial of older versions. Unfortunately, the configuration completely changed.
Installing MySQL 5.5
The installation itself is rather easy on Ubuntu (if you are happy with the version in the repository)
sudo apt-get install mysql-server
This will install mysql and also create a service, that can be started using
sudo etc/init.d/mysql start
To configure your installation specifically to your needs, modify the my.cnf located under
To make MySql reachable outside from your machine, you will need to replace the following line
#bind-address = 127.0.0.1
#bind-address = 0.0.0.0
Otherwise MySql will ONLY be reachable from localhost. This is fine, if you plan to run everything on your local machine (like JBoss and have a local database management tool installed like phpmyadmin).
Installing JBoss 7.1
This task seems so easy but since the configuration completely changed from last version, there are many false information on the net.
First download Jboss 7.1 and unzip it in your favourite directory. I used /opt/jboss71. So you will need to be root.
sudo mkdir /opt/jboss71
sudo unzip /home/youruser/downloads/jboss-as-7.1.1.Final.zip /opt/jboss71/
Now if we want to avoid running jboss as a root user, we must create a new user and a corresponding group. Finally, we will give him the ownership of the jboss folder.
useradd -s /bin/bash -g jboss jboss
chown -R jboss:jboss /opt/jboss71
The final step is to create an init script. I haven’t found a satisfying solution as it highly depends on the distribution. You will find many scripts in the internet, which may or may not work on your distribution. Eventually I used one I found on stackoverflow. The starting works completely fine, though the shut down not at all.
So create a textfile named jboss in your jboss folder with the contents from this post and make it executable. Afterwards copy it to /etc/init.d as root user. Lastly, we will add it to upstart so that we don’t need to think about starting jboss each time.
(Insert script from this <a href="http://stackoverflow.com/questions/6880902/start-jboss-7-as-a-service-on-linux" target="_blank">post</a>)
chmod +x jboss
sudo cp jboss /etc/init.d/jboss
sudo update-rc.d jboss defaults
You can now launch your jboss by typing
Making JBoss accessible from outside your machine
If you are running the standalone config, modify the respective configuration file and replace the ip address on the public interface with 0.0.0.0
Please refer to this post.