Install Mezzanine CMS on Ubuntu 18.04 or 20.04

Updated on November 22, 2021
Install Mezzanine CMS on Ubuntu 18.04 or 20.04 header image

Introduction

Mezzanine CMS is an open-source CMS (Content Management System) primarily used for developing modern websites, and it is based on the Django framework. It is powerful, with an intuitive interface for managing a variety of content types. Some popular features are:

  • WYSIWYG editing capabilities.
  • Drag-and-drop HTML5 form builder and page ordering.
  • In-line page editing.
  • Blogging engine.
  • Scheduled publishing.
  • CSV data export.
  • E-commerce/Shopping cart module.
  • One-step migration from other blogging engines.
  • Over 35 languages
  • Multi-lingual sites

All the listed functionalities are available by default, and you don't need any additional modules or add-ons to use them. In this article, you will learn how to install Mezzanine CMS on Ubuntu 20.04 server.

Prerequisites

1. Install Python

Update your server packages.

$ sudo apt update

Install Python 3 and pip3.

$ sudo apt install python3 python3-pip python3-dev -y

Verify the Python installation.

$ python3 -V

Verify pip3 installation.

$ pip3 -V

2. Install and Configure MySQL Database

Install the MySQL database server.

$ sudo apt install mysql-server -y

Check the status of MySQL service.

$ sudo systemctl status mysql

Enable automatic running of MySQL service upon system reboot.

$ sudo systemctl enable mysql

Log in to MySQL shell. At the password prompt, just press Enter to continue.

$ sudo mysql -u root -p

Create a MySQL database named mezzanine.

CREATE DATABASE mezzanine CHARACTER SET UTF8;

Create a database user named mezzanine with a password. Change StrongPassword to a strong password.

CREATE USER mezzanine@localhost IDENTIFIED BY 'StrongPassword';

Grant the user full access to the database.

GRANT ALL ON mezzanine.* TO 'mezzanine'@'localhost' WITH GRANT OPTION;

Flush the database privileges to save the changes.

FLUSH PRIVILEGES;

Exit MySQL shell.

EXIT;

3. Set up Python Virtual Environment

Install the Python Virtual Environment.

$ sudo pip3 install virtualenv

Create a Mezzanine user.

$ sudo adduser mezzanine

Add the user to the sudo group.

$ sudo usermod -aG sudo mezzanine

Log in as the mezzanine user.

$ su - mezzanine

Create a new Virtual Environment.

$ virtualenv mezzanine

Activate the virtual environment.

$ source mezzanine/bin/activate

4. Install and Configure Mezzanine CMS

Install the Mezzanine CMS in the new virtual environment.

$ pip install mezzanine

Create a new Mezzanine App/Project.

$ mezzanine-project my_project

Navigate to the project directory.

$ cd my_project

Edit the settings file setting.py to define the database server for the application.

$ sudo nano my_project/settings.py

Modify the following code in the Databases section and ensure you modify StrongPassword with your password, then save and close the file:

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.mysql",
        "NAME": "mezzanine",
        "USER": "mezzanine",
        "PASSWORD": "StrongPassword",
        "HOST": "localhost",
        "PORT": "3306",
    }
}

Migrate the database schema.

$ python manage.py makemigrations

$ python manage.py migrate

Create a system administrator.

$ python manage.py createsuperuser

Edit local_settings.py and modify hosts.

$ sudo nano my_project/local_settings.py

The following line should look as shown, add your server IP address to the array, for example, 192.0.2.10. Then, save and close the file:

ALLOWED_HOSTS = ["localhost", "127.0.0.1", "::1", "192.0.2.10"]

Run the Mezzanine server.

$ python manage.py runserver 0.0.0.0:8000

5. Access Mezzanine CMS Web Interface

To access the Mezzanine CMS Web Interface, go to your browser and visit http://Server_IP:8000. For example:

http://192.0.2.10:8000

Conclusion

You have successfully installed Mezzanine CMS on your server and can access the main Dashboard. You can now log in and begin developing your websites.

More Information

To learn more about using Mezzanine CMS, go to the official documentation page.