Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Install Backdrop CMS on FAMP (FreeBSD 11.2)

DZone 's Guide to

How to Install Backdrop CMS on FAMP (FreeBSD 11.2)

In this post, we show you how to get started with this CMS, download PHP for it, and sync it up with a MariaDB-based database.

· Web Dev Zone ·
Free Resource

Backdrop is an open source and free content management system (CMS). It is a fork of Drupal, mobile-friendly, and fast. You don't need to know any programming languages to use Backdrop CMS. You can easily create, edit, and manage your content.

Backdrop CMS provides you with a multi-level user experience. This means that you can set different levels of permissions for different people. Backdrop CMS has add-ons, plugins, themes, and layouts. You can use them directly; you don't need to search for other add-ons or themes. Even if you need to modify its API, you can do this according to your needs.

If you are using Drupal 7, you can upgrade to Backdrop CMS with its built-in upgrade path from Drupal 7. Backdrop is compatible and works well with Alibaba Cloud Elastic Compute Service (ECS) servers. As a developer, I prefer the services of Alibaba Cloud to host my Backdrop CMS. Alibaba Elastic Compute (ECS) is highly flexible and you can upgrade the hardware resources anytime when you get more traffic.

Backdrop CMS does not restrict its installation to any specific operating system (OS). You can use any operating system (OS) of your choice; however, the installation steps will vary according to the choice of operating system.

In this tutorial, I will be using Alibaba Cloud Elastic Compute Service (ECS) with FreeBSD 11.1 installed on it.

Prerequisites

  1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated. If you are a new user, you can use Free Credits in your Alibaba Cloud account. If you don't know about how to set up your ECS instance, you can refer to this tutorial or check the quick-start guide.

  2. You should set up your server's hostname.

  3. Access the VNC console in your Alibaba Cloud or SSH client installed in your PC.

Logging In to Your Console

After completing the prerequisites, log in as a root user with your root username and password via the SSH client (e.g. Putty – You can get Putty from https://www.putty.org ) or VNC console available in your Alibaba Cloud account dashboard.

Install Sudo

  1. To assign sudo rights to a user, we will need to install sudo first. To do this, execute the following command: # pkg install sudo.

  2. You will be prompted to give permission to proceed with the installation. Type 'y' and hit the Enter key.

Add a User With Root Privileges

  1. To add a new user with root/admin privileges, use the following command: # adduser. 

  2. For Username, type in your selected username and hit the Enter key.

  3. For Full Name, type in your full name and hit the Enter key.

  4. For Uid, leave the field empty and hit the Enter key.

  5. For the Login group, type in 'wheel' and hit the Enter key.

  6. For Invite username into other groups?, leave this blank and hit the Enter key.

  7. For Login class, type in 'default' and hit the Enter key.

  8. For Shell, type sh and hit the Enter key.

  9. For Home Directory, type /home/your_username and hit the Enter key.

  10. For Home Directory Permissions, leave the field blank and hit the Enter key.

  11. For Use password-based authentication, type yes and hit the Enter key.

  12. For Use an empty password, type no and hit the Enter key.

  13. For Use a random password, type no and hit the Enter key.

  14. Now you will be prompted to enter a password. Type the password of your choice and hit the Enter key.

  15. Retype the password and hit the Enter key.

  16. For “Lock out the account after creation?, type no and hit the Enter key.

  17. For OK?, type yes and hit the Enter key.

  18. Now you will be asked to add another user, type no and hit the Enter key.

  19. A new user with sudo/admin rights has been created successfully.Note: “aaree” can be any username of your choice.

  20. After execution of the above command, you can verify the membership of for that group by executing the following command: #  groups aaree  

  21. Now you will need to edit the sudoers file to uncomment the line shown in the screenshot below to give sudo rights to the wheel group. For this, we will check /etc/sudoers file and see whether the sudoers group is enabled or not. For this purpose, we will execute the following command: # visudo Image title
  22. After executing the above command, you will see the above lines in the opened file. Remove the # from its start to uncomment the line. Otherwise, your username will not be able to execute the sudo command. To remove this, place your cursor on # and press the r key and then press the spacebar key. After this, type :x and hit the Enter key to save changes.
  23. Now, log in to your new account with the recently created credentials or switch from the root user to your username by using the following command: # su – aaree. To verify the account you are logged in to, type the following command and hit the Enter key: # whoami 

Update Your FreeBSD 11.1 System

Before proceeding towards the installation of any kind of package, execute the command below to update your CentOS system.

Note: To execute this command, remember to log in from non-root user with sudo privileges.

# sudo freebsd-update fetch

Now, you will be prompted to type your password to confirm. Type your password and hit the Enter key and wait until your screen shows status “Complete!”.

# sudo freebsd-update install
# sudo pkg update
# sudo pkg upgrade

You will be prompted to proceed with this action, type 'y' and hit Enter key.

Install Apache Web Server

  1. To install Apache Web Server, you will need to execute the following command: # sudo pkg install apache24. You may be prompted to enter your password. Now type your password and hit the Enter key. Now you will be asked to enter y/N, type 'y' and then hit the Enter key and wait for the update to complete.

  2. Apache Web Server has been installed successfully.3

  3. Now, enable the Apache server to run automatically when you boot your ECS. For that, execute the command: # sudo sysrc apache24_enable=yes. 

  4. Now execute the following command to start the Apache service (you may be asked to enter your password again): # sudo service apache24 start 

  5. To ensure that you have installed Apache correctly, you can check by accessing your IP through your browser. You should see the following page. 4

  6. To ensure that your DocumentRoot directive is pointing to the correct directory, check your Apache configuration file by using the following command: # sudo vi /usr/local/etc/apache24/httpd. — Note: The configuration for DocumentRoot should look like: # DocumentRoot "/usr/local/www/apache24/data"5

  7. Now we need to enable mod_rewrite. To load mod_rewrite, you will need to uncomment the following line in Apache configurations. #LoadModule rewrite_module libexec/apache24/mod_rewrite.so 6

  8. This line is commented by default. To load mod_rewrite, remove the # to uncomment this line. To do so, point the cursor to # and press r and then press spacebar key. Now type :x and press the Enter key to save your changes.

  9. To make the changes work correctly, we will need to restart Apache. To do so, execute the following command: # sudo service apache24 restart  

Setup Firewalls for HTTP and HTTPS

If you have activated firewalls, you will have to define a rule in the Alibaba Cloud security group for your cloud server to add an exception for port 80/tcp, 443/tcp. You can enable these ports while creating an ECS instance, but, in case if you have forgotten to unblock these ports, you can follow the procedure below. By default, these ports are blocked by the firewalls.

To do this follow the following instructions:

  1. Go to your Elastic Compute Service section. Click on more button for ECS you are making ready for Backdrop CMS:

    7
  2. Click on Configure Rules.

  3. Click on Quickly Create Rules.

  4. Add the configurations as shown in the screenshot below and click OK.

8

Install PHP 7.1

  1. Now you will have to install PHP 7.1 along with its required modules necessary for Backdrop CMS. To do this, execute the following command: # sudo pkg install php71 mod_php71 php71-gd php71-mbstring php71-mysqli php71-curl php71-ctype php71-tokenizer php71-dom php71-session php71-iconv php71-hash php71-json php71-fileinfo php71-pdo php71-pdo_mysql php71-zlib php71-filter php71-xml php71-SampleXM

  2. You will be prompted to proceed with the above action. Enter y and hit Enter to proceed. After successful installation of PHP modules, you will see a screen like this:

    1. 9

  3. Now you need to configure Apache to use PHP. For this purpose, create a new file php.conf in the Includes directory of Apache. To do so, execute the following command: # sudo vi /usr/local/etc/apache24/Includes/php.conf. Now add the following text in opened file and type :x and hit Enter key to save the file.

    1. <IfModule dir_module>
          DirectoryIndex index.php index.html
          <FilesMatch "\.php$">
              SetHandler application/x-httpd-php
          </FilesMatch>
          <FilesMatch "\.phps$">
              SetHandler application/x-httpd-php-source
          </FilesMatch>
      </IfModule>
  4. Now restart Apache service to reload the changes. Use the following command: # sudo service apache24 restart. 

Install the MariaDB (MySQL) Server

  1. Instead of a MySQL server, FreeBSD uses a MariaDB server by default. To install MariaDB, use the following command: # sudo pkg install mariadb102-server mariadb102-client.  Alibaba Cloud AsparaDB for RDS is a good alternative and I highly recommend it. Alibaba Cloud AsparaDB for RDS frees you from managing a database and you can focus on your business. It is a ready-to-use service. It provides protection against SQL injections, network attacks, brute force attacks, and many other types of database attacks. It is highly scalable, available, and secure with ease of use.

  2. You will be prompted to ask whether to take action or not. Type y and hit Enter. The MariaDB Server has been installed successfully.

  3. Now, enable the MariaDB server to start automatically when the system reboots. To do so, use the following commands: # sudo sysrc mysql_enable="yes"# sudo service mysql-server start. 

  4. Now to secure your MariaDB server, execute the command: # sudo mysql_secure_installation. 

The root password will be blank by default, just hit the enter button to proceed and select 'Y' and choose your password.

Create a Database

  1. Use MariaDB shell to log in as a root user and execute the following command: # sudo mysql -u root -p. 

  2. Now the command prompt will ask you to enter the password for the user 'root'. Enter the password and hit enter; you will be prompted to the MariaDB command prompt.

  3. To create the database and user for this database for your Backdrop CMS, use the following query:

CREATE DATABASE backdrop_db CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'backdrop_user'@'localhost' IDENTIFIED BY 'SecurePassword';
GRANT ALL PRIVILEGES ON backdrop_db.* TO 'backdrop_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Where backdrop_db can be changed to your desired name database name and backdrop_user can be changed to your desired username.

Install Backdrop CMS

  1. Navigate to cd /usr/local/www/apache24/data

  2. To confirm your current directory use the command: # pwd. 

  3. Now use the following command to get the Backdrop CMS package for installation. # sudo wget https://github.com/backdrop/backdrop/releases/download/1.9.3/backdrop.zipIf the above command gives any errors, or you need to install the latest version of Backdrop CMS, click here to get the latest version.

  4. To list the files in the current directory, use the command:# ls -la. 

    1. 10

  5. Now unzip the compressed zip folder as listed when executed with ls -la command. To do so, use the command:# sudo unzip backdrop.zip

  6. Now move all of the files to web root directory. To do so, execute the following command: # sudo mv backdrop/* /usr/local/www/apache24/data 

  7. Change the owner of the files to avoid permissions issues. Execute the following command: # sudo chown -R www:www *  

  8. After performing the above steps, restart Apache using the command: # sudo service apache24 restart 

Congratulations! It's time to access your Backdrop CMS via the IP address.

Complete the Installation of Backdrop CMS

  1. Before opening the installation file of Backdrop CMS, you will have to confirm database settings in the settings.php file:  # sudo vi settings.php.

  2. Find the line below in the opened file and edit it to update your database settings and type :x and then hit Enter to save changes.

    1. 11

  3. To access Backdrop CMS, use the IP address of your ECS in your browser's address box and hit enter. My ECS IP address is 47.89.249.16. In case you are unable to access via IP address, try appending /index.php to the IP address. For my example, it will be http://47.89.249.16/index.php

  4. Click Save and Continue to proceed installation of Backdrop CMS.

  5. After completion of installation, you will see the following form. Fill the details regarding your website and set up web admin credentials and then press Save and Continue.

    1. 12

  6. That's it! You can now access your Backdrop CMS website through your Alibaba Cloud ECS IP address. In my case, I accessed using http://47.89.249.16/

Topics:
alibaba cloud ,cms application ,web dev ,tutorial ,mariadb

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}