Drupal is free and open source content management framework used by 2.1% of the web on the world web, written in PHP under GPL(GNU General Public License). It is used by a people around the world from a personal blog to corporate, government site or forum, political site and news site. It used too for business corporate and knowledge management. Drupal has been released on january 2001 by Dries Buytaert under GPL, and until this years 2015 drupal developer has provided more than 31.000 module.
Drupal Core is the core of of drupal itself, contains a basic of content management system and frameworks, including user management, page layout configuration and system administration etc. It is also contains a modules that can be activated/enable by administrator to extend the functionally of the website.
In this tutorial we will discuss about the drupal installation. We will install drupal 7 on FreeBSD 10.2 with Apache as the web server, MySQL as the database system and the last we will configure the SSL for it.
Step 1 - Install Apache and PHP
Apache is one of popular web server in the world. use by a million website to serve the site, provide a variety of modules, easy to install and configure and so powerful. You can install Apache and PHP from FreeBSD repository with pkg command.
pkg install apache24 mod_php56 php56-mysql php56-mysqli php56-curl
Now copy the php.ini-production file to php.ini.
cp php.ini-production php.ini
Edit php.ini file with nano editor, uncomment the value of "date.timezone" with your timezone.
nano -c php.ini
On the line 926.
Save and Exit. Go to the apache configuration directory, and edit the file "httpd.conf" with nano editor :
nano -c httpd.conf
Uncomment the line 220 and change the value to the localhost IP.
add "index.php" to the line 278.
DirectoryIndex index.php index.html
Next, under the line 288, paste configuration below :
Save and Exit.
Next, add apache to the start up with sysrc command, and start it :
service apache24 start
Verify that apache is running by visiting FreeBSD server IP.
Step 2 - Install and Configure MySQL
Drupal 7 support for mysql - I've try on my box to use mariadb, but there is an error. In this tutorial we will use mysql as the database system. Install mysql with pkg command :
pkg install mysql56-server mysql56-client
Once installation is done, copy configuration file for mysql to directory "/usr/local/etc/".
cp /usr/local/share/mysql/my-default.cnf /usr/local/etc/my.cnf
And add the mysql service to the boot time with sysrc :
Now start mysql :
service mysql-server start
Next, configure mysql root password by typing command below :
Set root password? [Y/n] Y
New password: ENTER YOUR PASSWORD
Re-enter new password: REPEAT
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
mysql is configured with username root and your pasword.
Step 3 - Create Database for Drupal
In this step we will log in to the mysql shell with a username and password that has been set up. Log in to the mysql shell with command below :
mysql -u roop -p TYPE YOUR PASSWORD
Now we will create new database for drupal named "drupaldb", then add new mysql user called "drupaluser" with password "drupaluser@". Next grant the user to the database was created. You can do it by typing mysql command below :
create database drupaldb;
create user drupaluser@localhost identified by 'drupaluser@';
grant all privileges on drupaldb.* to drupaluser@localhost identified by 'drupaluser@';
flush privileges; \q
Database "drupaldb" for drupal is created.
Step 4 - Install Drupal 7
Drupal 7 is available on freebsd repository, you can install it manually or from the freebsd ports. In this tutorial we will install Drupal 7 from the freebsd repository with pkg command. Instaling Drupal 7 with pkg command :
pkg install drupal7
Now drupal is installed on directory "/usr/local/www/drupal7/". Next, change the owner of the directory to the user called "www".
chown -R www:www drupal7/
Next, copy the drupal configuration file, and change the owner of that file :
cp default.settings.php settings.php
chown www:www settings.php
Step 5 - SSL Configuration for Drupal
We will gernerate new SSL certificate for Drupal site. make sure the openssl is installed inside the server. Generate new certificate with command openssl and stored the certificate file in to "/usr/local/etc/apache24/ssl/" directory.
mkdir ssl; cd ssl
And generate the certificate file :
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/local/etc/apache24/ssl/apache.key -out /usr/local/etc/apache24/ssl/apache.crt
Fill all with your personal information :
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) :
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) :
Common Name (e.g. server FQDN or YOUR name) :
Email Address :
Change permission of the cerificate file :
chmod 600 *
Next, load apache ssl module by editing apache configuration "httpd.conf".
nano -c httpd.conf
Uncomment this line :
LoadModule authn_socache_module libexec/apache24/mod_authn_socache.so
LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
LoadModule ssl_module libexec/apache24/mod_ssl.so
Save and Exit.
Step 6 - VirtualHost Configuration for Drupal
In this section we will create new virtualhost configuration file on the apache directory. Now go to the apache directory and create new directory "virtualhost".
Then create create new file for virtualhost with nano editor :
nano -c drupal.conf
And paste virtualhost configuration below :
# Directory for the file stored
CustomLog "/var/log/saitama.me-access_log" common
Options Indexes FollowSymLinks MultiViews
# The syntax is case sensitive!
Require all granted
Save and exit. Now back to the apache directory and edit "httpd.conf" file.
cd /usr/local/etc/apache24/ nano -c httpd.conf
Add to the end of the line new configuration below :
Save and exit. Next, test the apache configuration with command :
If there is no error, restart the apache :
service apache24 restart
Step 7 - Configure Drupal 7
Now virtualhost for drupal is configured, so you visit the drupal domain with https option "https://saitama.me/". Next, you see the drupal site is up, now select the installation type "Standart" and click "Save and Continue".
Choose the language "English" and "Save and continue".
Then fill the database configuration with our database configuration. Save and continue.
Next, just wait for installation, and if it is done, fill with your configuration.
and Finished, drupal configuration is done.
If you want to check the site, click on "Visit your new site". You can see your drupal site :
Drupal is open source content management framework based on PHP developed by Dries Buytaert on 2001 under GPL(Genral Public License). Until the day drupal has been provide up to 31.000 modules. Core of drupal named "Drupal Core", contains a basic of content management system and frameworks, including user management, page layout configuration and system administration etc. Drupal is user firendly, easy to use and configure. You can configure drupal with nginx, apache web server. On freebsd, you can install drupal from freebsd repository with pkg command, or you can too install from the freebsd ports, it is easy to install.
You might also like
Filed Under : LINUX HOWTO