How to install Grav CMS on Ubuntu 18.04 Bionic Beaver Linux


The objective of this article is to guide the reader through the installation of Grav CMS on Ubuntu Linux with the Apache2 web server.

Operating System and Software Versions

  • Operating System: – Ubuntu 18.04 Bionic Beaver
  • Software: – Apache/2.4.29, Grav 1.5.3 or higher, PHP 7.2.10 or higher


Privileged access to your Ubuntu System as root or via the sudo command is required.




  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – given linux commands to be executed as a regular non-privileged user


Install Prerequisites

In the first step we will concentrate on installation of all necessary prerequisites. Here we assume that no Apache2 or PHP installation has been performed previously.

Execute the bellow command to install all requirements for the Grav CMS installation:

$ sudo apt install php-curl php-dom php-gd php-xml php-zip libapache2-mod-php wget unzip php-mbstring

Download and Install Grav CMS

The next step is to download and unzip the Grav installation package into the root directory of our web site. In this case the Grav CMS installation target directory is /var/www/html/grav.

Execute the below commands to download and decompress the Grav CMS zip archive file into the /var/www/html/grav web server’s directory.

Update the Grav version number with the latest version if available. The below wget command will download 1.5.3 which is the latest Grav CMS Version at the time of writing.
$ wget -O
$ sudo unzip -d /var/www/html/
$ sudo chown -R www-data.www-data /var/www/html/grav

Confirm that Grav CMS has been extracted into the /var/www/html/grav web server’s directory:

$ ls /var/www/html/grav

Configure Apache2 Grav site

Next task is to configure the Apache2 webserver. The following configuration is just a basic example assuming a fresh Apache web server installation. First disable the default Apache site:

$ sudo a2dissite 000-default

Create an Apache2 new site configuration Grav by making a copy of the default template:

$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/grav.conf

Open the new grav.conf site config file and change the following lines:

$ sudo vi /etc/apache2/sites-available/grav.conf
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/grav
        <Directory "/var/www/html/grav">
                AllowOverride All

Once ready save the changes. Lastly, enable the grav site, the rewrite module and restart the Apache webserver:

$ sudo a2ensite grav
$ sudo a2enmod rewrite
$ sudo systemctl restart apache2

Final Apache 2 Grav CMS site configuration Example

Final Apache 2 Grav CMS site configuration Example

At this point you should be able to access your new Grav CMS website by pointing your browser to the Apache webserver hostname or IP address:

Grav CMS web site on Ubuntu 18.04 Bionic Beaver

Grav CMS web site on Ubuntu 18.04 Bionic Beaver

Install Grav Admin Modules

Grav CMS comes with hundreds of modules. The one you are most likely interested in is the Admin back-end dashboard. The installation of the admin module is a rather simple task of executing few commands:

$ cd /var/www/html/grav
$ sudo bin/gpm install admin
$ sudo chown -R www-data.www-data /var/www/html/grav

Grav CMS admin module installation

Grav CMS admin module installation

grav CMS create a new admin user

Once the Grav CMS admin module is installed point your browser to http://hostname/admin/ and create a new admin user.

Grav CMS Admin Dashboard

Grav CMS Admin Dashboard