DEV Community

Cover image for Repurpose Old Laptop to Host Jupyter Lab
Ahmad Abdullah Tariq
Ahmad Abdullah Tariq

Posted on • Updated on

Repurpose Old Laptop to Host Jupyter Lab

If you have an old laptop sitting around in your home, instead of giving it away it is a great idea to make it a remote server to practice your development skills. You can use it to deploy the host website (PS: it is advised to use cloud service to productionize. Since it provides 100% uptime and will save you the hassle of securing the server). Neither the less it provides a really great opportunity to learn setting up a remote server.

Theoretically, you can use any operating system you prefer. In this tutorial, we will be setting up remote access on an Ubuntu OS (version 20.04 precisely). Hosting a Jupyter Lab instance on a remote laptop and accessing it via SSH.

Setup on Remote Laptop

  • Open a terminal and make sure everything is up to date on your remote laptop:
    sudo apt-get install update
    sudo apt-get install upgrade
Enter fullscreen mode Exit fullscreen mode
  • Now to enable your laptop as a remote server you need to install ssh server tools via following command.
    sudo apt-get install OpenSSL-server
Enter fullscreen mode Exit fullscreen mode
  • Now you just need to copy the IP address from this machine which we will need to access the remote laptop. You can find that by running the following command.
    ip addr  
Enter fullscreen mode Exit fullscreen mode
  • (Optional) you can install htop which gives you information about your server resources. free command gives you the stats about memory.
    sudo apt-get install htop
    free 
Enter fullscreen mode Exit fullscreen mode

Connecting from Laptop

  • Fire up the terminal and connect via following command. On entering the following command you'll be prompted to enter the password of your remote laptop. Type your password and hit enter. Wola you are now connected to your remote desktop. Note: change remote to your remote laptop name and 127.0.0.1 to IP that you copied from the other system.
    ssh remote@127.0.0.1
Enter fullscreen mode Exit fullscreen mode
  • Once you are on your remote desktop you can use it for any application you like. We are going to start a Jupyter lab host. The following command will start jupyter lab on your remote laptop on the default port which is 8888. Copy the URL.
    jupyter lab -no-browser
Enter fullscreen mode Exit fullscreen mode
  • Open another terminal and write following command. This will again prompt you to enter the password and if there is no error this means that you have successfully connected to your remote machine.
    ssh -N -f -L localhost:8888:localhost:8888 remote@127.0.0.1
Enter fullscreen mode Exit fullscreen mode
  • Now paste the copied URL from the other terminal in your browser and you have jupyter lab connected from your remote laptop. To understand what all the flags in the above command mean you can visit this website.

  • Bonus: If you want to operate your remote laptop with the lid down you can take following steps

     sudo nano /etc/systemd/logind.conf
Enter fullscreen mode Exit fullscreen mode

Uncomment HandleLidSwitch and change it to 'ignore' if it isn't already. (ctrl+x to save and exit)

    HandleLidSwitch=ignore
Enter fullscreen mode Exit fullscreen mode

Now you need to restart the system daemon and you can use your remote laptop with the lid down.

     sudo systemctl restart systemd-logind
Enter fullscreen mode Exit fullscreen mode

Top comments (0)