In this article, we will show you how to install the JupyterHub Bash kernel on your JupyterHub server so that the JupyterHub users can run the Bash codes on their Jupyter Notebooks.
NOTE: If you don’t have JupyterHub installed on your computer, you can read one of the following articles depending on the Linux distribution that you’re using:
1. How to Install the Latest Version of JupyterHub on Ubuntu 22.04 LTS/ Debian 12/Linux Mint 21
2. How to Install the Latest Version of JupyterHub on Fedora 38+/RHEL 9/Rocky Linux 9
Topic of Contents:
- Installing JupyterHub Bash Kernel for a Single User
- Installing JupyterHub Bash Kernel for All Users
- Conclusion
- References
Installing JupyterHub Bash Kernel for a Single User
If you’re a JupyterHub user and you don’t have super-user (root) privileges, you can install the Bash kernel on Jupyter Hub only for your JupyterHub account.
First, log in to your JupyterHub account and click on “Terminal” from the “Launcher” tab.
You should be able to access Python PIP on the terminal.
To install the JupyterHub Bash kernel Python module, run the following command:
The JupyterHub Bash kernel Python module is being installed. It takes a while to complete.
At this point, the JupyterHub Bash kernel Python module should be installed.
To install the JupyterHub Bash kernel for your JupyterHub account, run the following command:
For the changes to be visible, refresh the JupyterHub homepage and you should see “Bash” in the “Notebook” section of JupyterHub. Click on it to create a Bash Jupyter Notebook.
A new Jupyter Notebook should be created and the Bash kernel should be selected for the notebook.
You can run and document the Bash codes in this notebook in the same way as you do in Python codes.
Installing JupyterHub Bash Kernel for All Users
If you have administrative privileges on the JupyterHub server, you can install the JupyterHub Bash kernel for all the JupyterHub users. This saves a lot of hassle for the JupyterHub users as well as save a lot of disk space and reduce the data redundancy on the JupyterHub server.
To install the JupyterHub Bash kernel Python module on the JupyterHub virtual environment, run the following command:
The JupyterHub Bash kernel Python module should be installed on the JupyterHub virtual environment.
To install the JupyterHub Bash kernel (on the JupyterHub virtual environment) for all the JupyterHub users, run the following command:
As you can see, the JupyterHub Bash kernel is installed.
Now, any JupyterHub user can find an option to create the Bash notebooks on the JupyterHub “Launcher” tab.
To create a Bash Jupyter notebook, click on “Bash” from the “Notebook” section of the JupyterHub “Launcher” tab.
A Bash Jupyter notebook should be created.
You can run and document the Bash codes in this notebook in the same way as you do in Python codes.
Conclusion
In this article, we showed you how to install the JupyterHub Bash kernel on your JupyterHub server so that the JupyterHub users can run and document the Bash codes on their Jupyter Notebooks just as they do in Python codes.