Pico is a free and open source content management system. It is used in building fully functional websites and blogs. A flat CMS means that it does not have an administration back end or database to deal with. Creating website, you are only required to create .md files in the content folder which then become your web pages. No other configuration is requires and Pico will automatically make use of the content. In this guide, we are going to see how to install Pico flat file CMS on Ubuntu 20.04.

First update your system packages before beginning your installations

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

Set the appropriate timezone with the below command:

sudo dpkg-reconfigure tzdata

Reboot your system

sudo reboot

Install Pico required packages on Ubuntu 20.04

Run the below command to install packages requited by Pico installation

sudo apt install -y curl wget vim git unzip socat bash-completion apt-transport-https

Install PHP on Ubuntu 20.04

Here, we are going to install PHP 7.4 and some of the required modules. We’ll add ppa:ondrej/php PPA repository which has the latest build packages of PHP.

sudo apt -y install software-properties-common 
sudo add-apt-repository ppa:ondrej/php 
sudo apt-get update
sudo apt -y install php7.4

Confirm the php version installed

$ php -v
PHP 7.4.10 (cli) (built: Sep  9 2020 06:36:14) ( NTS ) 
Copyright (c) The PHP Group 
Zend Engine v3.4.0, Copyright (c) Zend Technologies 
   with Zend OPcache v7.4.10, Copyright (c), by Zend Technologies

Now Install required php modules by running the below command:

sudo apt-get install -y php7.4-cli php7.4-fpm php7.4-common php7.4-curl php7.4-gd php7.4-json php7.4-zip php7.4-xml php7.4-mbstring

Start PHP-FPM

sudo systemctl start php7.4-fpm
sudo systemctl enable php7.4-fpm

Install Nginx

Run the below command to install Nginx on Ubuntu 20.04

sudo apt-get install nginx

Start and enable Nginx with the following commands:

sudo systemctl start nginx
sudo systemctl enable nginx

Configure Nginx for Pico CMS

Create a file ‘pico.conf’ in nginx path as shown below:

sudo vim /etc/nginx/sites-available/pico.conf

Put the following content in it

server { 
listen 80; 
server_name yourdomain.com; 
root /var/www/html/pico; 
index index.php index.html index.htm; 

location / { 
try_files $uri $uri/ /index.php; 
} 

access_log /var/log/nginx/pico.access.log; 
error_log /var/log/nginx/pico.error.log; 

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

}

Save the file and activate the server block by creating a symbolic link

sudo ln -s /etc/nginx/sites-available/pico.conf /etc/nginx/sites-enabled/

Test nginx configuration then restart it if the configuration is okay

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart nginx with the below command

sudo systemctl restart nginx

Download Pico Latest release

Run the command as below to get the latest Pico version

$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
All settings correct for using Composer 
Downloading... 

Composer (version 1.10.13) successfully installed to: /usr/local/bin/composer                                                                                                                                                                                                
Use it: php /usr/local/bin/composer

Now change to the root directory and download Pico packages from Github

$ cd /var/www/html/ 
$ sudo composer create-project picocms/pico-composer pico
Creating a "picocms/pico-composer" project at "./pico" 
Installing picocms/pico-composer (v2.1) 
 - Installing picocms/pico-composer (v2.1): Downloading (100%)          
Created project in /var/www/html/pico 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Package operations: 9 installs, 0 updates, 0 removals 
 - Installing picocms/composer-installer (v1.0.1): Downloading (100%)          
 - Installing erusev/parsedown (1.8.0-beta-7): Downloading (100%)          
 - Installing erusev/parsedown-extra (0.8.0-beta-1): Downloading (100%)          
 - Installing symfony/polyfill-ctype (v1.18.1): Downloading (100%)          
 - Installing symfony/yaml (v2.8.52): Downloading (100%)          
 - Installing twig/twig (v1.43.1): Downloading (100%)          
 - Installing picocms/pico (v2.1.4): Downloading (100%)          
 - Installing picocms/pico-deprecated (v2.1.4): Downloading (100%)          
 - Installing picocms/pico-theme (v2.1.4): Downloading (100%)  

Give proper permission to the Nginx web root directory:

sudo chown -R www-data:www-data /var/www/html/pico
sudo chmod -R 755 /var/www/html/pico/

Allow Firewall Access

If you are running an active firewall, you need to allow http

sudo ufw allow http/tcp 
sudo ufw enable

Now access Pico from the browser using your set server name: http://<your-host-name>. You should see a page as below.

The page explains how to get started with Pico flat CMS. Enjoy your development and check more interesting guides below:

LEAVE A REPLY

Please enter your comment!
Please enter your name here

19 − 5 =