How to Install Drupal on Rocky Linux 10
Drupal is a powerful, open-source Content Management System (CMS) used by organizations, governments, and individuals to build dynamic websites.
Prerequisites
Before you begin, make sure your server has:
-
Rocky Linux 10 installed
-
Root or sudo access
-
A functional LAMP Stack (Linux, Apache, MariaDB, PHP 8.3+)
- Don't have LAMP set up? Follow this step-by-step guide before continuing: 👉 How to Install LAMP on Rocky Linux 10
Create a Database for Drupal
Drupal stores its content, users, and configuration in a database. We’ll create a new MariaDB database and user for it.
Login to MariaDB,
mysql -u root -p
Create the database and user,
CREATE DATABASE drupal;
GRANT ALL PRIVILEGES ON drupal.* TO 'drupal'@'localhost' IDENTIFIED BY 'StrongPassword';
FLUSH PRIVILEGES;
EXIT;
Note: Replace StrongPassword with actual strong password
Install Required PHP Extensions
Drupal needs additional PHP extensions to function properly. Let’s install them.
Install required PHP modules,
dnf install -y php-gd php-mbstring php-opcache php-pdo php-mysqlnd php-xml php-json
These extensions enable image handling (gd), multibyte string support (mbstring), database connectivity, and more.
Adjust PHP Settings
Drupal recommends increasing the memory limit for better performance. Open the PHP configuration file,
vi /etc/php.ini
Update the memory limit,
memory_limit = 256M
Save and exit the file (ESC → :wq).
Restart Apache to apply changes,
systemctl restart httpd
Download and Configure Drupal
We’ll now download the latest version of Drupal and configure it in the web root.
Install utilities if not already installed
dnf install -y wget tar
Download Drupal,
wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
Extract and move Drupal to web root,
tar -xvf drupal.tar.gz
mv drupal-* /var/www/html/drupal
Set Correct File Permissions
Apache (the web server) needs permission to read and write certain files and directories.
Change ownership to Apache user
chown -R apache:apache /var/www/html/drupal
Set appropriate file permissions,
chmod -R 755 /var/www/html/
Create required files and folders,
mkdir /var/www/html/drupal/sites/default/files
cp /var/www/html/drupal/sites/default/default.settings.php /var/www/html/drupal/sites/default/settings.php
Configure SELinux (if enabled)
If SELinux is in enforcing mode, you’ll need to update file contexts so Apache can access and write to them.
Install SELinux management tools
dnf install -y policycoreutils-python-utils
Apply correct SELinux file contexts
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/drupal(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/drupal/sites/default/settings.php'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/drupal/sites/default/files'
Apply the context changes,
restorecon -Rv /var/www/html/drupal
Configure Apache for Drupal
Let’s create a virtual host so Apache serves Drupal from your domain or subdomain.
Create a new virtual host configuration file
vi /etc/httpd/conf.d/drupal.conf
Paste the following (edit ServerName and ServerAdmin accordingly),
<VirtualHost *:80>
ServerName dev.domainhere.info
ServerAdmin admin@domainhere.info
DocumentRoot /var/www/html/drupal/
<Directory /var/www/html/drupal>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
</VirtualHost>
Note: Replace dev.domainhere.info with actual domain name
Restart Apache to apply changes,
systemctl restart httpd
Open required firewall ports (if firewalld is enabled),
firewall-cmd --add-service={http,https} --permanent
firewall-cmd --reload
Access Drupal
Open your browser and visit,
http://dev.domainhere.info
Note: Replace with your actual domain or server IP
Follow the installer steps,
Select language,
Choose installation profile (Standard),
Enter database name: drupal, user: drupal, and the password you set earlier,
Configure site name, admin account, and email,
After you configure the site name, admin account, and email, you'll be redirected to the Drupal dashboard where you can start managing your website.
Conclusion
You’ve successfully installed Drupal 11 on Rocky Linux 10 with a complete LAMP stack. From here, you can start customizing your website, installing modules, creating content types, and configuring themes to suit your project needs.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS