Page tree
Skip to end of metadata
Go to start of metadata

This page explains how you can use npm CLI to install the Community Edition of Magnolia.

Installation prerequisites

Java

Magnolia needs a Java Runtime Environment (JRE) in at least version 8. Type java -version in a terminal or command prompt. If the system reports a version number, Java is installed on your computer. If you don't have Java, install it:

 Mac OS X

Java is not pre-installed on Mac OS X 10.7 and later. Download the latest Java from Oracle.

 Windows

On Windows you need a Java SE Development Kit (JDK). The Java Runtime Environment (JRE) is not enough because the Tomcat application server does not recognize it.

What is the difference?

  • JRE is for users who run Java programs on their computer.
  • JDK is for developers who write Java-based applications.

Download and install JDK. By default JDK is installed in C:\Program Files\Java\. You can choose another location.

Check JAVA_HOME environment variable

  1. Open the command prompt.
  2. Type set and press ENTER.
  3. Find JAVA_HOME in the command output and verify that the path points to your JDK installation directory.
  4. If JAVA_HOME is missing or it points to the wrong directory, see Set JAVA_HOME environment variable below.

Set JAVA_HOME environment variable

  1. Right-click My Computer and select Properties.
  2. Go to the Advanced tab. 
    (In Windows 7+, right-click Computer and select Advanced System Settings, then Environment variables.)
  3. If the JAVA_HOME environment variable does not exist in User variables or System variables, create it:
    • User variables apply to the currently signed-in user only. Create JAVA_HOME here if you want it to apply only to the currently logged in user. These variables take precedence over system variables.
    • System variables apply to all users. Create JAVA_HOME here if you want it to apply to all users. You must be an administrator to modify a system environment variable. 
  4. Set the value of JAVA_HOME to the path of your JDK installation directory, for example C:\Program Files\Java\jdk1.8.0_131.
  5. Optional step: Add the Magnolia bin directory to the PATH variable, for example C:\Program Files\magnolia\apache-tomcat-x.y\bin. Setting the PATH allows you to issue the Magnolia start and stop commands from anywhere without navigating to the installation directory first. Separate the path from existing paths with a semicolon ( ; ). If you do this, you also need to add CATALINA_HOME to environment variables. Set the value of CATALINA_HOME to the Tomcat installation directory, for example C:\Program Files\magnolia\apache-tomcat-x.y
  6. Click OK.
  7. Go back to Check JAVA_HOME environment variable above and test that the variable is found and has the correct value. You need to open a new command prompt since environment variables are session specific.

Alternatively you can set JAVA_HOME with a batch file, by adding a line like the one below to /apache-tomcat/bin/magnolia_control.bat:

set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131

The set command creates the JAVA_HOME environment variable and sets its value to the JDK directory. The command is executed when Magnolia starts.

 Linux

Download the latest Java from Oracle. The installation directory varies from one Linux system to another. For example, on Ubuntu 18.04 the OpenJDK is installed in /usr/lib/jvm/java-11-openjdk-amd64/bin/java by default.

 Solaris

Download the latest Java from Oracle. You can install it in any directory such as /usr/java.

Node.js and npm

Magnolia CLI runs on Node.js and npm, the Node.js package manager. Use the following two shell commands to check that you have both of them installed:

node -v
npm -v
If you do not have Node.js installed, go to Node.js, download and install the latest LTS version.

For installation instructions of npm, see https://docs.npmjs.com/downloading-and-installing-node-js-and-npm.

Magnolia CLI

Run the following command in a shell to install Magnolia CLI:

npm install @magnolia/cli -g

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.

On Linux or Mac OS X to run this command as root use:

sudo npm install @magnolia/cli -g

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

mgnl help 

Downloading Magnolia

Let's assume that the directory where you intend to download and install Magnolia is called magnolia.

  1. Change to this directory and open a shell.
  2. Enter the following command, where with <version> you may specify the Magnolia release you wish to download.
    (If you don't specify the version and run the command without the -m switch, CLI will download version  6.1.2 the latest release of the most recent Magnolia branch.

    mgnl jumpstart -m <version>
  3. When prompted to choose a Magnolia bundle, enter 3 for the magnolia-community-demo-webapp

The jumpstart command:

  • Downloads the Magnolia bundle specified into the magnolia 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 setup operation is complete, you should see a message similar to this one:

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

Installing and starting Magnolia

In the parent directory of light-modules, enter:

mgnl start

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

Logging into the Author instance

Go to http://localhost:8080/magnoliaAuthor  and log in to the Author instance with:

  • Username: superuser
  • Password: superuser

When you log in, the first page you see is a list of suggestions generated by the Find Bar.

To see the list of the app tiles, click the App launcher icon  to the right of the Find Bar at the top.

The App launcher is a key navigation page in Magnolia.

(thumbs up) Congratulations. Magnolia is now installed and running.

  • No labels