<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jupyter Archives - LinuxTuto</title>
	<atom:link href="https://www.linuxtuto.com/tag/jupyter/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.linuxtuto.com/tag/jupyter/</link>
	<description>Linux Sysadmin and DevOps blog</description>
	<lastBuildDate>Thu, 28 Mar 2024 13:45:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.linuxtuto.com/wp-content/uploads/2022/01/cropped-LT_faveicon-32x32.png</url>
	<title>Jupyter Archives - LinuxTuto</title>
	<link>https://www.linuxtuto.com/tag/jupyter/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">201456972</site>	<item>
		<title>How to Install Jupyter Notebook on Debian 12</title>
		<link>https://www.linuxtuto.com/how-to-install-jupyter-notebook-on-debian-12/</link>
					<comments>https://www.linuxtuto.com/how-to-install-jupyter-notebook-on-debian-12/#comments</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Thu, 28 Mar 2024 13:45:02 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Jupyter]]></category>
		<category><![CDATA[Notebook]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=1719</guid>

					<description><![CDATA[<p>Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It&#8217;s...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-jupyter-notebook-on-debian-12/">How to Install Jupyter Notebook on Debian 12</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It&#8217;s widely used in various fields such as data science, machine learning, scientific computing, and education.</p>
<p>The term &#8220;Jupyter&#8221; is derived from the combination of three programming languages: Julia, Python, and R. These were the first languages supported by the Jupyter project, but now it supports many other programming languages through its interactive computing protocol.</p>
<p>In this tutorial, we will show you how to install Jupyter Notebook on Debian 12 OS with Apache web server</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 1: Update Operating System</span></h2>
<p>Update your <b>Debian 12</b> operating system to the latest version with the following command:</p>
<pre><code># apt update &amp;&amp; apt upgrade -y</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 2: Install Pip on Debian 12</span></h2>
<p><a href="https://www.linuxtuto.com/how-to-install-python-3-12-on-ubuntu-22-04/"><strong>Python</strong></a> comes already installed by default on Debian 12. You can verify it by checking its version:</p>
<pre><code># python3 -V</code></pre>
<pre><code>Output:
Python 3.11.2</code></pre>
<p>If it doesn&#8217;t, install <strong>Python</strong> with the following command:</p>
<pre><code># apt install python3</code></pre>
<p>Then use the following command to install <strong>pip</strong> and <strong>venv</strong> on Debian 12:</p>
<pre><code># apt install python3-venv python3-pip</code></pre>
<p>Verify your pip installation by checking its version:</p>
<pre><code># pip3 --version</code></pre>
<pre><code>Output:
pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 3: Install Jupyter Notebook Using Virtualenv</span></h2>
<p>First, create a directory and switch to it with the commands below:</p>
<pre><code># mkdir /var/www/notebook 
# cd /var/www/notebook</code></pre>
<p>Before you install Jupyter Notebook, you first need to create a Python virtual environment.</p>
<pre><code># python3 -m venv notebook_env</code></pre>
<p>Next, activate the virtual environment with the following command:</p>
<pre><code># source notebook_env/bin/activate</code></pre>
<p>Next, install Jupyter Notebook using the following command:</p>
<pre><code>(notebook_env) # pip install jupyter</code></pre>
<p>Once the installation is completed, run the Jupyter Notebook with the following command:</p>
<pre><code>(notebook_env) # jupyter notebook --allow-root</code></pre>
<p>Press the <strong>CTRL+C</strong> to stop the Jupyter Notebook.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 4: Generate Jupyter Notebook Password</span></h2>
<p>First, generate a Jupyter Notebook configuration file with the following command:</p>
<pre><code>(notebook_env) # jupyter notebook --generate-config</code></pre>
<p>You should see the following output:</p>
<pre><code>Writing default config to: /root/.jupyter/jupyter_notebook_config.py</code></pre>
<p>Then run the following command and enter your preferred password:</p>
<pre><code>(notebook_env) # jupyter notebook password</code></pre>
<p>Set a password as shown below:</p>
<pre><code>Enter password: 
Verify password: 
[JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json</code></pre>
<p>This can be used to reset a lost password or if you believe your credentials have been leaked and desire to change your password.</p>
<p>You can prepare a hashed password manually, using the function <code>jupyter_server.auth.passwd()</code>:</p>
<pre><code>&gt;&gt;&gt; jupyter_server.auth import passwd
&gt;&gt;&gt; passwd()
Enter password:
Verify password:
'argon2:$argon2id$v=19$m=10240,t=10,p=8$WGqsBZQPacu0FwsczXPlIQ$VXMyCfkJJZETyjdB6aWNSu/t0OrLAVhpkM15wKJYQRU'</code></pre>
<p>Then add the hashed password to your <strong>jupyter_notebook_config.py</strong> file:</p>
<pre><code>nano /root/.jupyter/jupyter_notebook_config.py</code></pre>
<pre><code>c.ServerApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$WGqsBZQPacu0FwsczXPlIQ$VXMyCfkJJZETyjdB6aWNSu/t0OrLAVhpkM15wKJYQRU'</code></pre>
<p>Now, deactivate from the Python virtual environment with the following command:</p>
<pre><code>deactivate</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 5: Create a Systemd service</span></h2>
<p>Next, it is a good idea to create a systemd service file to handle the <code>Jupyter Notebook</code> service. You can create it with the following command:</p>
<pre class="command"><code spellcheck="false"># nano /lib/systemd/system/jupyter.service</code></pre>
<p>Add the following lines:</p>
<pre><code>[Unit]
Description=Jupyter Notebook

[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/var/www/notebook/notebook_env/bin/jupyter-notebook --config=/root/.jupyter/jupyter_notebook_config.py --allow-root
User=root
Group=root
WorkingDirectory=/var/www/notebook/notebook_env
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target</code></pre>
<p>Save and close the file and then reload the systemd daemon with the following command:</p>
<pre><code># systemctl daemon-reload</code></pre>
<p>Then start the <code>jupyter service</code> and activate it at system startup with the following command:<span id="ezoic-pub-ad-placeholder-112" class="ezoic-adpicker-ad"></span></p>
<pre><code># systemctl start jupyter
# systemctl enable jupyter</code></pre>
<p>Edit the configuration file and enable remote access:</p>
<pre><code>nano /root/.jupyter/jupyter_notebook_config.py</code></pre>
<p>Uncoment and change the following line to <strong>True</strong>:</p>
<pre><code>c.ServerApp.allow_remote_access = True</code></pre>
<p>To implement the changes, you need to restart the <code>jupyter service</code>:</p>
<pre><code># systemctl restart jupyter</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 6: Configure Apache as a Reverse Proxy for Jupyter Notebook</span></h2>
<p>Jupyter Notebook is started and running on port 8888.You can install it via <code>apt</code> package manager by executing the following command.</p>
<pre><code># apt install apache2</code></pre>
<p>You can verify the status of the Apache service using the <strong>systemctl status</strong> command:</p>
<pre><code># systemctl status apache2</code></pre>
<p>Next run the following commands to enable necessary modules:</p>
<pre><code># /usr/sbin/a2enmod proxy
# /usr/sbin/a2enmod proxy_http</code></pre>
<p>Run the commands below to create a new VirtualHost file called <strong>jupyter</strong> in the /etc/apache2/sites-available/ directory.</p>
<pre><code># nano /etc/apache2/sites-available/jupyter.conf</code></pre>
<p>Paste the content as shown below:</p>
<pre><code> &lt;VirtualHost *:80&gt;
    ServerAdmin admin@your-domain.com
    DocumentRoot /var/www/html/
    
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    ProxyPass / http://127.0.0.1:8888/
    ProxyPassReverse / http://127.0.0.1:8888/&gt; 

    ErrorLog /var/log/apache2/your-domain.com-error_log
    CustomLog /var/log/apache2/your-domain.com-access_log common

 &lt;/VirtualHost&gt;</code></pre>
<p>Remember to replace <strong><code>your-domain.com</code></strong> with the domain name of your server.</p>
<p>Then save and exit the configuration file.</p>
<p>To enable this site run the following command:</p>
<pre><code># ln -s /etc/apache2/sites-available/jupyter.conf /etc/apache2/sites-enabled/jupyter.conf</code></pre>
<p>To implement the changes, you need to restart the Apache webserver:</p>
<pre><code># systemctl restart apache2</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 7: Accessing Jupyter Notebook Web Interface</span></h2>
<p>Open your web browser using the URL <code class=" prettyprinted"><span class="pln">http</span><span class="pun">:</span><span class="com">//<code>your-domain.com</code></span></code>. You should see the Jupyter login page:</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-large wp-image-1720" src="https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-900x281.webp" alt="Jupyter Login Page" width="900" height="281" srcset="https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-900x281.webp 900w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-300x94.webp 300w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-768x240.webp 768w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-1536x480.webp 1536w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-1222x382.webp 1222w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-897x280.webp 897w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login-684x214.webp 684w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_login.webp 1916w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<p>Enter your password and click on the <strong>Login</strong> button. You should see the dashboard on the following screen:</p>
<p><img decoding="async" class="aligncenter size-large wp-image-1721" src="https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-900x416.webp" alt="Jupyter Dashboard" width="900" height="416" srcset="https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-900x416.webp 900w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-300x139.webp 300w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-768x355.webp 768w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-1536x711.webp 1536w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-1222x565.webp 1222w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-897x415.webp 897w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard-684x316.webp 684w, https://www.linuxtuto.com/wp-content/uploads/2024/03/jupyter_dasboard.webp 1915w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<h2><span class="has-inline-color has-vivid-purple-color">Comments and Conclusion</span></h2>
<p>That’s it. You have successfully installed <code>Jupyter Notebook</code> on Debian 12.</p>
<p>For additional help or useful information, we recommend you to check  <a href="https://docs.jupyter.org/en/latest/" target="_blank" rel="noopener">the official Jupyter Notebook documentation.</a></p>
<p>If you have any questions please leave a comment below.</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-jupyter-notebook-on-debian-12/">How to Install Jupyter Notebook on Debian 12</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-install-jupyter-notebook-on-debian-12/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1719</post-id>	</item>
	</channel>
</rss>
