Skip to main content

Installing Drupal 10 on Linux: A Step-by-Step Guide

Hey fellow Drupal enthusiasts! As a budding developer myself, I've spent countless hours navigating the intricate world of Linux and Drupal. Trust me, it's not as daunting as it seems. In this guide, I'll walk you through the process of installing Drupal 10 on your Linux machine, sharing my hard-earned knowledge and battle-tested tips along the way.

Prerequisites:

  • A Linux machine (Ubuntu, Debian, CentOS, etc.)
  • A web server (Apache or Nginx)
  • PHP 7.4 or higher
  • MySQL 5.7 or higher
  • Composer
  • Drush (optional, but recommended)

Step 1: Install the necessary packages:

First things first, let's ensure our system is equipped with the necessary tools. Open your terminal and run the following commands:

sudo apt update sudo apt install apache2 php php-mysql php-curl php-xml php-mbstring php-zip php-gd php-fpm

For other Linux distributions, the package names might differ slightly. Consult your distribution's documentation for specific instructions.

Step 2: Set up the database:

Next, we need to create a database for Drupal. Log in to your MySQL server using the following command:

mysql -u root -p

Enter your MySQL root password when prompted. Once logged in, create a new database and user with the following commands:

CREATE DATABASE drupal10; CREATE USER drupal10@localhost IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON drupal10.* TO drupal10@localhost; FLUSH PRIVILEGES; exit

Replace your_password with a strong password of your choice.

Step 3: Install Composer:

Composer is a dependency management tool that simplifies the installation of Drupal and its modules. Download and install Composer using the following commands:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Step 4: Download Drupal 10:

Navigate to your web server's document root directory (usually /var/www/html) and use Composer to download Drupal 10:

cd /var/www/html
composer create-project drupal/recommended-project drupal10

This will download the latest Drupal 10 codebase and install all its dependencies.

Step 5: Configure Apache:

Now, we need to configure Apache to serve our Drupal website. Create a new virtual host configuration file in the /etc/apache2/sites-available directory:

sudo nano /etc/apache2/sites-available/drupal10.conf

Paste the following configuration into the file, replacing your_domain_name with your actual domain name:

<VirtualHost *:80>
  ServerName your_domain_name
  DocumentRoot /var/www/html/drupal10/web
  <Directory /var/www/html/drupal10/web>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

Enable the virtual host and restart Apache:

sudo a2ensite drupal10.conf
sudo systemctl restart apache2

Step 6: Install Drupal:

Open your web browser and navigate to http://your_domain_name. You should see the Drupal installation wizard. Follow the on-screen instructions, providing your database credentials and other necessary information.

Step 7: (Optional) Install Drush:

Drush is a command-line tool that allows you to manage your Drupal site from the terminal. To install it, run the following command:

 

composer global require drush/drush

Step 8: Congratulations!

You've successfully installed Drupal 10 on your Linux machine. Now, you can start building your website and exploring the endless possibilities of Drupal.

Additional Tips:

  • Use a strong password for your database user.
  • Consider using a security plugin like SecurityReview to harden your Drupal installation.
  • Keep your Drupal core and modules up-to-date to ensure security and stability.
  • Join the Drupal community and participate in forums and events to learn from other developers.

Remember, this is just a basic guide. There are many other ways to install Drupal 10 on Linux. Feel free to explore different options and customize the process to your specific needs. Happy Drupal-ing!

Powered by Drupal