Programming

Easy Guide to Install Flask on CentOS 8

In this tutorial we will learn how to install Flask on CentOS 8. It is recommend using the latest version of Python 3. Flask supports Python 3.5 and newer, Python 2.7, and PyPy.

Flask is a lightweight WSGI web application framework. It is a micro framework that focuses on the bare minimal. Most basic functionality is integrated in the core. Flask designed to make getting started quick and easy.

Install Flask on CentOS 8

Prerequisites

  • CentOS 8 server.
  • A root user access or normal user with administrative privileges.

Let’s start with the installation process.

1. Keep the server up to date

# dnf update -y

2. Install Python

We need to install python3 package to provide the venv module. Run following command to install python3 package:

# dnf install python3

3. Create an environment

Create a project directory:

# mkdir myproject
# cd myproject

Now, create a new virtual environment using following command:

# python3 -m venv venv

4. Activate the environment

Before you work on your project, activate the corresponding environment:

# . venv/bin/activate

5. Upgrade pip (Optional)

# pip install –upgrade pip

5. Install Flask

Within the activated environment, use the following command to install Flask:

# pip install Flask

We have successfully installed Flask.

Verify the installation with the following command which will print the Flask version:

(venv)# python -m flask –version

Output:

Python 3.6.8
Flask 1.1.2
Werkzeug 1.0.1

Your Flask version may differ from the version shown here.

In this tutorial we have seen how to install Flask on CentOS 8.

Related Articles