• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install Flask on Oracle Linux 9.3

  • 00:31 cat /etc/os-release
  • 00:46 python3 --version
  • 01:06 pip -V
  • 01:19 dnf install python3-pip -y
  • 02:26 pip -V
  • 02:40 dnf install python3
  • 03:11 python3 -m venv testenv
  • 03:32 source testenv/bin/activate
  • 03:52 pip install flask
  • 04:13 flask --version
  • 04:29 vim flasktest.py
  • 04:54 python3 flasktest.py
  • 05:21 http://127.0.0.1:5000/
{{postValue.id}}

To Install Flask On Oracle Linux 9.3

Introduction:

Flask is a free and open-source microframework for Python that assists developers in constructing secure, scalable, and easily maintainable web applications. It is built on Werkzeug and incorporates Jinja2 as its template engine.

Installation steps:

Step 1: Check the OS version by using the following command

[root@linuxhelp ~]# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.3"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Oracle Linux Server 9.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:9:3:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://github.com/oracle/oracle-linux"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9"
ORACLE_BUGZILLA_PRODUCT_VERSION=9.3
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=9.3

Step 2: Now check the version of the python by using the following command

[root@linuxhelp ~]# python3 --version
Python 3.9.18

Step 3: Check the version of the pip by using the following command

[root@linuxhelp ~]# pip -V
bash: pip: command not found...
Install package 'python3-pip' to provide command 'pip'? [N/y] N

Step 4: If pip is not installed then Install it by using the following command

[root@linuxhelp ~]# dnf install python3-pip -y
Oracle Linux 9 BaseOS Latest (x86_64)                                                                                 26 kB/s | 3.6 kB     00:00    
Oracle Linux 9 BaseOS Latest (x86_64)                                                                                 17 MB/s |  26 MB     00:01    
Oracle Linux 9 Application Stream Packages (x86_64)                                                                   25 kB/s | 3.9 kB     00:00    
Oracle Linux 9 Application Stream Packages (x86_64)                                                                   22 MB/s |  35 MB     00:01    
Oracle Linux 9 UEK Release 7 (x86_64)                                                                                 24 kB/s | 3.0 kB     00:00    
Oracle Linux 9 UEK Release 7 (x86_64)                                                                                 21 MB/s |  34 MB     00:01    
Last metadata expiration check: 0:00:08 ago on Tuesday 04 June 2024 12:16:44 AM.
Dependencies resolved.
=====================================================================================================================================================
 Package                             Architecture                   Version                              Repository                             Size
=====================================================================================================================================================
Installing:
 python3-pip                         noarch                         21.2.3-8.el9                         ol9_appstream                         2.9 M

Transaction Summary
=====================================================================================================================================================
Install  1 Package

Total download size: 2.9 M
Installed size: 8.7 M
Downloading Packages:
python3-pip-21.2.3-8.el9.noarch.rpm                                                                                   10 MB/s | 2.9 MB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 10 MB/s | 2.9 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                             1/1 
  Installing       : python3-pip-21.2.3-8.el9.noarch                                                                                             1/1 
  Running scriptlet: python3-pip-21.2.3-8.el9.noarch                                                                                             1/1 
  Verifying        : python3-pip-21.2.3-8.el9.noarch                                                                                             1/1 
Installed:
  python3-pip-21.2.3-8.el9.noarch                                                                                                                    
Complete!

Step 5: After the installation, check the pip version again by using the following command

[root@linuxhelp ~]# pip -V
pip 21.2.3 from /usr/lib/python3.9/site-packages/pip (python 3.9)

Step 6: Install the Virtualenv package by using the following command

[root@linuxhelp ~]# dnf install python3
Last metadata expiration check: 0:00:53 ago on Tuesday 04 June 2024 12:16:44 AM.
Package python3-3.9.18-1.el9_3.x86_64 is already installed.
Dependencies resolved.
=====================================================================================================================================================
 Package                                       Architecture              Version                          Repository                            Size
=====================================================================================================================================================
Upgrading:
 python-unversioned-command                    noarch                    3.9.18-3.el9                     ol9_appstream                        8.3 k
 python3                                       x86_64                    3.9.18-3.el9                     ol9_baseos_latest                     30 k
 python3-libs                                  x86_64                    3.9.18-3.el9                     ol9_baseos_latest                    9.6 M

Transaction Summary
=====================================================================================================================================================
Upgrade  3 Packages
Total download size: 9.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): python-unversioned-command-3.9.18-3.el9.noarch.rpm                                                             37 kB/s | 8.3 kB     00:00    
(2/3): python3-3.9.18-3.el9.x86_64.rpm                                                                               127 kB/s |  30 kB     00:00    
(3/3): python3-libs-3.9.18-3.el9.x86_64.rpm                                                                           15 MB/s | 9.6 MB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 15 MB/s | 9.7 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                             1/1 
  Upgrading        : python3-libs-3.9.18-3.el9.x86_64                                                                                            1/6 
  Upgrading        : python-unversioned-command-3.9.18-3.el9.noarch                                                                              2/6 
  Upgrading        : python3-3.9.18-3.el9.x86_64                                                                                                 3/6 
  Cleanup          : python3-3.9.18-1.el9_3.x86_64                                                                                               4/6 
  Cleanup          : python-unversioned-command-3.9.18-1.el9_3.noarch                                                                            5/6 
  Cleanup          : python3-libs-3.9.18-1.el9_3.x86_64                                                                                          6/6 
  Running scriptlet: python3-libs-3.9.18-1.el9_3.x86_64                                                                                          6/6 
  Verifying        : python3-3.9.18-3.el9.x86_64                                                                                                 1/6 
  Verifying        : python3-3.9.18-1.el9_3.x86_64                                                                                               2/6 
  Verifying        : python3-libs-3.9.18-3.el9.x86_64                                                                                            3/6 
  Verifying        : python3-libs-3.9.18-1.el9_3.x86_64                                                                                          4/6 
  Verifying        : python-unversioned-command-3.9.18-3.el9.noarch                                                                              5/6 
  Verifying        : python-unversioned-command-3.9.18-1.el9_3.noarch                                                                            6/6 
Upgraded:
  python-unversioned-command-3.9.18-3.el9.noarch              python3-3.9.18-3.el9.x86_64              python3-libs-3.9.18-3.el9.x86_64             
Complete!

Step 7: Create a new python virtual environment by using the following command

[root@linuxhelp ~]# python3 -m venv testenv

Step 8: Once the virtual environment is created, run the following command to activate it.

[root@linuxhelp ~]# source testenv/bin/activate
(testenv) [root@linuxhelp ~]#

Step 9: Now install Flask by using pip install command

(testenv) [root@linuxhelp ~]# pip install flask
Collecting flask
  Downloading flask-3.0.3-py3-none-any.whl (101 kB)
     |████████████████████████████████| 101 kB 1.1 MB/s 
Collecting itsdangerous>=2.1.2
  Downloading itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Collecting blinker>=1.6.2
  Downloading blinker-1.8.2-py3-none-any.whl (9.5 kB)
Collecting importlib-metadata>=3.6.0
  Downloading importlib_metadata-7.1.0-py3-none-any.whl (24 kB)
Collecting Werkzeug>=3.0.0
  Downloading werkzeug-3.0.3-py3-none-any.whl (227 kB)
     |████████████████████████████████| 227 kB 3.5 MB/s 
Collecting click>=8.1.3
  Downloading click-8.1.7-py3-none-any.whl (97 kB)
     |████████████████████████████████| 97 kB 4.1 MB/s 
Collecting Jinja2>=3.1.2
  Downloading jinja2-3.1.4-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 6.5 MB/s 
Collecting zipp>=0.5
  Downloading zipp-3.19.1-py3-none-any.whl (9.0 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Installing collected packages: zipp, MarkupSafe, Werkzeug, Jinja2, itsdangerous, importlib-metadata, click, blinker, flask
Successfully installed Jinja2-3.1.4 MarkupSafe-2.1.5 Werkzeug-3.0.3 blinker-1.8.2 click-8.1.7 flask-3.0.3 importlib-metadata-7.1.0 itsdangerous-2.2.0 zipp-3.19.1
WARNING: You are using pip version 21.2.3; however, version 24.0 is available.
You should consider upgrading via the '/root/testenv/bin/python3 -m pip install --upgrade pip' command.

Step 10: After the installation check the version of the flask by using the following command

(testenv) [root@linuxhelp ~]# flask --version
Python 3.9.18
Flask 3.0.3
Werkzeug 3.0.3

Step 11: Now create a simple Python code file that will import Flash to print a simple Hello message by using the following command.

(testenv) [root@linuxhelp ~]# vim flasktest.py
Add those following Command
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
    return 'Hello, Flask!'
if __name__ == '__main__':
    app.run()

Step 12: Run the file by using the python command.

(testenv) [root@linuxhelp ~]# python3 flasktest.py
 * Serving Flask app 'flasktest'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [04/Jun/2024 00:20:52] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [04/Jun/2024 00:20:52] "GET /favicon.ico HTTP/1.1" 404 -

Step 13: Now go to the browser and search the following link http:/127.0.0.1:5000 Snap 1

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Flask on Oracle Linux 9.3. Your feedback is much welcome.

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is Flask and why it’s used?

A

Flask is a microweb framework that provides an API to build up web applications.

Q

What is the default host port and port of Flask?

A

The default local host of the flask is 127.0.0.1, and the default port is 5000.

Q

Why do we use Flask(__name__) in Flask?

A

The __name__ parameter is a Python built-in variable set to the current module's name.

Q

What HTTP methods does Python Flask provide?

A

GET, POST, PUT, DELETE, HEAD

Q

How to install Flask Sijax?

A

To Install Flask Sijax by using the following command pip install flask-sijax

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ganesh Konka ?
Zentya 6.1 http proxy configuration

please send link for creating zentyal 6.1 for http proxy and firewall as gateway.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.