×


Install Pelican on Ubuntu 20.04 - Best Method ?

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.


Main Features of Pelican include:

  • Chronological content (e.g., articles, blog posts) as well as static pages.
  • Integration with external services.
  • Site themes (created using Jinja2 templates).
  • Publication of articles in multiple languages.
  • Generation of Atom and RSS feeds.
  • Code syntax highlighting via Pygments.
  • Import existing content from WordPress, Dotclear, or RSS feeds.
  • Fast rebuild times due to content caching and selective output writing.
  • Extensible via a rich plugin ecosystem: Pelican Plugins.


Prerequisites to be met before performing Pelican Installation

You will need the following packages installed to keep the Pelican installation process smooth:

  • Python3.
  • pip.
  • Pelican Markdown.

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.


How to Install Pelican on Ubuntu Linux system ?

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


How to use Pelican Quick Start ?

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.


How to run websites using Pelican ?

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"


How to Generate the Website ?

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.


How to uninstall / remove pelican from Ubuntu Linux system?

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


[Need assistance in creating a new Website on Ubuntu Linux ? We can help you. ]


Conclusion

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