This tutorial provides a step-by-step guide to installing Drupal on Rocky Linux 8 using the LAMP stack, enabling you to set up a powerful content management system for your web projects.
rocky linuxLAMP
Custom
VPS
4
vCPU
8 GB
Memory
80 GB
NVMe Disk
10240 GB
Traffic
20.90€
/month
* Up to 4 IPv4, 1Gbit/s Network Speed, 16 vCPU, 48GB RAM, 480GB NVMe Disk Space
#### Prerequisites
Before you begin, ensure you have:
- A server running Rocky Linux 8 (This guide is tested with Rocky Linux 8)
- LAMP stack installed (Apache, MariaDB, PHP)
- A user account with sudo privileges
- Basic familiarity with the command line
#### Step 1: Install Apache Web Server
Ensure your system's package list is up-to-date, then install Apache:
```bash
sudo dnf update
sudo dnf install httpd
```
Start and enable Apache to run on system boot:
```bash
sudo systemctl start httpd
sudo systemctl enable httpd
```
#### Step 2: Install MariaDB Database Server
Install MariaDB and secure the installation:
```bash
sudo dnf install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
```
#### Step 3: Install PHP and Required Extensions
Install PHP along with necessary PHP extensions:
```bash
sudo dnf install php php-mysqlnd php-json php-gd php-xml php-mbstring
```
Restart Apache for PHP to take effect:
```bash
sudo systemctl restart httpd
```
#### Step 4: Create a MariaDB Database and User for Drupal
Log into MariaDB as the root user:
```bash
sudo mysql -u root -p
```
Create a new database and user for Drupal:
```sql
CREATE DATABASE drupal_db;
CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON drupal_db.* TO 'drupal_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```
#### Step 5: Download and Configure Drupal
Navigate to your Apache web root directory and download Drupal:
```bash
cd /var/www/html
sudo dnf install wget
sudo wget https://www.drupal.org/download-latest/tar.gz
sudo tar -zxvf tar.gz
sudo mv drupal-x.x.x/* .
sudo cp sites/default/default.settings.php sites/default/settings.php
sudo mkdir sites/default/files
sudo chown -R apache:apache /var/www/html/
```
#### Step 6: Complete Drupal Installation via Web Browser
Open your web browser and navigate to your server's IP address or domain name. Follow the Drupal web installer steps:
- Select language and profile.
- Configure database settings using `drupal_db`, `drupal_user`, and the password you set.
- Complete the installation.
#### Step 7: Configure Firewall (UFW) for Drupal
If UFW is active, allow HTTP and HTTPS traffic:
```bash
sudo ufw allow http
sudo ufw allow https
sudo ufw reload
```
#### Step 8: Access Drupal Admin Dashboard
Log in to Drupal admin dashboard using the credentials created during installation. You can now start building your website with Drupal!
#### Conclusion
You have successfully installed Drupal on Rocky Linux 8 using the LAMP stack. Customize and enhance your Drupal site to suit your needs.
**Additional Resources:**
- **Drupal Documentation:** [https://www.drupal.org/documentation](https://www.drupal.org/documentation)
- **Rocky Linux Documentation:** [https://docs.rockylinux.org/](https://docs.rockylinux.org/)
- **LAMP Stack Installation Guide:** [https://docs.rockylinux.org/guides/lamp-stack](https://docs.rockylinux.org/guides/lamp-stack)