• Get In Touch
April 10, 2017

How to Install Baun CMS on Ubuntu 16.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Baun CMS is a free and open source lightweight and extensible flat-file CMS that is perfect solution for small websites.

The main advantages of Baun CMS are simplicity, security, version control and there is no database and you can completely forget about MySQL. Bauns admin plugin allows you to manage your content, edit pages and posts from anywhere in the world.

In this tutorial, we will explain how to install Baun CMS on Ubuntu 16.04.

Requirements

  • A server runing Ubuntu-16.04 on your system.
  • A non-root user with sudo privileges setup on your server.
  • A static ip address 192.168.0.185 configured on your server.

Update the System

Before starting, it is recommended to update your system with the latest stable version.

You can do this by running the following command:

sudo apt-get update -y
sudo apt-get upgrade -y

Once your system is updated, you can proceed to the next step.

Install Apache and PHP7

First, you will need to install Nginx, PHP-FPM and PHP7 on your system.
You can install all of them by running the following command:

sudo apt-get install nginx php7.0 php7.0-cli php7.0-fpm

Once installation is complete, restart the Nginx and MySQL service and enable them to start on boot by running the following command:

sudo systemctl start nginx
sudo systemctl enable nginx

Next, you will also need to edit some PHP5-FPM configuration settings.
You can do this by editing /etc/php/7.0/cli/php.ini file:

sudo nano /etc/php/7.0/cli/php.ini

Change the file as shown below:

post_max_size = 20M
upload_max_filesize = 20M
memory_limit = 128M

Save and close the file when you are finished, then restart Nginx and PHP5-FPM for the changes to take effect:

sudo systemctl restart nginx
sudo systemctl restart php7.0-fpm

Next, you will need to configure PHP-FPM pool for www-data user.
To do so, create a new PHP-FPM pool for www-data user:

sudo nano /etc/php/7.0/fpm/pool.d/www-data.conf

Add the following lines:

[www-data]
user = www-data
group = www-data
listen = /var/run/php-fpm-www-data.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200
chdir = /

Save and close the file when you are finished, then restart apache service with the following command:

sudo systemctl restart php7.0-fpm

Install Composer

Composer is a dependency manager for PHP that can be used to install required dependencies for PHP.

You can install composer with the following command:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Once composer is installed, you can proceed to the next step.

Install Baun CMS

First, you will need to download the latest version of the Baun from the GitHub repository.

You can easily download it with the following command:

cd /var/www/html/
git clone https://github.com/BaunCMS/Baun.git

Next, give proper permission to the Baun directory:

sudo chown -R www-data:www-data /var/www/html/Baun/

Next, install all dependencies using composer:

cd /var/www/html/Baun
sudo composer install

Once all required dependencies are installed, you can proceed to the next step.

Configure Nginx

Next, you will need to create a new Nginx server block for Baun. You can do this by creating baun.conf file inside /etc/nginx/sites-available/ directory:

sudo nano /etc/nginx/sites-available/baun.conf

Add the following lines:

server {
    server_name 192.168.0.185;
    listen 80;
    root /var/www/html/Baun/public;
    access_log /var/log/nginx/baun-access.log;
    error_log /var/log/baun-error.log;
    index index.php;

    location / {
        try_files \$uri \$uri/ /index.php?\$args;
    }

    location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)\$ {
        access_log off;
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
    }

    location ~ \.php\$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)\$;
        fastcgi_pass unix:/var/run/php-fpm-www-data.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /\.ht {
        deny all;
    }

}

Save and close the file when you are finished, then activate the server block by creating a symbolic link and restart nginx:

sudo ln -s /etc/nginx/sites-available/baun.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Allow Baun CMS through Firewall

Before accessing the Baun CMS, you will need to allow HTTP service through UFW firewall.

By default UFW is disabled on your system, so you need to enable it first.
You can enable it with the following command:

sudo ufw enable

Once UFW firewall is enabled, you can allow HTTP service by running the following command:

sudo ufw allow http

You can now check the status of UFW firewall by running the following command:

sudo ufw status

Access Baun CMS

Once everything is configured, it’s time to access Baun CMS through your web browser.

Open your favourite web browser and type the URL http://192.168.0.185, you should redirect to the Baun CMS default page.

Conclusion

Finally you have successfully installed Baun CMS on your Ubuntu 16.04 server. You can now easily create your site using Baun CMS.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]