Created
February 3, 2021 06:37
-
-
Save rajmayank/f10bd796910b3f2112df0a1b7289d8ca to your computer and use it in GitHub Desktop.
Create a Jupyerlab service on a Linux Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Base Dependencies | |
apt install -y python3-pip | |
apt-get install python3-venv | |
mkdir -p /var/jupyter_lab_home/ | |
python3 -m venv /var/jupyter_lab_home/venv | |
source /var/jupyter_lab_home/venv/bin/activate | |
# (optional) Get a password hash | |
# python3 -c "from notebook.auth import passwd; print(passwd('cactusLABs20'))" | |
# Finally, setup the service | |
pip install jupyterlab | |
pip install ipykernel | |
ipython kernel install --user --name=genuse | |
echo -e "[Unit]\nDescription=Jupyter Lab\n\n[Service]\nWorkingDirectory=/var/jupyter_lab_home/\nExecStart=/var/jupyter_lab_home/venv/bin/python3 -m jupyter lab --allow-root --ip 0.0.0.0 --NotebookApp.password='{{PASSWORD_HASH}}' | |
\n\n[Install]\nWantedBy=multi-user.target" > /etc/systemd/system/jupyter_lab.service | |
sudo chmod 644 /etc/systemd/system/jupyter_lab.service | |
# Enable the service to start on system boot | |
systemctl daemon-reload | |
systemctl enable jupyter_lab | |
systemctl restart jupyter_lab | |
systemctl status jupyter_lab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment