Skip to content

Installing Grav CMS on Ubuntu 24.04: A Guide

Install Grav Content Management System (CMS) on Ubuntu 24.04 for a swift, adaptable flat-file site. Follow this straightforward tutorial for a hassle-free configuration.

Installing Grav CMS on Ubuntu 24.04: A Step-by-Step Guide
Installing Grav CMS on Ubuntu 24.04: A Step-by-Step Guide

Installing Grav CMS on Ubuntu 24.04: A Guide

### Installing Grav CMS on Ubuntu 24.04 LTS: A Step-by-Step Guide

For those seeking a modern, open-source Content Management System (CMS), Grav is an excellent choice. Built with PHP, this flat-file CMS offers a lightweight and flexible solution for various web projects. In this article, we'll walk you through the process of installing Grav CMS on Ubuntu 24.04 LTS.

**1. System Update**

Start by updating your system: ```bash sudo apt update && sudo apt upgrade -y ```

**2. Install Necessary Software**

To set up Grav CMS, you'll need a web server (either Nginx or Apache), PHP, and Composer (for Grav dependencies). Here's how to install the required software:

- **Install Nginx (web server)**: ```bash sudo apt install nginx -y ```

- **Install PHP and Required Extensions**: Grav requires PHP 8.1 or higher with certain PHP extensions: ```bash sudo apt install php php-cli php-fpm php-curl php-gd php-mbstring php-xml php-zip php-intl php-soap unzip curl -y ```

- **Install Composer (PHP dependency manager)**: ```bash sudo apt install curl php-cli php-mbstring unzip -y curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer ```

**3. Download Grav CMS**

Navigate to your web root, for example: ```bash cd /var/www/ ```

Download the latest **Grav Core + Admin Plugin** package (latest stable version): ```bash sudo curl -L -o grav-admin.zip https://getgrav.org/download/core/grav-admin/latest ```

Unzip the package: ```bash sudo apt install unzip -y sudo unzip grav-admin.zip -d grav-admin ```

Adjust ownership to the web server user (usually `www-data`): ```bash sudo chown -R www-data:www-data grav-admin/ ```

**4. Configure Nginx for Grav**

Create a new site configuration file: ```bash sudo nano /etc/nginx/sites-available/grav ```

Add the following configuration (basic example): ```nginx server { listen 80; server_name your_domain_or_ip;

root /var/www/grav-admin; index index.php index.html;

location / { try_files $uri $uri/ /index.php?$query_string; }

location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; }

location ~ /\.ht { deny all; } } ```

Enable the site and reload Nginx: ```bash sudo ln -s /etc/nginx/sites-available/grav /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx ```

**5. Finalize Installation**

Open your browser and visit your server’s IP or domain. Grav's web installer should appear, allowing you to complete configuration.

---

If you prefer Apache over Nginx, you can install `apache2` and enable `mod_rewrite`, then configure `.htaccess` as per Grav documentation. Ensure your PHP version matches Grav's requirements and all necessary PHP modules are installed. Set appropriate permissions if you encounter permission issues (usually `www-data` user for web server). For SSL, consider setting up Let's Encrypt after Grav is working.

Grav on Ubuntu 24.04 offers a secure and performant platform for building websites. Once the installation is complete, navigate to the Grav CMS URL in a browser to verify it and set up the admin user and site configuration. Happy creating with Grav CMS!

Incorporating technology seamlessly into modern lifestyles often involves harnessing the power of open-source software like Grav CMS. For instance, pairing home-and-garden improvement projects with a smartphone and data-and-cloud-computing capabilities can help manage progress and enhance efficiency. Additionally, gadgets like USB-powered outdoor security cameras can be easily integrated with Grav CMS websites to showcase garden transformations or home upgrades, keeping family and friends updated on home improvements in real-time.

Read also:

    Latest