Magnolia CMS: Installation Guide

Stephen DharmaStephen Dharma
5 min read

This tutorial will guide you through installing Magnolia CMS, specifically using Magnolia version 6.2. Magnolia is an enterprise digital experience platform (DXP), that began as an open-source content management system (CMS) and is based on Content Repository for Java (JCR). The JCR specification was developed under the Java Community Process as JSR-170 and JSR-283. Magnolia was founded in 1997 and is headquartered in Basel, Switzerland.


A. Installation Preparation

If Node.js, npm, and Java (JRE SE, On Windows the JDK is required) are already installed on your computer, you can jump directly to A.3. Installing Magnolia CLI.

A.1. Get Java

Download Java from the official website or OpenJDK website.

Magnolia needs at least a Java Runtime Environment (JRE) (minimum Java 8) to run. Check if there’s a version of Java already installed on your computer by opening the terminal or command prompt and typing java -version in a terminal or command prompt. If the system reports a version number, Java is installed on your computer.

$ java -version
java version "11.0.15.1" 2022-04-22 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.15.1+2-LTS-10)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.15.1+2-LTS-10, mixed mode)

A.2. Get Node.js and npm

Magnolia CLI runs on Node.js and npm (Node Package Manager). Use the following two shell commands to check that we have both of them installed:

node -v

npm -v

A.3. Installing Magnolia CLI

Magnolia CLI is an npm package which provides a Command Line Intercare (CLI) tool to set up and facilitate light development in Magnolia CMS. Run the following command in a shell to install Magnolia CLI:

cd ~/W/Workspace-Magnolia/
sudo npm install @magnolia/cli -g

Note: Depending on your permissions and the location where you have installed Node.js, you may have to execute the command above with root permissions. Without installation permissions, you will notice messages such as npm ERR! in the shell.

If the installation is successful, we will see the following or a similar output in the shell:

$ sudo npm install @magnolia/cli -g
Password:

...
added 147 packages, removed 199 packages, and changed 129 packages in 1m
22 packages are looking for funding
  run `npm fund` for details

Once we have installed Magnolia CLI, test the installation by running the following command in the shell:

$ mgnl -v
Magnolia CLI: 4.0.5 (node.js: v20.5.1)

B. Magnolia Installation

B.1. Downloading Magnolia

Let’s assume that the directory where we intend to download and install Magnolia is called magnolia-demo (this will be referred as <MAGNOLIA_HOME> later).

  1. Change directory to magnolia directory. cd ~/W/Workspace-Magnolia/magnolia-demo/

  2. Start Magnolia installation (use version 6.2.x). With <version> we may specify the Magnolia release we wish to download (e.g. 6.2.56).
    mgnl jumpstart -m <version>

  3. Choose 2) magnolia-community-webapp or 3) magnolia-community-demo-webapp.
$ mgnl jumpstart -m 6.2.56
? What Magnolia would you like to install?
1) magnolia-empty-webapp
2) magnolia-community-webapp
3) magnolia-community-demo-webapp
4) magnolia-dx-core-webapp
5) magnolia-dx-core-demo-webapp
Answer: 2

The jumpstart command:

  • Downloads the Magnolia bundle specified into the magnolia-demo directory.

  • Creates a light-modules folder in the directory.

  • Changes the default value of the magnolia.resources.dir configuration property from ${magnolia.home}/modules to /magnolia/light-modules for both the Author and the Public instances of Magnolia.

Once the installation has finished, we will see an output similar to this on our console:

...
info Magnolia has been successfully setup for light development!
info You can now open a new terminal tab or window and start it up with the CLI command 'mgnl start'
info Magnolia will be ready after a few seconds at localhost:8080/magnoliaAuthor. Username and password is superuser
...

B.2. Starting Magnolia

In the parent directory of light-modules (e.g. ~/W/Workspace-Magnolia/magnolia-demo), use the following command:

mgnl start

Response:

$ mgnl start
...
24-Aug-2023 04:25:50.270 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [~/W/Workspace-Magnolia/magnolia-demo/apache-tomcat/webapps/magnoliaPublic] has finished in [88,527] ms
24-Aug-2023 04:25:50.280 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
24-Aug-2023 04:25:50.335 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [171520] milliseconds
...

The command installs and starts Magnolia. This is complete when you see a message like Server startup in ... ms. You can then access the UI of the Author instance.

B.3. Login into Magnolia Author instance

Go to http://localhost:8080/magnoliaAuthor and login to the Author instance with the default account (don't forget to change the default password after login):

  • Username: superuser

  • Password: (default password is the same as username)

When you login, the first page you see is the App Launcher, in which you can see groups of apps.

Congratulations, Magnolia is now installed and running.


B.4. (Optional) Start Magnolia using Tomcat command

This is an alternative way to start Magnolia. Go to the magnolia-x.y/apache-tomcat-x.y/bin directory and type:
./magnolia_control.sh start

Note: If you get an error due to a low “max open files” limit, try executing the command with the --ignore-open-files-limit option:
./magnolia_control.sh start --ignore-open-files-limit

Magnolia reports startup information. If startup fails, look for the reason in the report. In a successful startup, the last line reads: INFO: Server startup in ... ms.

$ cd ~/W/Workspace-Magnolia/magnolia-demo/
...
$ ./apache-tomcat/bin/magnolia_control.sh start --ignore-open-files-limit
...
$ tail -f ./apache-tomcat/logs/catalina.out

B.5. (Optional) Stop Magnolia using Tomcat command

This is an alternative way to stop Magnolia. Go to the magnolia-x.y/apache-tomcat-x.y/bin directory and type:
./magnolia_control.sh stop

$ ./apache-tomcat/bin/magnolia_control.sh stop
...

C. Configurations

C.1. (Optional) Enable IP Address access

Allow IP-based access for Tomcat in the server.xml configuration file, by default it's disabled for some versions. Modify the <MAGNOLIA_HOME>/apache-tomcat/conf/server.xml file:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
               relaxedQueryChars="[]|" />

to:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
               address="0.0.0.0"
               relaxedQueryChars="[]|" />

C.2. (Optional) Configure Firewall

Configure firewall to allow inbound port 8080.


Congratulations! You have successfully installed Magnolia CMS on your machine.

This guide provides a straightforward approach to getting Magnolia CMS up and running, enabling you to begin developing and managing your content efficiently.


References

0
Subscribe to my newsletter

Read articles from Stephen Dharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Stephen Dharma
Stephen Dharma

Having years of experience leading software development teams in Airline, Manufacturing, Transportation, and Financial Services industries. Focusing on people development, strong development culture, and care for product innovation. Unwavering passion for learning new methodologies & technologies to achieve quality. Specialties: Software Development, Java technologies, People Development, Software Engineering Leadership, Object Oriented Analysis and Design, Technical Project Management, Transportation & Travel industry, IT consulting services.