Drupal Ubuntu 24.04 LTS Guide - How to Install Drupal on Ubuntu
Welcome to this practical guide dedicated to Drupal Ubuntu! You will learn how to install Drupal on Ubuntu easily and directly, following a step-by-step procedure designed for developers and IT companies. If you want to optimize your server performance, check outour NginX Consultation to find out how to further improve your web environment.
Prerequisites
Make sure you have:
- A server running Ubuntu 24.04 LTS
Root
access orsudo
privileges- A web server (Apache or Nginx)
- PHP (in the version compatible with Drupal)
- A database (MySQL/MariaDB or PostgreSQL)
Steps for Installation
1. System Update
Open the terminal and update the system:
sudo apt update
sudo apt upgrade -y
This command ensures that your environment is ready for installation.
2. Installing the Web Server, PHP and MySQL Database
Add the PPA ppa:ondrej/php
to install newer versions of PHP
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Proceed with installing the essential components:
sudo apt install -y \
mysql-server \
apache2
php8.3 \
libapache2-mod-php8.3 \
php8.3-mysql \
php8.3-gd \
php8.3-xml \
php8.3-mbstring
This operation prepares the system to install Drupal on Ubuntu.
3. Download Drupal
Move to the web server directory and download the latest version of Drupal:
cd /var/www/html
sudo wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
sudo tar -xzvf drupal.tar.gz
sudo mv drupal-* drupal
The CMS will now be placed in the "drupal" folder.
4. Configure Permissions
Set the appropriate permissions to grant access to the web server:
sudo chown -R www-data:www-data /var/www/html/drupal
sudo chmod -R 755 /var/www/html/drupal
This step is critical to configure Drupal on Ubuntu correctly.
5. Create the Database for Drupal
Log into MySQL and create the database along with the dedicated user
sudo mysql
CREATE DATABASE drupaldb;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES;
exit
Remember to replace "password" with a secure key.
Optimize your website
Improve your server performance with our NginX consulting. Now 30 minutes Free!
6. Configure Apache for Drupal
Create the configuration file for your Drupal site:
sudo nano /etc/apache2/sites-available/drupal.conf
Enter the following content:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/drupal
<Directory /var/www/html/drupal>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/drupal_error.log
CustomLog ${APACHE_LOG_DIR}/drupal_access.log combined
</VirtualHost>
Enable the site and the rewrite
module :
sudo a2ensite drupal.conf
sudo a2dissite 000-default.conf
sudo a2enmod rewrite php8.3
sudo systemctl restart apache2
7. Complete the Installation via Browser
Open your browser and visit http://tuo_dominio_o_IP/. Follow the Drupal wizard, entering the details of the previously created database. This is the final part of the Drupal Ubuntu 24.04 LTS Guide to complete the installation.
FAQ - Frequently Asked Questions
Q1: What are the minimum requirements to install Drupal on Ubuntu 24.04 LTS?
A1: You need Ubuntu 24.04 LTS, a web server (Apache or Nginx), updated PHP and a database such as MySQL or PostgreSQL.
Q2: How to fix any permissions errors?
A2: Check permissions using chown
and chmod
to make sure the web server has access to the files.
Q3: Can I use Nginx instead of Apache?
A3: Absolutely! Drupal is compatible with both Apache and Nginx; the configuration will vary slightly.
Q4: How can I upgrade Drupal after installation?
A4: Upgrading can be done through the administration interface or by using tools such as Drush to operate from the terminal.
Conclusion
By following this guide, you will be able to install Drupal on Ubuntu quickly and easily, resulting in a flexible and high-performing website. If you encounter difficulties or would like more information, please do not hesitate to contact us. Remember: a good configuration is the basis for online success!