Apache Archiva 5 min install


Apache Archiva is a quick and easy solution to set up your own repository management server. In this example I use CentOS 6.x for my OS.

How To Install / Configure:

Start by downloading the standalone version of Archiva. I suggest placing it in the opt directory for reasons listed.

cd /opt
wget http://mirror.cc.columbia.edu/pub/software/apache/archiva/2.0.1/binaries/apache-archiva-2.0.1-bin.tar.gz
tar -xvf apache-archiva-2.0.1-bin.tar.gz

Now you need to specify the port for Archiva to run on. The default port is 8080 which can cause conflicts if you are using Tomcat which also defaults to 8080. I have changed the port to 8081.



Now at this point Archiva is ready to run. You can start Archiva by the following command.

/opt/apache-archiva-2.0.1/bin/archiva start

Archiva can now be accessed by going to http://localhost:8081/ in your browser. A simple GUI will allow you to setup administrative privileges.

Running as a service script

The above installation is great but begs for better integration with CentOS. On Linux, the bin/archiva script is suitable for linking from the /etc/init.d/ directory. Creating a custom service script in this directory will allow you to start / stop / restart Archiva easily. This directory is used to control services within the OS.

Start by creating the archiva service file

vim /etc/init.d/archiva
chmod 0777 archiva

I have chmod the archiva file so we can execute it as root. Then add the file the script below:

# Simple service script for Apache Archiva
# chkconfig: 35 20 80
# description: Archiva 2.0.1


case "$1" in
${ARCHIVA_PATH}/archiva start
${ARCHIVA_PATH}/archiva stop
${ARCHIVA_PATH}/archiva status
${ARCHIVA_PATH}/archiva restart
echo $"Usage: $0 {start|stop|status|restart}"
exit 1

Test the service script above by running the following commands. It should gracefully control the service.

service archiva start
service archiva stop

I don’t like to have to start archiva everytime I restart my server. Add Archiva to the chkconfig so it will automatically start on restart.

chkconfig --add archiva
chkconfig archiva on

Apache Archiva 2.0.1 is now installed on CentOS.

Leave a Reply

Your email address will not be published.