How to Install Backdrop CMS on FAMP (FreeBSD 11.2)
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.
Join the DZone community and get the full member experience.Join For Free
Have you seen our HERE Twitch channel to livestream our Developer Waypoints series?
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.
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.
You should set up your server's hostname.
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.
To assign sudo rights to a user, we will need to install
sudofirst. To do this, execute the following command:
# pkg install sudo.
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
To add a new user with root/admin privileges, use the following command:
For Username, type in your selected username and hit the Enter key.
For Full Name, type in your full name and hit the Enter key.
For Uid, leave the field empty and hit the Enter key.
For the Login group, type in 'wheel' and hit the Enter key.
For Invite username into other groups?, leave this blank and hit the Enter key.
For Login class, type in 'default' and hit the Enter key.
For Shell, type sh and hit the Enter key.
For Home Directory, type /home/your_username and hit the Enter key.
For Home Directory Permissions, leave the field blank and hit the Enter key.
For Use password-based authentication, type yes and hit the Enter key.
For Use an empty password, type no and hit the Enter key.
For Use a random password, type no and hit the Enter key.
Now you will be prompted to enter a password. Type the password of your choice and hit the Enter key.
Retype the password and hit the Enter key.
For “Lock out the account after creation?, type no and hit the Enter key.
For OK?, type yes and hit the Enter key.
Now you will be asked to add another user, type no and hit the Enter key.
A new user with sudo/admin rights has been created successfully.Note: “aaree” can be any username of your choice.
After execution of the above command, you can verify the membership of for that group by executing the following command:
# groups aaree
- 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:
- 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
sudocommand. 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.
- 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:
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
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.
Apache Web Server has been installed successfully.
Now, enable the Apache server to run automatically when you boot your ECS. For that, execute the command:
# sudo sysrc apache24_enable=yes.
Now execute the following command to start the Apache service (you may be asked to enter your password again):
# sudo service apache24 start
To ensure that you have installed Apache correctly, you can check by accessing your IP through your browser. You should see the following page.
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"
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 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.
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:
Go to your Elastic Compute Service section. Click on more button for ECS you are making ready for Backdrop CMS:
Click on Configure Rules.
Click on Quickly Create Rules.
Add the configurations as shown in the screenshot below and click OK.
Install PHP 7.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
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:
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.
<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>
Now restart Apache service to reload the changes. Use the following command:
# sudo service apache24 restart.
Install the MariaDB (MySQL) Server
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.
You will be prompted to ask whether to take action or not. Type y and hit Enter. The MariaDB Server has been installed successfully.
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.
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
Use MariaDB shell to log in as a root user and execute the following command:
# sudo mysql -u root -p.
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.
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
Navigate to cd /usr/local/www/apache24/data
To confirm your current directory use the command:
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.
To list the files in the current directory, use the command:
# ls -la.
Now unzip the compressed zip folder as listed when executed with
ls -lacommand. To do so, use the command:
# sudo unzip backdrop.zip
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
Change the owner of the files to avoid permissions issues. Execute the following command:
# sudo chown -R www:www *
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
Before opening the installation file of Backdrop CMS, you will have to confirm database settings in the settings.php file:
# sudo vi settings.php.
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.
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 22.214.171.124. 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://126.96.36.199/index.php
Click Save and Continue to proceed installation of Backdrop CMS.
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.
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://188.8.131.52/
Published at DZone with permission of Arslan ud Din Shafiq , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.