CopyDisable

Thursday 1 November 2012

Installing Artifactory 2.3.3 with Tomcat and MySQL

 

Download Tomcat 6

# wget http://apache.techartifact.com/mirror/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.zip

 

Download Artifactory from http://sourceforge.net/projects/artifactory/files/artifactory/

 

Extract Tomcat to /opt/tomcat/artifactory (this is the default location specified by the Artifactory Tomcat installation script, we can change the location as per our convenience but for that we have to change the tomcat location in the installation script)

# unzip apache-tomcat-6.0.36.zip

# mkdir /opt/tomcat

# mv apache-tomcat-6.0.36 /opt/tomcat/artifactory

 

Extract Artifactory into /opt/artifactory/current (this is the default location specified by the Artifactory Tomcat installation script, we can change the location as per our convenience but for that we have to change the Artifactory location in the installation script)

# unzip artifactory-2.3.3.1.zip

# mkdir /opt/artifactory

# mv artifactory-2.3.3.1 /opt/artifactory/current

 

Run the Artifactory tomcat installation script

# /opt/artifactory/current/bin/tomcat-install.sh

image

 

Login to MySQL server with sufficient privileges and create the MySQL database for Artifactory and the database user.

mysql> create database artifactory character set utf8;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on artifactory.* TO 'artifactory'@'localhost' identified by 'artifactory';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Edit the artifactory.system.properties file

# pico /opt/artifactory/current/etc/artifactory.system.properties

Add (this line may be already there, just have to uncomment it) the following line

artifactory.jcr.configDir=repo/filesystem-mysql

image

This configuration keeps all artifacts information in MySQL and stores the artifact binary data on the file system. This is the recommended configuration.

 

Edit the repo.xml file for filesystem-mysql and add the mysql connection details

# pico /opt/artifactory/current/etc/repo/filesystem-mysql/repo.xml

 

image

 

Download the MySQL JDBC driver (e.g. mysql-connector-java-5.1.22.zip file) from http://dev.mysql.com/downloads/connector/j/

Extract the zip file

# unzip mysql-connector-java-5.1.22.zip

# cd mysql-connector-java-5.1.22

Copy it to Artifactory tomcat’s lib folder

# cp mysql-connector-java-5.1.22-bin.jar /opt/tomcat/artifactory/lib/

 

Note: If you forget to copy this file, you may see the following error when you try to access Artifactory using a web browser.

image

 

Start Artifactory

# service artifactory start

We may get the following error while starting, even though we have correct value for $JAVA_HOME:

Starting tomcat...
Using ARTIFACTORY_HOME: /opt/artifactory/current
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
ERROR: Artifactory Tomcat server did not start. Please check the logs

image

 

In this case open the /etc/artifactory/default file and uncomment the export JAVA_HOME line and add the correct JAVA_HOME value

image

 

 

We may also get the following error message while starting Artifactory service:

touch: cannot touch `/var/lock/subsys/artifactory': No such file or directory

Just create the subsys directory inside the /var/lock directory to resolve it.

# mkdir /var/lock/subsys

 

If everything is OK, our Artifactory service will start successfully.

image

 

image

 

That’s it, installation is pretty simple and well documented. Hot smile

1 comment:

Unknown said...

Thanks for this great article. It helped me fix 'undefined JAVA_HOME' error(though I has defined the varible in environment). This is a great help.

Post a Comment