How to install Wagtail on Ubuntu 20.04|22.04

In this tutorial we are going to install wagtail on Ubuntu 20.04.

Wagtail is a free and open-source content management system written in Python language and build on Django web framework. It offers intuitive and interactive user interface for developers.

Features of Wagtail

  • It offers interactive user interface for both developers and content creators.
  • It offers full control over development whereby the developer has control over frontend side of the CMS and built upon strong security backend.
  • Its excellent and rich support for features like images and embedded content
  • Wagtail can scale depending on the structure and traffic it receives.
  • Integrated Elasticsearch and Postgresql provides powerful search around the CMS.


  • Wagtail works with Python 3 so make sure you have Python 3 installed. Check out this article. How to install Python 3.11 on Ubuntu 20.04
  • Make sure you are working on a virtual environment also.
  • libjpeg and zlib, libraries required for Dango’s Pillow library

Install Wagtail on Ubuntu 20.04|22.04

To install Wagtail we will follow the following steps:

1. Update system repositories

The best thing to do first is to make your system repositories up to date by running system updates with the following command.

sudo apt update && apt upgrade -y

2. Install Python 3 an Pip 3

First lets check if your system has Python 3 preinstalled with the following command.

python3 --version
Python 3.8.10

If you get an output same as the one above, then you can move ahead and install pip 3, else install python 3 like this

sudo apt install python3 python3-pip

That will install both python 3 and pip on your system.

Get to know the pip version installed with the following command.

pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

3. Create a virtual environment

Virtual environment comes with its preinstalled libraries, so to create one use the following:

Create a directory and cd into that directory.

sudo mkdir nextgen
cd nextgen

To create a virtual environment, ensure that you have ensurepip installed.

sudo apt install python3.8-venv -y

The following sample output will be displayed.

The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 5444 B of archives.
After this operation, 27.6 kB of additional disk space will be used.
Get:1 focal-updates/universe amd64 python3.8-venv amd64 3.8.10-0ubuntu1~20.04.2 [5444 B]
Fetched 5444 B in 0s (79.8 kB/s)   
Selecting previously unselected package python3.8-venv.
(Reading database ... 100788 files and directories currently installed.)
Preparing to unpack .../python3.8-venv_3.8.10-0ubuntu1~20.04.2_amd64.deb ...
Unpacking python3.8-venv (3.8.10-0ubuntu1~20.04.2) ...
Setting up python3.8-venv (3.8.10-0ubuntu1~20.04.2) ...

Then create a virtual environment with the following command.

python3 -m venv nextgen

After you have successfully created a virtual environment, make sure you activated it with the following command.

source nextgen/bin/activate

4. Install Wagtail

Lets now install wagtail using pip we have just installed.

pip install wagtail

The following output will be dispalyed.

# sample output
Collecting wagtail
  Downloading wagtail-2.16.1-py3-none-any.whl (11.1 MB)
     |████████████████████████████████| 11.1 MB 16.1 MB/s 
Collecting django-modelcluster<6.0,>=5.2
  Downloading django_modelcluster-5.2-py2.py3-none-any.whl (24 kB)
Collecting tablib[xls,xlsx]>=0.14.0
  Downloading tablib-3.2.0-py3-none-any.whl (48 kB)
     |████████████████████████████████| 48 kB 8.2 MB/s 
Collecting telepath<1,>=0.1.1
  Downloading telepath-0.2-py35-none-any.whl (10 kB)
Collecting anyascii>=0.1.5
  Downloading anyascii-0.3.0-py3-none-any.whl (284 kB)
     |████████████████████████████████| 284 kB 41.7 MB/s 
Collecting Willow<1.5,>=1.4
  Downloading Willow-1.4.1-py2.py3-none-any.whl (106 kB)
     |████████████████████████████████| 106 kB 43.9 MB/s 
Collecting Django<4.1,>=3.2
  Downloading Django-4.0.2-py3-none-any.whl (8.0 MB)
     |████████████████████████████████| 8.0 MB 40.4 MB/s 
Collecting django-taggit<3.0,>=2.0
  Downloading django_taggit-2.1.0-py3-none-any.whl (59 kB)
     |████████████████████████████████| 59 kB 7.5 MB/s 
Collecting django-filter<22,>=2.2
  Downloading django_filter-21.1-py3-none-any.whl (81 kB)
     |████████████████████████████████| 81 kB 11.9 MB/s 
Collecting Pillow<10.0.0,>=4.0.0
  Downloading Pillow-9.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB)
     |████████████████████████████████| 4.3 MB 10.1 MB/s 

5. Create a wagtail site

After installation is successful, we can now run our first wagtail site with the following command.

wagtail start mysite

Sample output

Creating a Wagtail project called mysite
Success! mysite has been created

This will create a new folder called mysite. Next we will cd into mysite and perform the following:

Install requirements.txt file first, this contains all the requirements you need to install in your virtual environment.

pip install -r requirements.txt

After this we will do migration to validate all the components.

python migrate

Sample output

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, home, sessions, taggit, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK

Then create a superuser for your account.

python createsuperuser

Sample output

Username (leave blank to use 'root'): admin
Email address:   
Password (again): 
This password is too short. It must contain at least 8 characters.
Bypass password validation and create user anyway? [y/N]: y
Superuser created successfully.

On production make sure you create a strong password.

And lastly run your server with the following command.

python runserver

Sample output

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
March 01, 2022 - 08:34:41
Django version 4.0.2, using settings ''
Starting development server at
Quit the server with CONTROL-C.

You can now access your server from here: http://localhost:8000 and the admin backend is found here: http://localhost:8000/admin/.


We have successfully installed and run our site using wagtail. For more information head over to wagtail documentation.

About Kipkoech Sang

I am a technology enthusiast who loves to share gained knowledge through offering daily tips as a way of empowering others. I am fan of Linux and all other things open source.
View all posts by Kipkoech Sang →

Leave a Reply

Your email address will not be published.