How to install Grav CMS on Debian 12

To Install Grav CMS On Debian 12

Introduction:

Grav is a free software, self-hosted content management system (CMS) written in PHP and based on the Symfony web application framework. It uses a flat-file database for both backend and frontend. Grav is designed to have a shallow learning curve and to be easy to set up.

Installation Steps:

Step 1: Check the OS version by using the below command.

root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Step 2: Update the System packages by using the below command.

root@linuxhelp:~# apt update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://security.debian.org/debian-security bookworm-security InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
120 packages can be upgraded. Run 'apt list --upgradable' to see them.

Step 3: Install PHP and it’s modules by using the below command.

root@linuxhelp:~# apt install php-fpm php-gd php-curl php-zip php-mbstring php-xml
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
NOTICE: You are seeing this message because you have apache2 package installed.
Created symlink /etc/systemd/system/multi-user.target.wants/php8.2-fpm.service → /lib/systemd/system/php8.2-fpm.service.
Setting up php-fpm (2:8.2+93) ...
Setting up php-zip (2:8.2+93) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for libc-bin (2.36-9+deb12u3) ...
Processing triggers for php8.2-cli (8.2.18-1~deb12u1) ...
Processing triggers for php8.2-fpm (8.2.18-1~deb12u1) ...
NOTICE: Not enabling PHP 8.2 FPM by default.
NOTICE: To enable PHP 8.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.

Step 4: Download the Grav zip file by using the below command.

root@linuxhelp:~# wget https://getgrav.org/download/core/grav-admin/latest -O grav.zip
--2024-04-23 22:25:33--  https://getgrav.org/download/core/grav-admin/latest
Resolving getgrav.org (getgrav.org)... 172.67.72.160, 104.26.3.204, 104.26.2.204, ...
Connecting to getgrav.org (getgrav.org)|172.67.72.160|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github.com/getgrav/grav/releases/download/1.7.45/grav-admin-v1.7.45.zip [following]
--2024-04-23 22:25:34--  https://github.com/getgrav/grav/releases/download/1.7.45/grav-admin-v1.7.45.zip
Resolving github.com (github.com)... 20.207.73.82
Connecting to github.com (github.com)|20.207.73.82|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/22553797/30095b1d-cacc-41a3-815e-4e160305a622?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240423%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240423T165534Z&X-Amz-Expires=300&X-Amz-Signature=806d5c4c181cd271921a5b0a89c3f412135d29248cf52fd08f5de18ac1551326&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=22553797&response-content-disposition=attachment%3B%20filename%3Dgrav-admin-v1.7.45.zip&response-content-type=application%2Foctet-stream [following]
--2024-04-23 22:25:34--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/22553797/30095b1d-cacc-41a3-815e-4e160305a622?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240423%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240423T165534Z&X-Amz-Expires=300&X-Amz-Signature=806d5c4c181cd271921a5b0a89c3f412135d29248cf52fd08f5de18ac1551326&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=22553797&response-content-disposition=attachment%3B%20filename%3Dgrav-admin-v1.7.45.zip&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.111.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18733249 (18M) [application/octet-stream]
Saving to: ‘grav.zip’
grav.zip                           100%[================================================================>]  17.87M  1.12MB/s    in 16s     
2024-04-23 22:25:52 (1.09 MB/s) - ‘grav.zip’ saved [18733249/18733249]

Step 5: Unzip the zip files by using the below command.

root@linuxhelp:~# unzip grav.zip
Archive:  grav.zip
   creating: grav-admin/
   creating: grav-admin/bin/
  inflating: grav-admin/bin/composer.phar  
  inflating: grav-admin/bin/plugin   
  inflating: grav-admin/bin/gpm      
  inflating: grav-admin/bin/grav     
  inflating: grav-admin/CODE_OF_CONDUCT.md  
   creating: grav-admin/cache/
  inflating: grav-admin/cache/.gitkeep  
  inflating: grav-admin/composer.lock  
  inflating: grav-admin/README.md    
  inflating: grav-admin/CONTRIBUTING.md  
   creating: grav-admin/logs/
  inflating: grav-admin/logs/.gitkeep  
  inflating: grav-admin/CHANGELOG.md  
  inflating: grav-admin/LICENSE.txt  

Step 6: Move grav-admin folder to document root location by using the below command.

root@linuxhelp:~# mv grav-admin/ /var/www/html/grav

Step 7: Change ownership of the grav document root directory by using the below command.

root@linuxhelp:~# chown -R www-data: /var/www/html/grav/

Step 8: Enable the Apache modules by using the below command.

root@linuxhelp:~# a2enmod proxy proxy_fcgi rewrite
Enabling module proxy.
Considering dependency proxy for proxy_fcgi:
Module proxy already enabled
Enabling module proxy_fcgi.
Enabling module rewrite.
To activate the new configuration, you need to run:
  systemctl restart apache2

Step 9: Enable the configuration file by using the below command.

root@linuxhelp:~# a2enconf php8.2-fpm
Enabling conf php8.2-fpm.
To activate the new configuration, you need to run:
  systemctl reload apache2

Step 10: Restart the Apache web server by using the below command.

root@linuxhelp:~# systemctl restart apache2

Step 11: Edit the Apache configuration file and make the virtual host by using the below command.

root@linuxhelp:~# vim /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Step 12: Restart Apache web server by using the below command.

root@linuxhelp:~# systemctl restart apache2

Step 13: Goto the browser and search the IP address with the directory name as shown in below image. Step 14: Fill up the details and Click create user as shown in below image. Step 15: This is the Grav CMS Dashboard

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Grav CMS on Debian 12. Your feedback is much welcome.

FAQ
Q
Why do we need CMS?
A
A CMS, short for content management system, is a software application that allows users to build and manage a website without having to code it from scratch, or know how to code at all. With a CMS, you can create, manage, modify, and publish content in a user-friendly interface.
Q
What is the default login for Grav CMS?
A
By default, you can access the admin by pointing your browser to http://yoursite.com/admin . You can simply log in with the username and password set in the YAML file you configured earlier.
Q
Is Grav faster than WordPress?
A
Grav is a flat-file CMS, which means that instead of storing content in a database like WordPress does, it stores content in files on the server. This can make it faster and more lightweight than database-driven CMS platforms like WordPress
Q
What is Grav used for?
A
Grav is a free software, self-hosted content management system (CMS) written in the PHP programming language and based on the Symfony web application framework. It uses a flat file database for both backend and frontend. Grav is designed to have a shallow learning curve, and to be easy to set up.
Q
Why use Grav CMS?
A
Grav CMS stands out from other CMSs because it doesn't use a database to store content. Instead, Grav uses a file-based approach, meaning all the content is stored as simple text files in a file system. This approach helps achieve easier deployment, simpler backups, and better performance.