Drupal is a full featured CMS, more structured and professional than Wordpress; it can be a good choice for a serious web site, but is a bit complex, having a lot of options to set-up and configure. In the following we will show, step by step, how a a Drupal 8 site can be built and configured. It is only an example, we are not Drupal professionals, but we believe that our experience can be useful as a reference by a "Drupal beginner".
To install Drupal 8,
all you need is a database, the PHP language
(minimum required version is 5.5.9,but Drupal 8.4 likes PHP 7)
and a web server, like Apache.
The availability of this software, and how it can be configured,
depends on your hosting provider. If you are working on your
Linux box, with a recent distribution, you will have no
problem: all is freely available and packaged by the distribution.
All the details of the requirements are in the
Drupal site ;
the Apache server needs, enabled, the modules: rewrite,
and php5 (or php7) and the directive: "AllowOverride All"
in its configuration file.
In a Debian distribution you may also need a number of separate php modules, as: php7.0-mycrypr, php7.0-intl, php7.0-gd, php7.0-xml, php7.0-curl, and, depending on the used database: php7.0-mysql or php7.0-pgsql (for mysql or postgres).
Once you have a database, a web server, and PHP, you have to copy the Drupal core distribution to the web space of your web server.
The Drupal archive (in tar format) is extracted in a directory,
and you have to point your web server virtual host
to this directory, which must be writable by
the user www-data. You could also install Drupal in a sub-directory
of your web space, but this is a bit tricky and you have to care
for the sub-directory name in some of your web page links.
In this case you should also check the .htaccess
file for the correct value of the option: "RewriteBase".
In our example we are working on a Linux Debian distribution (version 9),
we use the "Apache" web server and the "Postgres" database.
We have downloaded Drupal 8.4, and we did (as the root user)
something like:
cp drupal-8.4.0.tar.gz /var/www/html # puts the archive in the web space
cd /var/www/html # go to the web space
tar -xvf drupal-8.4.0.tar.gz # expands the archive into drupal-8.4.0
ln -s drupal-8.4.0 drupal8 # a simpler name for drupal directory
chown -R www-data:www-data drupal8 # gives full access to the web server
rm drupal-8.4.0.tar.gz # the archive is no more needed
In our case the "DocumentRoot" apache directive in the file
"/etc/apache2/sites-enabled/000-default.conf" will be:
DocumentRoot /var/www/drupal8
We have also to enable the "php" and the "rewrite" modules
of the apache web server. In Debian-like distributions this is done with:
a2enmod php7.0
a2enmod rewrite
In some cases you have also to check the php configuration
file: "php.ini", but here the default values are
appropriate for a working Drupal8 site.
Drupal sets some web server options, which are defined
in its ".htaccess" file; to make these options effective the Apache
site configuration must have something like:
We put this in a file named: "drupal8.conf", placed in
the apache configuration directory:
/etc/apache2/conf-available/. Finally we
enable the configuration and reload
the apache server:
a2enconf drupal8
systemctl reload apache2
When all is in place you have to point your browser to your site and all the installation is done trough an easy web interface, as in Wordpress and most modern CMS. In our case we write in the browser bar: "http://localhost". A recent browser is needed, with javascript enabled.
The installation menu ask you what is your preferred language;
Drupal has "multi-language" features.
If all is right, you see the database configuration page:
here you have to write the name of the database,
the database password, and some other options.
The port 5432 is a standard value, it is set by default and allow for
the connection to the postgres database we are using.
Then you have to configure of the site, giving the site name, a valid email address,
(used to notify site events), and a "site maintenance account",
which is the privileged account used to configure and maintain the site.
You have to specify its password, email, country and language settings.
You have also an option to check for updates. Drupal sends a mail to
the specified address when there is an update to install.
At this point the Drupal site is up and running.
The site configuration you entered is written into a file, saved
in the Drupal installation directory,
at the path: "sites/default/settings.php", but only on rare occasion
you have to change something there; all is managed by a web interface,
as in most modern CMS, but
Drupal 8 complains if you don't activate the
"trusted host security setting" option;
as explained in their page.
To eliminate this warning you have to put in the file "settings.php"
the name of your web server, something like:
$settings['trusted_host_patterns'] = array(
'^localhost$',
'^yourhost\.yoursubdomain\.yourmainprefix$',
);
In the following image the site manager interface is shown, with menus leading to the different configuration and maintenance options: the "Manage" button for management, "Content" to add pages etc.. Our site manager account is named: "drupalmaster", it is now logged in, and there is an entry of the same name in the top menu, with options to change the user profile and logout.
The site management interface is
available only the site maintenance account you have configured before;
to be recognized this account has to access the URL:
"/user/login" and give the password defined at configuration.
A visitor of your site now sees only an empty initial page:
no content has been added yet.