The following walk-through guides you through the steps needed to set up your environment to run Cassandra in Oracle Cloud Infrastructure.
You have deployed a VM 2.1 with Oracle Linux 7.9 (OEL7) in Oracle Cloud Infrastructure (OCI).
- The installation of Oracle Linux 7.9 is using pip3.6 by default.
- Python 3.6 or higher is installed
- You have access to root either directly or via sudo. By default in OCI, you are connected like "opc" user with sudo privilege.
The install is pretty simple. It consists of setting up python, installing python components and libraries. Lets start with setting up the Python Environment
By default, OEL7 runs Python 3. The first is to install pip and virtualenv.
The next step is to install virtualenv. Virtualenv enables us to create isolated sandpits to develop Python applications without running into module or library conflicts. It's very simple to install
sudo pip3.6 install virtualenvNext we can create a virtual environment and enable it.
virtualenv -p /usr/bin/python3 myvirtualenv
# Activate the env
source myvirtualenv/bin/activateRunning the following command will show what Python models we have installed at this point.
(myvirtualenv) [opc@lab1 ~]$ pip3 list
Package Version
---------- -------
pip 21.1.3
setuptools 57.1.0
wheel 0.36.2
WARNING: You are using pip version 21.1.3; however, version 21.2.1 is available.
You should consider upgrading via the '/home/opc/myvirtualenv/bin/python -m pip install --upgrade pip' command./home/opc/myvirtualenv/bin/python -m pip install --upgrade pippip3 install jupyterlabpip install pandas
pip install pandarallel
pip install dask
pip install seaborn
pip install matplotlib
pip install plotly
pip install -lxml==4.6.3
pip install selenium
pip install beautifulsoup4
pip install scikit-learnpip install kafka-python (v2.0.0)
pip install Flask
pip install gunicornpip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextension enable execute_time/ExecuteTimeCreate a script to instantiate automatically and reboot jupyterlab with "opc" user.
vi /home/opc/launchjupyterlab.shYou must use the virtualenv created and you can launch Jupyterlab in a specific port (for example: 8001) and listen on public IP.
#!/bin/bash
# Activate myvirtualenv Environment
source myvirtualenv/bin/activate
cd /home/opc
if [ "$1" = "start" ]
then
nohup jupyter-lab --ip=0.0.0.0 --port=8001 > ./nohup.log 2>&1 &
echo $! > /home/opc/jupyter.pid
else
kill $(cat /home/opc/jupyter.pid)
fiWe must put the script in executable mode in order to be executed from jupyterlab service.
chmod 777 /home/opc/launchjupyterlab.shsudo -ivi /etc/systemd/system/jupyterlab.service[Unit]
Description=Service to start jupyterlab for opc
Documentation=
[Service]
User=opc
Group=opc
Type=forking
WorkingDirectory=/home/opc
ExecStart=/home/opc/launchjupyterlab.sh start
ExecStop=/home/opc/launchjupyterlab.sh stop
[Install]
WantedBy=multi-user.targetsystemctl start jupyterlab
systemctl status jupyterlab
systemctl enable jupyterlabNow, you must reboot your machine to check if jupyterlab script is enabled by default on port defined 8001.
You must open port 8001 to your virtual machine VM 2.1 in order to access using your Public IP.
firewall-cmd --permanent --zone=public --list-ports
firewall-cmd --get-active-zones
firewall-cmd --permanent --zone=public --add-port=8001/tcp
firewall-cmd --reloadIf you're running directly on a virtual machine and have a browser installed it should take you directly into the jupyter environment. Connect to your "http://xxx.xxx.xxx.xxx:8001/".
And you should see the next Python Web environment "Jupyterlab".