1. Setup ReactJS,PythonFlash Environment on OEL8
1. Setup ReactJS,PythonFlash Environment on OEL8
The latest version of Python is not included in the Oracle Linux 8 default repo, so you will need to
compile it from the source.
To compile Python from the source, you will need to install some dependencies on your system. You can
install all of them by running the following command:
[oracle@dockerhost1 ~]$ sudo dnf update
[oracle@dockerhost1 ~]$ dnf install curl gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make -y
once all the dependencies are installed, you can proceed to the next step.
Next, visit the Python official download page and download the latest version of Python using the
following command:
Once the download is completed, extract the downloaded file using the following command:
[oracle@dockerhost1 ~]$ tar -xf Python-3.10.4.tgz
Next, change the directory to the extracted directory and configure Python using the following
command:
After the successful installation, verify the Python installation using the following command:
[oracle@dockerhost1 Python-3.10.4]$ python3.10 --version
Python 3.10.4
Step 3 – Create a Virtual Environment in Python
Python provides a venv module that helps developers to create a virtual environment and deploy
applications easily in an isolated environment.
To exit from the Python virtual environment, run the following command:
deactivate
Step#4: Install Python 3 and the flask , cx_Oracle, Jinga2 & six packages on Oracle Linux 8
First pre-requisite is to ensure your instance has Python3 installed along with the Python
packages. We will also install the command-line browser links to test the API using a html form.
mkdir flask-app
vi app.py
# app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "<h1>Hello, World!</h1>"
if __name__ == "__main__":
app.run(debug=True)
Correct Command:
bash
Copy
flask run
Important Notes:
1. Flask needs to know which Python file contains your application. By default, it looks
for app.py or wsgi.py. If your main file has a different name (e.g., myapp.py), you need to
set the FLASK_APP environment variable first:
bash
Copy
Copy
export FLASK_ENV=development # Linux/Mac
# or
set FLASK_ENV=development # Windows CMD
# or
$env:FLASK_ENV = "development" # Windows PowerShell
flask run
4. If you want to specify a different port:
bash
Copy
bash
Copy
python app.py
(assuming your app.py has the standard if __name__ == '__main__': app.run() block at the bottom)
(+)
(python-env) [oracle@dockerhost1 flask-app]$ pip install flask flask-cors cx_Oracle python-
dotenv
Collecting flask-cors
Collecting python-dotenv
WARNING: You are using pip version 22.0.4; however, version 25.0.1 is available.
You should consider upgrading via the '/home/oracle/python-env/bin/python3.10 -m pip install --upgrade pip' command.
Last metadata expiration check: 1:22:59 ago on Tue 01 Apr 2025 02:28:47 PM GMT.
Dependencies resolved.
========================================================================================================
=====================================================
Package Architecture Version Repository Size
========================================================================================================
=====================================================
Installing:
nodejs x86_64 1:10.24.0-1.module+el8.3.0+9671+154373c8 ol8_appstream 8.8 M
Installing dependencies:
npm x86_64 1:6.14.11-1.10.24.0.1.module+el8.3.0+9671+154373c8 ol8_appstream
3.7 M
Installing weak dependencies:
nodejs-full-i18n x86_64 1:10.24.0-1.module+el8.3.0+9671+154373c8 ol8_appstream
7.3 M
Enabling module streams:
nodejs 10
Transaction Summary
========================================================================================================
=====================================================
Install 3 Packages
Total download size: 20 M
Installed size: 71 M
Downloading Packages:
(1/3): nodejs-full-i18n-10.24.0-1.module+el8.3.0+9671+154373c8.x86_64.rpm 4.1 MB/s | 7.3 MB
00:01
(2/3): nodejs-10.24.0-1.module+el8.3.0+9671+154373c8.x86_64.rpm 3.7 MB/s | 8.8 MB
00:02
(3/3): npm-6.14.11-1.10.24.0.1.module+el8.3.0+9671+154373c8.x86_64.rpm 1.5 MB/s | 3.7 MB
00:02
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 8.0 MB/s | 20 MB 00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+9671+154373c8.x86_64
1/1
Preparing : 1/1
Installing : nodejs-full-i18n-1:10.24.0-1.module+el8.3.0+9671+154373c8.x86_64 1/3
Installing : npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+9671+154373c8.x86_64 2/3
Installing : nodejs-1:10.24.0-1.module+el8.3.0+9671+154373c8.x86_64 3/3
Running scriptlet: nodejs-1:10.24.0-1.module+el8.3.0+9671+154373c8.x86_64 3/3
Verifying : nodejs-1:10.24.0-1.module+el8.3.0+9671+154373c8.x86_64 1/3
Verifying : nodejs-full-i18n-1:10.24.0-1.module+el8.3.0+9671+154373c8.x86_64 2/3
Verifying : npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+9671+154373c8.x86_64 3/3
Installed:
nodejs-1:10.24.0-1.module+el8.3.0+9671+154373c8.x86_64 nodejs-full-i18n-1:10.24.0-
1.module+el8.3.0+9671+154373c8.x86_64
npm-1:6.14.11-1.10.24.0.1.module+el8.3.0+9671+154373c8.x86_64
Complete!
Once Node.js is installed, you can verify the Node.js version using the following command:
node --version
v10.24.0
npm -v
6.14.11
+ @emotion/[email protected]
+ @emotion/[email protected]
+ @mui/[email protected]
+ [email protected]
added 102 packages from 108 contributors and audited 102 packages in 41.802s
found 0 vulnerabilities
Reference followed:
https://www.atlantic.net/dedicated-server-hosting/how-to-install-node-js-and-npm-on-oracle-linux/
Develop REST API’s for Oracle Database with Python 3 and Flask
https://medium.com/oracledevs/develop-rest-apis-for-oracle-database-with-python-3-and-flask-
bb58f851a52e
https://dev.to/farisdurrani/connecting-oracledb-with-nodejs-on-oracle-linux-8-1phm
https://www.digitalocean.com/community/tutorials/how-to-create-your-first-web-application-
using-flask-and-python-3