Skip to content

Instantly share code, notes, and snippets.

@organisciak
Last active April 4, 2019 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save organisciak/886d310a1b209c3d2328db3b80830730 to your computer and use it in GitHub Desktop.
Save organisciak/886d310a1b209c3d2328db3b80830730 to your computer and use it in GitHub Desktop.
Jupyterhub as a service on RHEL

Place the below file in /lib/systemd/system/jupyterhub.service.

Then, run systemctl daemon-reload and start the service with service jupyterhub start. This will need to be done as root.

The file below runs as root, but you'll likely want to specify a more restricted User and WorkingDirectory. You may also need to add to the path in the Environment arg.

Additional environmental variables, like "GITHUB_CLIENT_ID", can be added with more Environment="VAR=value" lines.

[Unit]
Description=Jupyterhub
After=network-online.target
[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/conda/bin/"
ExecStartPre=/opt/conda/bin/activate
ExecStart=/opt/conda/bin/jupyterhub --JupyterHub.spawner_class=sudospawner.SudoSpawner
WorkingDirectory=/root/jupyter/
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment