Installing MySQL & Tomcat on Ubuntu Linux

Installing MySQL

Full instructions regarding the install and running of MySQL can be found at the MySQL home page. MySQL is a very widely used database and you should find many, many resources online.

In ubuntu, to install MySQL

$ sudo apt-get install mysql-server

During the installation process you will be asked to set a root password. For your own security:

  1. do not leave this blank
  2. do not set this to be the same as your computer’s user or root password
  3. make the password secure and keep if safe

Once installed, to access mysql type

$ mysql -u root -p

you will be prompted for your root password that you set during installation and you will then enter the mysql command line environment where you will be able to use commands to administer your mysql databases.

Installing Tomcat

Again, full instructions can be found on the apache tomcat website On Ubuntu, Tomcat and the Tomcat Web Application Manager (useful if you’re not a fan of the command line) can be installed as follows:

$ sudo apt-get install tomcat6 tomcat6-admin

To use the Web Application Manager you will need to set-up a user to do this.

Browse to tomcat6 conf directory
$ cd /var/lib/tomcat6/conf
Edit the file tomcat-users.xml (you need to be root to do this on a default Ubuntu installation)
$ sudo nano -w tomcat-users.xml
Modify the file so it looks like this (replacing TOMCATUSER and PASSWORD for your own secure choices):

<role rolename=”manager”/>
<user username=”TOMCATUSER” password=”PASSWORD” roles=”manager”/>

On Ubuntu (this may vary by distribution), once tomcat is installed via the package manager apt (method described above), then you can access all the required folders through the folder /var/lib/tomcat

  1. Tomcat logs (If you’re having problems you may be asked for output from files in this folder) – /var/lib/tomcat6/logs -> /var/log/tomcat6
  2. Tomcat configuration (Find files to configure custom aspects of your tomcat setup such as custom port configuration) – /var/lib/tomcat6/conf -> /etc/tomcat6
  3. Tomcat webapps directory (The directory where all your web applications live, including openXdata) – /var/lib/tomcat6/webapps

On Ubuntu to start and stop tomcat you will need sudoer privileges and the commands are:

To start tomcat
$ sudo /etc/init.d/tomcat6 start
To stop tomcat
$ sudo /etc/init.d/tomcat6 stop
To restart tomcat
$ sudo /etc/init.d/tomcat6 restart

If you do a manual installation by downloading the tomcat zip file from the tomcat website, when you unzip it all the the folders listed above will be found in whichever location you extract your zip file. To start/stop/restart tomcat from a manual installation use /path/to/tomcatfolder/bin and then and e.g.

$ cd /home/myhome/tomcat/bin
$ ./