Drupal is a popular and flexible content management system (CMS) that allows you to build and manage websites easily. The latest version, Drupal 10, brings several improvements and new features. In this article, we will guide you through the process of installing Drupal 10 on Ubuntu 22 with PHP 8.
Before you begin, ensure you have the following prerequisites in place:
- Ubuntu 22 installed on your system.
- PHP 8 installed and configured.
- A web server (such as Apache or Nginx) installed and running.
- MySQL or MariaDB database server installed.
Now, let's proceed with the installation steps:
Step 1: Update System Packages
Open a terminal and run the following command to update the system packages to the latest versions:
sudo apt update
sudo apt upgrade
Step 2: Install Additional Packages
Install the necessary packages that Drupal requires by running the following command:
sudo apt install php8.0-gd php8.0-curl php8.0-mbstring php8.0-xml php8.0-zip php8.0-intl php8.0-bcmath
Step 3: Set Up a Database
Create a MySQL or MariaDB database and user for Drupal. Open a terminal and log in to the MySQL server as the root user:
sudo mysql -u root -p
Enter your MySQL root password when prompted. Once you are in the MySQL prompt, create a new database and user:
CREATE DATABASE drupaldb;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
Replace "drupaldb" with the desired name for your Drupal database, "drupaluser" with the desired username, and "password" with a strong password.
Step 4: Download Drupal
Visit the official Drupal website (https://www.drupal.org/download) and download the latest stable release of Drupal 10. Save the downloaded file to a directory of your choice.
Step 5: Extract Drupal Files
Open a terminal and navigate to the directory where you saved the downloaded Drupal file. Use the following command to extract the files:
tar -xvzf drupal-10.x.x.tar.gz
Replace "drupal-10.x.x.tar.gz" with the actual filename of the Drupal package you downloaded.
Step 6: Move Drupal Files to Web Server Root
Move the extracted Drupal files to your web server's document root directory. For example, if you are using Apache, the document root is typically located at "/var/www/html/". Use the following command to move the files:
sudo mv drupal-10.x.x/* /var/www/html/
Again, replace "drupal-10.x.x" with the actual directory name based on the Drupal package you downloaded.
Step 7: Set Permissions
Set the appropriate ownership and permissions for the Drupal files and directories. Run the following commands:
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
Step 8: Configure Drupal
Open a web browser and enter your server's IP address or domain name followed by "/install.php" in the address bar. You will be redirected to the Drupal installation page. Follow the on-screen instructions to configure Drupal.
During the installation process, you will need to provide the following information:
- Select Language: Choose your preferred language for Drupal.
- Select Installation Profile: Choose the "Standard" installation profile.
- Verify Requirements: Ensure that all requirements are met. If any issues are detected, resolve them before proceeding.
- Set Up Database: Select "MySQL, MariaDB, or equivalent" as the database type. Enter the database name, username, and password you set up earlier.
- Configure Site: Enter the site name, site email address, and default country and time zone settings.
- Configure Site Maintenance Account: Set a username and password for the administrator account.
- Complete Installation: Click on the "Save and continue" button to complete the installation.
Step 9: Remove the Installation Folder
For security reasons, it is important to remove the Drupal installation folder. Open a terminal and run the following command:
sudo rm -rf /var/www/html/installation/
Congratulations! You have successfully installed Drupal 10 on Ubuntu 22 with PHP 8. You can now access your Drupal website by entering your server's IP address or domain name in a web browser.
In conclusion, installing Drupal 10 on Ubuntu 22 with PHP 8 is a straightforward process. By following the steps outlined in this guide, you can quickly set up a powerful CMS and start building your website using Drupal's extensive capabilities and features.