OpenCms from Alkacon Software is a professional, easy to use website content management system. OpenCms helps content managers worldwide to create and maintain beautiful websites fast and efficiently. Today we will show you how to install OpenCms on an Ubuntu 16.04 VPS using Tomcat and a MySQL database. The installation process should take about 10-20 minutes if you follow the very easy steps described below.
Log in to your Ubuntu 16.04 VPS via SSH as user root:
ssh root@IP_address
and start a new screen session
screen -U -S opencms
To update all packages installed on your server run the following command on the terminal:
apt-get update && apt-get upgrade
Install JAVA and Tomcat
In order to run Tomcat server, Java has to be installed on the VPS. Execute the following command to install the Java Development Kit package (JDK):
apt-get install default-jdk
Once the installation is complete, you can check if Java is installed on your server using the command below:
java -version
If you receive an output similar to the one below, the installation is successful:
openjdk version "1.8.0_111" OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14) OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)
Once Java is installed on the server, we will proceed to install Tomcat 9.
For security reasons it is not recommended to run Tomcat as user root, so we will create a new system user:
useradd -r tomcat9 --shell /bin/false
Change the current working directory to /opt and download the latest Tomcat 9 release to the /opt directory on your server. At the moment of writing this tutorial, Tomcat version 9.0.0.M6 is the latest one. You could go to Tomcat’s official website and check if there is a newer version available.
cd /opt wget http://mirror.symnds.com/software/Apache/tomcat/tomcat-9/v9.0.0.M15/bin/apache-tomcat-9.0.0.M15.tar.gz
Extract the content of the ‘apache-tomcat-9.0.0.M15.tar.gz’ tarball archive:
tar -zxf apache-tomcat-9.0.0.M15.tar.gz
Create a symbolic link of the Tomcat directory to /opt/tomcat-latest and set the appropriate ownership:
ln -s apache-tomcat-9.0.0.M15 tomcat-latest chown -hR tomcat9: tomcat-latest apache-tomcat-9.0.0.M15
Tomcat can be started, stopped and restarted using the bash scripts located in the /opt/tomcat-latest/bin directory or even better, we will create a systemd init file for that purpose:
nano /etc/systemd/system/tomcat.service
and add the following content to the file
[Unit] Description=Tomcat9 After=network.target [Service] Type=forking User=tomcat9 Group=tomcat9 Environment=CATALINA_PID=/opt/tomcat-latest/tomcat9.pid Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 Environment=CATALINA_HOME=/opt/tomcat-latest Environment=CATALINA_BASE=/opt/tomcat-latest Environment="CATALINA_OPTS=-Xms512m -Xmx512m" Environment="JAVA_OPTS=-Dfile.encoding=UTF-8 -Dnet.sf.ehcache.skipUpdateCheck=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC" ExecStart=/opt/tomcat-latest/bin/startup.sh ExecStop=/opt/tomcat-latest/bin/shutdown.sh [Install] WantedBy=multi-user.target
Save the file, reload the systemd daemon, start the Tomcat server and enable it to start on boot
systemctl daemon-reload systemctl start tomcat systemctl enable tomcat
Finally, if you closely followed the instructions in this tutorial you will be able to access Tomcat by navigating your favorite web browser to http://your_server_IP:8080
Install MariaDB
To install MariaDB, run the following command:
[user]$ sudo apt-get install -y mariadb-server
Next, we need to create a database for our OpenCms installation.
[user]$ mysql -u root -p MariaDB [(none)]> CREATE DATABASE opencms; MariaDB [(none)]> GRANT ALL PRIVILEGES ON oepncms.* TO 'opencmsuser'@'localhost' IDENTIFIED BY 'your-password'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> \q
Do not forget to replace ‘your-password’ with a strong password.
Increase the max_allowed_packet variable to 64MB by editing this line in the ‘/etc/mysql/mysql.conf.d/mysqld.cnf’ configuration file:
max_allowed_packet = 64M
Deploy the opencms.war file
Install OpenCms
Go to the OpenCms official website, download and extract the latest release of their application on your server:
cd /opt && wget http://www.opencms.org/downloads/opencms/opencms-10.5.0.zip unzip opencms-10.5.0.zip mv opencms.war /opt/tomcat-latest/webapps/ chown tomcat9:tomcat9 /opt/tomcat-latest/webapps/opencms.war
Restart the Tomcat service:
systemctl restart tomcat
Install OpenCms using the Setup-Wizard. Open your favorite web browser, navigate to http://your-server-ip-address:8080/opencms/setup and if you configured everything correctly the OpenCms installer should be starting. You should follow the easy instructions on the install screen inserting the necessary information as requested.
That is it. The OpenCms installation is now complete.
You can login using the username: Admin and password: admin. Please change the password as soon as possible. The login URL of OpenCms is set to: http://your-server-ip-address:8080/opencms/opencms/system/login/ by default.
Of course, you don’t have to do any of this if you use one of our Linux Cloud VPS Hosting services, in which case you can simply ask our expert Linux admins to install OpenCms for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.