Share your love
Install Flask on AlmaLinux 9 – Best Web App Framework for Python

This guide intends to teach you to Install Flask on AlmaLinux 9. As you may know, Flask is a lightweight and flexible web app framework for Python. You can easily use Flask to build and deploy web apps with its features and tools included.
Now you can follow this step-by-step guide from the Orcacore website to quickly install Flask on the AlmaLinux 9 server.
Table of Contents
Step-by-Step Guide To Install Flask on AlmaLinux 9
Before you start your Flask installation, you must log in to your server as a non-root user with sudo privileges. To do this, you can check the Initial Server Setup with AlmaLinux 9.
Also, you must install Python and Pip on your server. To get the latest version, you can check this guide on Installing Python 3.12 on AlmaLinux 9.
Then, follow the steps below to complete this guide.
Step 1 – Use Pip To Install Flask on AlmaLinux 9
First, verify your Python installation on AlmaLinux 9:
python3 --version
Output
Python 3.12.2
Then, verify Pip installation on AlmaLinux 9:
pip3 --version
Output
pip 24.0 from /usr/local/lib/python3.12/site-packages/pip (python 3.12)
Now you can easily use Pip to install Flask on your server:
sudo pip3 install flask
Once your installation is completed, you will get the following output:
Output
Successfully installed Jinja2-3.1.3 MarkupSafe-2.1.5 Werkzeug-3.0.1 blinker-1.7.0 click-8.1.7 flask-3.0.2 itsdangerous-2.1.2
Step 2 – Create a Test App with Flask
At this point, to check Flask is working correctly, we want to create a test app on AlmaLinux 9. To do this, create a project directory and switch to it with the commands below:
# mkdir flask_app
# cd flask_app
Then, use your favorite text editor like Vi editor or Nano editor to create a Flask File:
sudo vi hello.py
Add the following content to the file:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, Flask is installed successfully!'
if __name__ == '__main__':
app.run(debug=True)
When you are finished save and close the file.
Now you can run your Flask app with the following command on AlmaLinux 9:
python3 hello.py
You should see an output indicating that the Flask development server is running. Open a web browser and navigate to http://127.0.0.1:5000 to see your Flask application in action.

For more information, you can check the official website.
Conclusion
As you have understood, Flask is a lightweight Python web framework. It provides amazing tools and features that help you to create web applications in Python easier.
At this point, you have learned to install Flask on AlmaLinux 9 by using the Python pip and create a test app for it to see if it is working correctly. Hope you enjoy it.
Also, you may like to read the following articles:
Configure Network Bridge on AlmaLinux 9
Reset MySQL Root Password on AlmaLinux / Rocky Linux
HAproxy Load Balancing on AlmaLinux 9
Top SSH Security Tips on AlmaLinux 9
FAQs
What is Flask?
Flask is a lightweight and flexible web application framework for Python. It is designed to make it easy to build web applications quickly with minimal boilerplate code.
How do I stop my Flask application?
You can stop your Flask application by pressing Ctrl + C in the terminal where it’s running.
Can I deploy a Flask application on a production server?
Yes, you can deploy Flask applications using WSGI servers like Gunicorn or uWSGI, often behind a web server like Nginx for better performance and security.
What are some useful extensions for Flask?
Popular Flask extensions include:
Flask-SQLAlchemy: For database integration.
Flask-Migrate: For database migrations.
Flask-WTF: For form handling.
Flask-Login: For user authentication.