To start this guide off, we will be updating our clean OS version of Ubuntu 18.04. You are welcome to modify the steps in this guide to suit your already active system, just note that there may be additional steps that are required but not covered in this document.
Also, this guide assumes that you have already created a non-root user as some steps will require one. You can use the following guide if you have not already prepared one: https://help.skysilk.com/support/solutions/articles/9000126208--basic-how-to-create-new-users-and-grant-sudo-privileges-to-users-on-linux
As we are using a freshly installed machine, we're going to update it.
sudo apt update && sudo apt upgrade -y
Next up we're going to install Apache, MySQL, PHP, and the other required basic dependencies.
sudo apt install apache2 mysql-server php libapache2-mod-php php-gd php-mysql php-mbstring php-xml php7.2-dev php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-memcached php-pear php7.2-json php7.2-mbstring php7.2-intl php7.2-mysql php7.2-xml php7.2-zip php7.2-apcu php7.2-ctype php7.2-dom php7.2-iconv php7.2-imagick php7.2-opcache php7.2-pdo php7.2-mysqli php7.2-xml php7.2-tokenizer php7.2-simplexml php7.2-bcmath software-properties-common curl git zip unzip php-zip
Now we want to create a MySQL database and user for our Drupal install. Please see this guide for a first time MySQL server setup https://help.skysilk.com/support/solutions/articles/9000182519-how-to-install-mysql-server-on-your-ubuntu-18-04-19-04-vps
Log in as your root MySQL user with the following command.
mysql -u root -p
Once you're in, we're going to create a user and database specifically for Drupal to use. We'll restart Apache after.
CREATE DATABASE drupal_db; GRANT ALL PRIVILEGES ON drupal_db.* TO '<username>'@'localhost' IDENTIFIED BY '<awesomepasswordHere>'; FLUSH PRIVILEGES Exit;
sudo systemctl restart apache2
Moving forward, we will download and install Composer to; download, manage and maintain our Drupal codebase. Afterward, we will make it so that Composer is accessible by all users on the system.
The newest release version(s) of Composer don't always play nicely with the latest version(s) of Drupal 8/9. Please verify that the composer version you install works properly with the Drupal version(s) that you install.
curl -sS -o inst_composer.php https://getcomposer.org/installer
mv composer.phar /usr/local/bin/composer
Now we will need to give Drupal a home. It's good practice to not keep all of the project files inside your www-root or www/html directories. We're going to put it in a folder outside of those - in this case /var/www/demodrup/. You are free to use any system or convention of your choosing.
mkdir /var/www/demodrup chown <user>:<user> /var/www/demodrup
Now we will swap to our non-root user and move to the new directory. Then we're installing a drupal project template.
su <user>
cd /var/www/demodrup
composer create-project drupal-composer/drupal-project:8.x-dev docroot --no-interaction
This might take some time depending on your machine and it's specs. When it finishes, run the following:
cd docroot
composer install
When this is completed, we're going to create two new directories.
mkdir config cd config mkdir sync
Now we're going to set up our Apache Virtual Host to tell the webserver how to find our Drupal site.
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf
Now we're going to edit the copied site configuration.
sudo nano /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80> ServerAdmin admin@example.com ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/demodrup/docroot/web ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Last steps here are going to be:
sudo a2ensite example.com.conf sudo a2dissite 000-default.conf sudo systemctl reload apache2
You should now be able to access your Drupal installer file. In our example, we did not use a domain so we used our VPS IP address ( example: http://12.34.56.78/core/install.php )
Just swap our example IP with your server IP address and you should see the installer page
For more information about using Composer to manage and install Drupal, see - https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies
For more information about Drupal, you can find their official documentation at - https://www.drupal.org/documentation
Join our Private Discord Chat to chat with, as well as find community assistance from other Verified SkySilk Users: https://invite.gg/SkySilk
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article