On my last blog post, I described the steps to install a jupyter lab notebook on a local machine running MacOS.
This post will describe the steps to install a Jupyter lab on a compute instance running on Oracle Enterprise Linux 8 (OEL8) on Oracle cloud infrastructure.
Step 1: SSH to the the instance
ssh -i dev-instance-private.key opc@141.147.xx.xxx
Step 2: update and install Dependencies: (use dnf cmd for Oracle linux 8, yum for linux 7 and below)
sudo dnf update -y
Step 3: Install python and pip
sudo dnf install python3 -y
sudo dnf install python3-pip -y
Step 4: Verify Python and pip
python3 --version
python3 -m pip --version

Step 5: Create and Activate a Virtual Environment:
create a virtual environment.
python3 -m venv myenv
Activate the environment.
source myenv/bin/activate

Step 6: Install Jupyter lab
pip install jupyterlab
Step 7: Launch Jupyter lab
jupyter lab

Step 8: Access JupyterLab:
To access JupyterLab from outside the OCI instance, you need to open port 8888 (or the port you’re using) in your OCI security list.
Go to your OCI compute instance VCN and find the security list associated with it. Add an ingress rule to allow traffic on port 8888 (or the port you’re using)
Step 9: SSH Tunneling
To access the jupyter lab web browser, open another terminal and add the cmd:
ssh -i dev-instance-private.key opc@141.147.XX.XXX -L 8888:127.0.0.1:8888
The above cmd allows you to access the web browser of your jupyterlab running on the OCI compute instance in your local machine
After the above step, copy the given url on step 7 on your browser to access the notebook. ie.
http://localhost:8888/lab?token=8a4fe5599d5ec4565b0407a82161f2156a7f9acb6d331c4e

See also;