The setup script
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 automating 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 a person other than the one installing OpenCms.
- You want to automate 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 the 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.
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 on a separate line and written as
The keys that should be set are handled by the class org.opencms.setup.CmsAutoSetupProperties
and are 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=