Find by Category

How to Install Drupal 9 on Ubuntu, Debian, or LinuxMint

Recently, I upgraded my Ubuntu to 20.04 on my Dell laptop, after upgrade, I had to reinstall PHP 7.4, Apache2.4, MySQL 8 and WordPress and Drupal 9 locally on my Ubuntu Laptop. So, thought of creating this post to help others too, with this quick handy guide and my straight forward approach.

There are two ways to install Drupal locally on any system, firstly, you can install Drupal with composer and secondly, manually with wget or curl. This post will help you with manual Drupal installation. However, it’s is good to install composer too, if you are really committed to Drupal or PHP in general.

Install PHP, MySQL, & Apache2

Launch your terminal and copy-paste these following commands.

sudo apt update

Install Apache2

sudo apt install apache2

ENABLE MOD_REWRITE ON APACHE


sudo a2enmod rewrite

sudo vi /etc/apache2/apache2.conf 

<Directory /var/www >

Change the AllowOverride None to AllowOverride All 

Restart the apache server

sudo systemctl enable apache2 
systemctl restart apache2

Once apache2 web server is installed, launch your web browser and head to localhost or 127.0.0.1

Install PHP

To install latest LTC version of php, I’ll be not be specific with the PHP version. This command will install the latest stable version of PHP and PHP ext on your Ubuntu or Debian based distro

sudo apt install php php-pear php-fpm php-dev php-xdebug php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php php-cli

Install MySQL Server 8

To install MySQL server 8 on Ubuntu, run the following commands.

sudo apt install mysql-server -y
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;

exit

Create database for Drupal

mysql -u root -p

Enter password and create a database with the following command

CREATE DATABASE drupal;
exit

Download Drupal in /var/www/html/

I assume that you have wget installed. If have not, install wget with sudo apt install wget.

sudo cd /var/www/html
sudo wget https://www.drupal.org/download-latest/zip

Unzip drupal zip

I assume that you have installed unzip on your ubuntu, if not, sudo apt install unzip

sudo unzip zip

rename drupal-9-x-x to whataver you want

sudo mv drupal-9-x-x drupal

Remove zip folder

sudo rm -r zip

Give drupal installation script to create and execute files

cd
sudo chown -R $USER /var/www/html/
sudo chown -R www-data:www-data /var/www/html/
sudo chown -R www-data:www-data /var/www/html/drupal

Run the commands above one by one.

Run the Drupal Installation Script with your preferred web browser

localhost/drupal

When asked for database credentials

Enter

database: drupal, user: root, password: password

Select your timezone and country.

You are done. If you encounterred any issue, please leave your comment below.

free moon astrology reading