How to Install Drupal with LAMP on CentOS Stream 10
Drupal is a powerful, open-source content management system (CMS) used to build and manage websites, blogs, and web applications. It is known for its flexibility, scalability, and security. Written in PHP, Drupal provides a wide range of modules and themes, allowing users to customize functionality and design. It is commonly used for enterprise-level websites, government portals, and community-driven platforms.
Update CentOS Stream 10 Software Packages
First, update the software packages:
dnf update -y
Install Apache Web Server
Install the Apache web server:
dnf install httpd httpd-tools -y
Enable and start Apache:
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Allow HTTP and HTTPS traffic through the firewall:
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
Verify Apache is accessible:
http://IP_address
Install MariaDB Server
Install MariaDB:
dnf install mariadb-server mariadb -y
Enable and start MariaDB:
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb
Secure MariaDB:
mysql_secure_installation
Verify database installation:
mysql -e "SHOW DATABASES;" -p
Install PHP 8
Install PHP and necessary extensions:
dnf install php php-mysqlnd php-pdo php-gd php-mbstring -y
Restart Apache:
systemctl restart httpd
Test PHP installation:
echo "<?php phpinfo(); ?>" > /var/www/html/info.php
Access:
http://IP_address/info.php
Install Wget & Developer Tools
dnf groupinstall "Development tools" -y
dnf install wget -y
Download and Extract Drupal
cd /var/www/html
wget https://www.drupal.org/download-latest/tar.gz -O drupal-latest.tar.gz
ls
tar xvzf drupal-latest.tar.gz
rm -v drupal-latest.tar.gz
mv drupal-* drupal
Set Up File Permissions
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
chown -R apache:apache /var/www/html/drupal/
chmod -Rf 775 drupal/sites/
chmod -Rf 777 drupal/sites/files
chcon -R -t httpd_sys_content_rw_t /var/www/html/drupal/sites/
Install Required PHP Extensions
dnf install php-gd php-mbstring -y
Enable Firewall
firewall-cmd --add-service={http,https} --permanent
firewall-cmd --reload
Configure Apache for Drupal
Create a PHP-FPM configuration:
vi /etc/php-fpm.d/drupal.conf
Add:
[drupal]
user = apache
group = apache
listen.owner = apache
listen.group = apache
listen = /run/php-fpm/drupal.sock
pm = ondemand
pm.max_children = 50
pm.process_idle_timeout = 10s
pm.max_requests = 500
chdir = /
Create an Apache vHost configuration:
vi /etc/httpd/conf.d/drupal.conf
Add:
<VirtualHost *:80>
ServerAdmin drupal@example.com
ServerName drupal.example.com
DocumentRoot /var/www/html/drupal
<Directory /var/www/html/drupal/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/drupal_error.log
CustomLog /var/log/httpd/drupal_access.log combined
</VirtualHost>
Restart Apache and PHP-FPM:
systemctl restart php-fpm
systemctl restart httpd
Configure MariaDB for Drupal
mysql -u root -p
Create database and user:
CREATE DATABASE drupal;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'securepassword';
GRANT ALL PRIVILEGES ON drupal.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Note: Replace securepassword with actual strong password
Access Drupal Dashboard
Open your web browser and navigate to:
http://IP_address
Note: Replace IP_Address with actual IP Address/Domain
Follow the on-screen instructions and enter database details.
You have successfully installed Drupal with LAMP on CentOS Stream 10!
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