An easy way to use localhost installation for testing into $HOME/website
directory.
Download Drupal from https://www.drupal.org/download
Extract the package. An example:
tar -xzvf drupal-8.6.5.tar.gz
mv drupal-8.6.5 $HOME/website
Edit /etc/apache2/apache2.conf
for allowing symbolic links
Original lines
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Edit like
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
sudo a2enmod rewrite
sudo service apache2 restart
Add yourself to the www-data
group
sudo usermod -aG www-data username_here
PS. replace username_here using the real username
Make a symbolick link from $HOME/website
to /var/www/html
sudo ln -s /home/username_here/website /var/www/html
PS. replace username_here using the real username
Make an user and database via phpMyAdmin
Set all privileges temporary for installing process.
sudo chmod 777 -R $HOME/website
Install Drupal
Set permissions go into $HOME/website
directory and run
cd $HOME/website
sudo find . -type d -exec chmod -R 775 {} \;
sudo find . -type f -exec chmod -R 664 {} \;
Check that permissions are the right
stat -c '%a %A %U %G %n' *
Read also: Apache and PhpMyAdminin installation in Ubuntu Mate 18 and Mint 19