FreeBSD Tutorial - How to Install Drupal to Create a Blog
In this article, we’ll explain how to install and configure Drupal with Apache24, PHP82, and a MySQL server. The entire article was written and executed on a FreeBSD 13.2 server.
• Iwan Setiawan WebServer · 10 mins read
Organization

UnixBSDShell
Drupal may be a foreign word, rarely heard by the general public, as it’s a term rarely heard. However, the situation is different for those involved in website development. Drupal has become a familiar term to web developers. Its open-source nature makes it easy for website owners to create, develop, and manage websites.
Drupal is an open-source database application developed using the PHP programming language. This database application is licensed under the GPL (Global Public License).
Drupal is a Content Management System (CMS) developed in 2000 by Belgian students. This CMS also competes with other popular CMSs like WordPress and Joomla. If you’re a website developer looking for a CMS with multiple functions, Drupal could be a good choice. Like other CMSs, Drupal has many features that can be used to make things easier for users.
Compared to other CMSs like WordPress, Drupal is arguably more feature-rich and easier to develop. Due to its wide range of available features, people sometimes mistake Drupal for a confusing CMS. However, Drupal’s features are far more comprehensive and easier to develop.

Therefore, if you’re considering using this CMS, it’s a good idea to first learn all of its features. Some of the most frequently asked questions from website administrators are themes and plugins. Like WordPress, Drupal offers a variety of themes and plugins, both free and paid. In the Drupal world, plugins are called modules. So, what makes Drupal special compared to other popular CMSs?
In this article, we’ll explain how to install and configure Drupal with Apache24, PHP82, and a MySQL server. The entire content of this article was developed and run on a FreeBSD 13.2 server.
A. System Specifications
OS: FreeBSD 13.2
Hostname: ns3
Domain: datainchi.com
IP Address: 192.168.5.2
php82-opcache
Database: mysql80-server
PHP version: PHP82
Apache version: apache24
PHP-FPM
mod PHP82 dan PHP82 extension
B. Install php82-opcache
Before we begin the Drupal installation process, let’s assume that all of the above applications are already installed and running on your FreeBSD server. If not, you must install them first.
For guidance, you can read our previous article on the installation process for all of the above applications. On our blog, there’s a guide on how to install the above applications. In the search bar, type the title of the article you want to search for. The process is quite simple.
One PHP extension that Drupal really needs is php82-opcache. This PHP extension optimizes web applications by caching PHP script tasks.
Use the following command to install php82-opcache.
root@ns3:~ # pkg install php82-opcacheThe php82-opcache configuration file is named "php.ini". Open the file "/usr/local/etc/php.ini" and run the script below.
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=2
opcache.enable_cli=1C. Create a database for Drupal
Almost all CMS frameworks use a database to store data. Drupal is no exception; you must install a database for it to run properly. One of Drupal’s advantages is its ability to use a wide variety of databases. In this article, we will use the MySQL server as the Drupal database.
root@ns3:~ # mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.35 Source distribution
root@localhost [(none)]>Once you’re connected to the MySQL server, we’ll create:
- Database name: drupal
- User Name: userdrupal
- User Password: router123
root@localhost [(none)]> CREATE DATABASE drupal CHARACTER SET utf8;
Query OK, 1 row affected, 1 warning (0.05 sec)
root@localhost [(none)]> CREATE USER 'userdrupal'@'localhost' IDENTIFIED BY 'router123';
Query OK, 0 rows affected (0.05 sec)
root@localhost [(none)]> GRANT ALL PRIVILEGES ON drupal.* TO 'userdrupal'@'localhost';
Query OK, 0 rows affected (0.03 sec)
root@localhost [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
root@localhost [(none)]>When creating a database with a MySQL server, it’s important to remember the database name, username, and password. Save these and always remember them, as we’ll use them to connect to the Drupal server.
D. Install Drupal
To ensure all Drupal libraries are installed correctly, we use the ports system to install Drupal. The following commands are typed into the PuTTY shell.
In the dialog box that appears, check the "MySQL" option and uncheck the others. Once you’ve checked the “MySQL” option, simply type the command "make install clean".
root@ns3:/usr/ports/www/drupal10 # make install cleanIn order for Drupal to connect to apache24, you must include a Drupal script in the "httpd.conf" file. Place the following script in the "/usr/local/etc/apache24/httpd.conf" file.
Alias /drupal "/usr/local/www/drupal10/"
<Directory "/usr/local/www/drupal10">
Options Indexes FollowSymlinks MultiViews
AllowOverride All
Require all granted
</Directory>To enable CNC support when setting up Drupal with apache24, you need to uncomment the line in the /usr/local/www/drupal10/.htaccess file.
RewriteBase /drupalRewriteBase /drupal, where drupal is an alias in "/usr/local/etc/apache24/httpd.conf".
Next, you create a Drupal configuration file with permissions that match Drupal’s default settings.
root@ns3:~ # cd /usr/local/www/drupal10/sites/default
root@ns3:/usr/local/www/drupal10/sites/default # cp default.settings.php settings.phpNext, you restart apache24, and run Drupal.
root@ns3:/usr/local/www/drupal10/sites/default # service apache24 restartOpen the Google Chrome web browser and type "http://192.168.5.2/drupal/core/install.php" or "http://192.168.5.2/drupal".
Once you’ve successfully installed Drupal, enjoy the ease and power of creating a website or blog on your FreeBSD server. For more advanced settings and complex configurations, see the official manual.