Installing the standalone distribution of Archiva is quite simple - for an example, see the Quick Start guide.
However, the best way to use this installation technique is to separate the configuration from the installation to make it easy to upgrade to newer versions in the future.
Archiva can be run by executing:
There is an issue with regard to the version of tr installed/used by default on Solaris so you might encounter a series of Bad String errors when you run the Archiva binaries in Solaris. You need to use a different version of tr in order to get it to work. See MRM-1467 for more details.
NOTE: since 1.4-M3 Archiva is now available on / (ROOT) context.
If you want to use an other context path, you must edit the file in contexts/archiva.xml
<Configure class="org.eclipse.jetty.webapp.WebAppContext"> <!-- contextPath used --> <Set name="contextPath">/</Set> <Set name="war"><SystemProperty name="jetty.home" default="."/>/apps/archiva</Set> <Set name="extractWAR">false</Set> <Set name="copyWebDir">false</Set> </Configure>
On Linux, the bin/archiva script is suitable for linking or copying to /etc/init.d/archiva and running as root, as long as the RUN_AS_USER environment variable is set within the script. This will allow you to start and stop the service with:
$ service archiva start $ service archiva stop
The startup script is enabled to chkconfig. Run the following as root:
$ chkconfig --add archiva $ chkconfig archiva on
On Windows, to use the start and stop commands you must first install it as a service. This is done by running:
You can then use the start and stop commands as well as the traditional Windows service management console to manage the Archiva service.
This procedure installs the service to run as the local system user. You must ensure that it has access to read the installation, and to write to the logs and data directories.
Note on last Windows version, you need to configure correctly path to your java executable. In wrapper.conf file:
wrapper.java.command=fullpath to your java executable
You can later remove the service with:
On OS X, you can use launchd to run a service. Create the following as root in /Library/LaunchDaemons/org.apache.archiva.plist:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.apache.archiva</string> <key>ProgramArguments</key> <array> <string>/Applications/Archiva/apache-archiva-1.4-M4-SNAPSHOT/bin/archiva</string> <string>console</string> </array> <key>Disabled</key> <false/> <key>RunAtLoad</key> <true/> <key>UserName</key> <string>archiva</string> <key>StandardOutPath</key> <string>/Applications/Archiva/apache-archiva-1.4-M4-SNAPSHOT/logs/launchd.log</string> <!-- Optional - store data separate from installation (see below) --> <key>EnvironmentVariables</key> <dict> <key>ARCHIVA_BASE</key> <string>/Users/archiva/Library/Archiva</string> </dict> <!-- Optional: force it to keep running <key>KeepAlive</key> <true/> --> </dict> </plist>
To install the service, run the following:
$ sudo chown root:wheel /Library/LaunchDaemons/org.apache.archiva.plist $ sudo launchctl load -w /Library/LaunchDaemons/org.apache.archiva.plist
Start and stop the service with:
$ sudo launchctl start org.apache.archiva.plist $ sudo launchctl stop org.apache.archiva.plist
To uninstall the service:
$ sudo launchctl unload -w /Library/LaunchDaemons/org.apache.archiva.plist
The standalone installation of Archiva is capable of separating its configuration from installation in much the same way Tomcat does.
This is achieved by the following steps:
Archiva's configuration is loaded from the following files, in order of precedence:
When Archiva saves its configuration, all configuration is stored in a single file. The file chosen is by the following rules:
The configuration will never be saved in the Archiva installation directory if you are using a separate base directory.
Note that the configuration can be edited, but only when Archiva is not running as it will not reload a changed configuration file, and will save over it if something is changed in the web interface.
By default, Archiva uses embedded Apache Derby to store the user information. It can be configured to use an external database by providing a JDBC driver and editing the jetty.xml file.
Find lines with: wrapper.java.classpath.x=%REPO_DIR%/tomcat-juli-7.0.34.jar Add one wrapper.java.classpath.x+1=%REPO_DIR%/yourjdbcdriver.jar
The example below uses Mysql for the database server. You can take a look at Archiva with MySQL for more details.
<!-- omitted xml --> <!-- Users / Security Database --> <New id="users" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg>jdbc/users</Arg> <Arg> <New class="org.apache.tomcat.jdbc.pool.DataSource"> <Set name="driverClassName">com.mysql.jdbc.Driver</Set> <Set name="url">jdbc:mysql://localhost/archiva</Set> <Set name="username"></Set> <Set name="password"></Set> <Set name="initialSize">15</Set> <!-- depends on your concurrent users numbers --> <Set name="maxActive">30</Set> <Set name="maxWait">10000</Set> <Set name="removeAbandoned">true</Set> <Set name="logAbandoned">true</Set> <Set name="removeAbandonedTimeout">10000</Set> <Set name="testOnBorrow">true</Set> <!-- very rigourous sql query validation --> <Set name="validationQuery">select 1</Set> </New> </Arg> </New> <!-- omitted xml -->
More information about using Derby Network Server as an external user database for Archiva can be found on the wiki: Archiva User DB on Derby Network Server
If you use Puppet to manage your infrastructure, you can use a third-party Puppet module to install Archiva. This will take care of adding the required users, databases and configuration based on official release tarballs.