OpenCms can be installed automatically. Parameters used in the installation are provided via a config file and then an Java program shipped with OpenCms sets up OpenCms. Here you learn how to set up OpenCms using the auto-setup.

Why using the auto-setup?

You always have the choice between using the setup wizard or the auto-setup. While the wizard provides a convenient way to setup OpenCms using a graphical interface, the auto-setup allows automatizing the setup.

Here are some situations when the auto-setup is preferable:

  • OpenCms should be installed on a server where you cannot access the setup wizard via a browser.
  • You want to use the same configuration more than once.
  • The configuration is provided by another person than the one installing OpenCms.
  • You want to automatize the complete server setup, integrating OpenCms installation in a larger script.

Starting the auto-setup

To start the auto-setup, you must have installed Tomcat and deployed OpenCms on it. If so, just run:

java -classpath "$OPENCMS/WEB-INF/lib/*:$OPENCMS/WEB-INF/classes:/usr/share/tomcat7/lib/*"\
org.opencms.setup.CmsAutoSetup\
-path $CONFIG_FILE

In the command we use the variables

  • $OPENCMS for the path to OpenCms' web-app root folder. For example, on an Ubuntu Server (14.04) where Tomcat is installed via the repository and OpenCms is deployed as ROOT app, the path would be /var/libs/tomcat7/webapps/ROOT/.
  • $CONFIG_FILE for the path to the configuration file used by the auto-setup.
Executing the auto-setup may take some time. At least when it comes to the modules import it will take some time until you get a status update from the setup programm. Just wait.

The configuration file

In the configuration file, you provide parameters for all the settings otherwise entered when running the setup wizard. In particular, you specify which components of OpenCms should be installed, how OpenCms connects to a database and how the installation is reached on your server.

The configuration file is a simple text file with key-value pairs, each at a separate line and written as

key=value

The keys that should be set handled by the class org.opencms.setup.CmsAutoSetupProperties and all explained in the class' JavaDoc.

Here, we only provide an example configuration file.

setup.webapp.path=/var/lib/tomcat7/webapps/opencms
setup.default.webapp=ROOT
setup.install.components=workplace,releasenotes,template3,devdemo,bootstrap

db.product=mysql
db.provider=mysql
db.create.user=root
db.create.pwd=password
db.worker.user=root
db.worker.pwd=password
db.connection.url=jdbc:mysql://localhost:3306/
db.name=db_opencms
db.create.db=true
db.create.tables=true
db.dropDb=true
db.default.tablespace=
db.index.tablespace=
db.jdbc.driver=org.gjt.mm.mysql.Driver
db.template.db=
db.temporary.tablespace=

server.url=http://ci-9-5-x
server.name=CI-9-5-X
server.ethernet.address=
server.servlet.mapping=
Note that all configurations can be overwritten by Java system properties. The setting for setup.install.components can also be overwritten by an environment variable.