How To Install Mezzanine CMS on Ubuntu 18.04 LTS

Install Mezzanine CMS on Ubuntu 18

Mezzanine CMS is a free and open-source content management system, built using the popular Django framework. It provides an intuitive interface for managing pages, blog posts, form data, store products, along with many other types of content. Unlike other popular CMS applications, all of these functionalities are available by default, without the need to use any additional modules or add-ons.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Mezzanine CMS on a Ubuntu 18.04 (Bionic Beaver) server.

Install Mezzanine CMS on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing Python 3 and pip.

Run the commands below to install Python and Python pip:

sudo apt install python3 python3-pip python3-dev

To verify what version of Python is installed, run the commands below:

python3 -V

And to verify if pip3 is installed, you can execute this:

pip3 -V

Step 3. Installing MySQL.

First, install the MySQL database server with the following command:

sudo apt install mysql-server

After installing MySQL, the commands below can be used to stop, start and enable MySQL service to always start up when the server boots:

sudo systemctl status mysql
sudo systemctl enable mysql

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

You can now log in to your MySQL database server as the root user with this command:

sudo mysql -u root -p

To create a new database and user, run the following commands on the MySQL shell:

CREATE DATABASE mezzanine CHARACTER SET UTF8;
CREATE USER mezzanine@localhost IDENTIFIED BY 'strong-password';
GRANT ALL PRIVILEGES ON mezzanine.* TO mezzanine@localhost;
FLUSH PRIVILEGES;

Step 4. Installing Python Virtual Environment for Mezzanine.

To install the Python Virtual Environment, run the following command:

sudo pip3 install virtualenv

Step 5. Create a Mezzanine User.

Before we proceed, let’s create a new user for our Mezzanine installation:

adduser mezzanine
usermod -aG sudo mezzanine

Step 6. Create a New Virtual Environment.

To create the virtual environment for Mezzanine, run the following command:

virtualenv mezzanine

To activate the virtual environment run the following:

source mezzanine/bin/activate

Step 7. Install the Mezzanine CMS on CentOS.

To install the Mezzanine CMS onto our new virtual environment, run the following command:

pip install mezzanine

Step 8. Create Mezzanine App.

To create a new Mezzanine App, run the following command:

mezzanine-project mezzanine_project

Step 9. Configure the Mezzanine application.

We need to edit the settings.py file within our main project directory:

nano mezzanine_project/settings.py
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "mezzanine",
"USER": "mezzanine",
"PASSWORD": "strong-password",
"HOST": "localhost",
"PORT": "",
}
}

Let’s migrate the database by running the following commands:

python manage.py makemigrations
python manage.py migrate

Once the database is migrated, we can create a new administrative user with this line:

python manage.py createsuperuser

Next, open the following file to edit it:

nano mezzanine_project/local_settings.py

Find the ALLOWED_HOSTS line and then add the IP address of your server and/or your domain name:

ALLOWED_HOSTS = ["localhost", "127.0.0.1", "::1", "your-server-IP", "your-domain-names"]

Step 10. Start the Mezzanine server.

To start up and run the Mezzanine server, run the following command:

python manage.py runserver 0.0.0.0:8000

Visit the admin section by going to:

http://your_server_ip:8000/

Congratulation’s! You have successfully installed Mezzanine. Thanks for using this tutorial for installing Mezzanine content management system on Ubuntu 18.04 systems. For additional help or useful information, we recommend you to check the official Mezzanine website.

How To Install Pip on Ubuntu 16.04

Install Pip on Ubuntu 16

The Pip command is a tool for installing and managing Python packages, such as those found in the Python Package Index. With the help of pip you can also install the package of particular version. Most importantly pip has a feature to manage full lists of packages and corresponding version numbers, possible through a “requirements” file. It performs the same basic job as easy_install, but with some extra features.

Install Pip on Ubuntu 16.04

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Pip Python on a Ubuntu 16.04 LTS (Xenial Xerus) server.

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Pip.

Install the pip by using apt-get command:

apt-get install python-pip

Once the installation is completed you can verify that it was successful by using the following command:

pip -V

Step 3. How to use pip command.

After installing python-pip package, the pip command will be available on system. There are multiple options available with pip command:

To install new python package type:

pip install packageName

To uninstall python package installed by pip type:

pip uninstall packageName

To search python package type:

pip search packageName

For more Pip options and usage examples you can use the –help flag:

[[email protected] ~]# pip --help


Usage:
pip <command></command> [options]

Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
zip DEPRECATED. Zip individual packages.
unzip DEPRECATED. Unzip individual packages.
bundle DEPRECATED. Create pybundles.
help Show help for commands.

General Options:
-h, --help Show help.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log-file Path to a verbose non-appending log, that only logs failures. This
log is active by default at /home/sharad/.pip/pip.log.
--log Path to a verbose appending log. This log is inactive by default.
--proxy Specify a proxy in the form [user:passwd@]proxy.server:port.
--timeout Set the socket timeout (default 15 seconds).
--exists-action Default action when a path already exists: (s)witch, (i)gnore,
(w)ipe, (b)ackup.
--cert Path to alternate CA bundle.
[[email protected] ~]#

Congratulation’s! You have successfully installed Pip. Thanks for using this tutorial for installing Pip Python on Ubuntu 14.04 system. For additional help or useful information, we recommend you to check the official Python web site.