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.