Setting up Confluence 3 with MySQL on Ubuntu Linux Server
I recently had to set up Confluence 3.0 for work on a Ubuntu Server. The database of choice for our environment was MySQL 5.x. Below are the steps I took to get everything setup and configured. Before you begin, make sure you have the Java Development Kit (JDK 1.5 or later) installed and MySQL 5.x.
Download the latest Confluence 3.0 TAR.GZ Archive from here.
Go to where you’ve downloaded the archive and extact it. In my case, I’ve downloaded it to where I have all my apps installed to which is /opt:
tar zxvf confluence-<archive-version>.tar.gz
A new folder will appear with the same name as the original tar.gz file. Rename the folder to ‘confluence’:
mv confluence-<archive-version> confluence
Change into /opt/confluence:
cd /opt/confluence
There are a couple of files I modified in order to suit the needs of my environment. Confluence 3.0 will be the only service running on this Ubuntu Server, so I will change the Web port to 80. It defaults to 8080 if you don’t modify anything. The file to modify is located in conf/server.xml.
Find the line section:
<Connector className=”org.apache.coyote.tomcat4.CoyoteConnector” port=”8080″ inProcessors=”5″
change port to:
<Connector className=”org.apache.coyote.tomcat4.CoyoteConnector” port=”80″ minProcessors=”5″
Next I will change the home folder for my Confluence installation. The file to modify is located in confluence/WEB-INF/classes/confluence-init.properties. Locate the section for Unix users and set your home directory for confluence:
confluence.home=/opt/confluence
Now we need to configure MySQL 5.x. Note that you will need the MySQL Connector/J driver, version 5.1 or newer. You want the JDBC Drive for MySQL (Connector/J). There’s a JAR file located within the archive from the download. It needs to be placed into /opt/confluence/lib. Connect to MySQL as root:
mysql -uroot -p
Create the Confluence database with UTF8 support:
CREATE DATABASE conf3 CHARACTER SET utf8 COLLATE utf8_general_ci;
Create Confluence user with rights to the database:
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on conf3.* TO ‘confluenceuser’@'localhost’ IDENTIFIED BY ‘password’;
Commit the changes and quit:
flush privileges;
quit
Confluence is now ready to be started and MySQL has been prepped to be used as the Database host. We can now startup the Confluence service:
/opt/confluence/bin/startup.sh
You can connect to Confluence from your web browser at http://locahost or http://<hostname>
Follow through the setup wizard to request your evaluation license. During the setup, be sure to choose ‘Custom Installation” and “External Database” for the options. Note to select MySQL for your External Database and in the next screen, click on “Direct JDBC” button.
Append “&useUnicode=true&characterEncoding=utf8” to the connection string (without the quotes). Fill in the logon details for the username and password that was created earlier and click Next. the rest is pretty self-explanatory
That’s it! Enjoy your new Confluence 3.0 installation.
January 20, 2010 at 12:13 pm
This part isn’t correct.
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on confluence.* TO ‘confluenceuser’@’localhost’ IDENTIFIED BY ‘password’;
You created a database called “conf3″ but then you create a user with privileges for the database ‘confluence’.
January 20, 2010 at 4:12 pm
Graham: You’re absolutely right, “confluence” should be replaced with “conf3″.