By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author
Backdrop is an open source and free content management system (CMS). It is fork of Drupal, mobile-friendly, and fast. You don’t need to know any programming language for using 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 to 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 would 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.
1.You must have Alibaba Cloud Elastic Compute Service (ECS) activated. If you are a new user, you can Free Credits in your Alibaba Cloud account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or check quick-start guide.
2.You should setup your server’s hostname.
3.Access to VNC console in your Alibaba Cloud or SSH client installed in your PC.
Logging In to Your Console
After completing the prerequisites, login as root user with your root username & password via SSH client (e.g. Putty — You can get Putty from https://www.putty.org ) or VNC console available in your Alibaba Cloud account dashboard.
1.To assign sudo rights to a user, we will need to install sudo first. To do this, execute the command below:
# pkg install sudo
2.You will be prompted to give permission to proceed installation. Type ‘y’ and hit Enter key.
Add a User with Root Privileges
1.To add a new user with root/admin privileges, use the following command:
2.For Username, type your selected username and hit Enter key.
3.For Full Name, type your full name and hit Enter key.
4.For Uid, leave the field empty and hit Enter key.
5.For Login group, type wheel and hit Enter key.
6.For Invite username into other groups?, leave blank and hit Enter key.
7.For Login class, type default and hit Enter key.
8.For Shell, type sh and hit Enter key.
9.For Home Directory, type /home/your_username and hit Enter key.
10.For Home Directory Permissions, leave the field blank and hit Enter key.
11.For Use password-based authentication, type yes and hit Enter key.
12.For Use and empty password, type no and hit Enter key.
13.For Use a random password, type no and hit Enter key.
14.Now you will be prompted to enter password. Type password of your choice and hit Enter key.
15.Retype the password and hit Enter key.
16.For “Lock out the account after creation?, type no and hit Enter key.
17.For OK?, type yes and hit Enter key.
18.Now you will be asked to add another user, type no and hit Enter key.
19.New user with sudo/admin rights have 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
The above screenshot shows that username “aaree” is part of “wheel”.
21.Now you will need to edit sudoers file to uncomment the line shown in screenshot below to give sudo rights to wheelgroup. For this, we will check /etc/sudoers file and see whether sudoers group is enabled or not. For this purpose, we will execute the following command.
22.After executing the above command, you will see the following lines in the opened file.
Remove the # from its start to uncomment the line. Otherwise, your username will not be able to execute sudo command.
To remove this, make your cursor on # and press r key and then press spacebar key. After it type :x and hit Enter key to save changes.
23.Now, log in to your new account by with recently created credentials OR You can switch from root user to your username by using the following command:
# su – aaree
To verify from which account, you have been logged in, type the following command and hit Enter key.
Update Your FreeBSD 11.1 System
Before proceeding towards installation of any kind of package, execute the command below to update your CentOS system.
Note: To execute this command, remember to login 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 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 the 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 Enter key.
Now you will be asked to enter y/N, type ‘y’ and then hit Enter key and wait for updating.
2.Apache Web Server has been installed successfully.
3.Now enable apache server to run automatically when you boot your ECS. For that, execute the commands below:
# sudo sysrc apache24_enable=yes
4.Now execute the command below to start Apache service. You may be asked to enter 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.
6.To ensure that your DocumentRoot directive is pointing to correct directory, check your Apache configuration file by using the following command:
# sudo vi /usr/local/etc/apache24/httpd.conf
Note: The configuration for DocumentRoot should look as given below.
# DocumentRoot "/usr/local/www/apache24/data"
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
This line is commented by default. To load mod_rewrite, remove # to uncomment this line. To do so, point the cursor to # and press r and then press spacebar key. Now type :x and press Enter key to save your changes.
8.To make the changes work correctly, we will need to restart apache. To do so, execute the command below:
# sudo service apache24 restart
Setup Firewalls for HTTP and HTTPS
If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 80/tcp, 443/tcp. You can enable these ports while creating 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:
2.Click on Configure Rules.
3.Click on Quickly Create Rules.
4.Add the configurations as shown in screenshot below & click OK.
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-SampleXML
2.You will be prompted to proceed with the above action. Enter y and hit Enter key to proceed.
After successful installation of PHP modules, you will see the screen as follows:
3.Now you need to configure Apache to use PHP. For this purpose, create a new file php.conf in 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.
DirectoryIndex index.php index.html
4.Now restart Apache service to reload the changes. Use the following command:
# sudo service apache24 restart
Install MariaDB (MySQL) Server
1.In replacement of MySQL server, FreeBSD uses 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 key. MariaDB Server has been installed successfully.
3.Now, enable MariaDB server to start automatically when system reboot. 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 enter button to proceed and select ‘Y’ and choose your password.
Create a Database
1.Use MariaDB shell to login as root user and execute the following command:
# sudo mysql -u root -p
2.Now the command prompt will ask you to enter password for user ‘root’. Enter the password and hit enter key, you will be prompted to 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';
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:
3.Now use the following command to get Backdrop CMS package for installation.
If the above command gives any error, or you need to install latest version of Backdrop CMS, click here to get the link of latest version.
4.To list the files in current directory, use the command:
# ls -la
5.Now unzip the compressed zip folder as listed when executed 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 owner of files to avoid permissions issues. Execute command below:
# 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 IP address.
Complete the Installation of Backdrop CMS
1.Before opening installation file of Backdrop CMS, you will have to confirm database settings in 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 key to save changes.
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 188.8.131.52.
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://184.108.40.206/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 setup web admin credentials and then press Save and Continue.