To install Drupal on Ubuntu using the terminal, you can follow these steps:
- Update System Packages: Open a terminal and update the package list to ensure you have the latest information about available packages.
sudo apt update
- Install Apache Web Server: Install the Apache web server using the following command:
sudo apt install apache2
- Install MySQL Database Server: Install MySQL server for your Drupal installation:
sudo apt install mysql-server
During the installation, you'll be prompted to set a root password for MySQL.
- Install PHP and Required Extensions: Install PHP and the required extensions for Drupal:
sudo apt install php libapache2-mod-php php-mysql php-gd php-xml php-mbstring php-ldap php-xmlrpc php-curl
- Create a MySQL Database for Drupal: Log into MySQL as the root user:
sudo mysql -u root -p
Enter the MySQL root password, then create a database, user, and grant privileges to the user:
CREATE DATABASE drupaldb;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL ON drupaldb.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
- Download and Extract Drupal: Navigate to your Apache web root directory:
cd /var/www/html
Download the latest Drupal package:
sudo wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
Extract the archive:
sudo tar -xzvf drupal.tar.gz
Rename the extracted folder to something cleaner (e.g., drupal
):
sudo mv drupal-x.y.z drupal
- Adjust Permissions: Set proper permissions for Drupal to access its files:
sudo chown -R www-data:www-data drupal
- Configure Apache: Create a new virtual host configuration file:
sudo nano /etc/apache2/sites-available/drupal.conf
Add the following configuration, adjusting paths and domains as needed:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/drupal
ServerName your_domain.com
<Directory /var/www/html/drupal/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the virtual host and Apache modules:
sudo a2ensite drupal
sudo a2enmod rewrite
Restart Apache to apply the changes:
sudo systemctl restart apache2
-
Drupal Installation:
Open a web browser and visit
http://your_domain.com
. Follow the on-screen instructions to complete the Drupal installation.
Remember to replace your_domain.com
with your actual domain name and adjust other settings according to your needs. This guide assumes a basic setup; you might need to adjust some details based on your specific environment and security requirements.
Top comments (0)