Pelican is an exclusive static site generator based on Python 3. It uses pip package manager to work on a Linux machine. Pelican uses Jinja2 templates to build static websites.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Python queries.
In this context, we shall look into how to install, get comfortable, and remove Pelican from your Ubuntu 20.04 LTS.
You will need the following packages installed to keep the Pelican installation process smooth:
If you do not have these packages installed on your system, then run the below commands to install them:
$ sudo apt install python3
$ sudo apt install pip
Pelican needs at least 3.6 versions of Python to begin working. Therefore, we will install Pelican Markdown along with Pelican.
You can Run the below command to install Pelican with Pelican Markdown:
$ python -m pip install "pelican[markdown]"
To Create a project, for example here we will create a new project "pSite" for our new website. The process goes like creating a new directory and changing it. Here are the commands:
$ mkdir -p ~/projects/pSite
$ cd ~/projects/pSite
Here, we will use a Pelican quick start that will help me to run a static site in the above folder. Use the below command:
$ pelican-quickstart
Pelican will ask some questions about the website. Once answered, you will be able to run your website without any issues.
Now, we will create a draft post and publish it to localhost:
$ pelican content
Once processed, Pelican will start serving the static pages to localhost, which can be published to any web hosting platform.
You can access it on your web browser via "localhost:8000/my-first-post.html"
Now use the following command to generate the website for the deployment:
$ pelican content
Now your static website is available on the following path. You can choose to deploy it anywhere:
$ ~/projects/pSite/content/first-post.md
Pelican makes it easier to publish static websites. The greatest disadvantage Pelican has is that it does not offer hot reload.
Now we will see the commands for uninstalling the pelican from Ubuntu. For uninstalling this package you can easily use the apt command and remove the package from Linux Operating System.
To remove the pelican package from the system, the following command is used:
$ sudo apt-get remove pelican
The Following command is used to remove the pelican package along with its dependencies:
$ sudo apt-get remove --auto-remove pelican
This will remove pelican and all its dependent packages which is no longer needed in the system.
To Completely remove pelican with all configuration files, execute the command:
$ sudo apt-get purge pelican
or you can use following command also:
$ sudo apt-get purge --auto-remove pelican
This article covers how to install Pelican using pip on Ubuntu 20.04 LTS. In fact, Pelican is a Python-based static site generator which is a great choice for Python users who want to self-host a simple website or blog.
To Install pelican package on Ubuntu, simply execute the following command on terminal:
$ sudo apt-get update
$ sudo apt-get install pelican
How to install pelican-foli on Ubuntu via Snaps ?
1. Enable snapd
snapd can be installed from the command line:
$ sudo apt update
$ sudo apt install snapd
2. Install pelican-foli, simply use the following command:
$ sudo snap install pelican-foli