Setup a Raspberry-Pi ubuntu server and use it from another computer in the same network

Behrad Kazemi
3 min readFeb 17, 2022

--

To make a long story short, I used my Macbook Pro laptop to run all server dependencies (backend, database, etc.) locally and work with so, it took lots of my hardware resources and made it laggy and slow while working.

One day I decided to buy cheap hardware like a Raspberry Pi 4 to run all those software on to free my laptop from running them along with my development.

Walkthrough

Buy Raspberry Pi 4 model B:

There are many websites and Amazon sellers that you can buy a Raspberry Pi from, but this link is a fast way to buy it from amazon:

https://www.amazon.co.uk/dp/B07TC2BK1X

https://www.amazon.co.uk/dp/B07TC2BK1X

https://www.digikala.com/product/dkp-7318494/

https://www.digikala.com/product/dkp-7318494/

Also, you need a +16GB microSD card as your storage.

Setting up that Raspberry Pi as an Ubuntu server.

It’s super easy!

Go to https://www.raspberrypi.com/software/ scroll a little bit and download the Raspberry Pi Imager.

After Installing the Raspberry Pi Imager, connect your microSD to your pc and select it as storage and select Ubuntu server (at this time v21 for arm64 architecture) then click on write.

Plug LAN cable and the microSD with ubuntu server flashed into the Raspberry Pi and USB-C cable to the power source (like your laptop USB).

Connect to the Raspberry pi using SSH

To connect to your raspberry over SSH you need to know its IP address.

So go to your router settings at 192.168.1.1 and see your Raspberry Pi IP address.

Then in your command-line, enter

ssh ubuntu@{raspberry-ip}

The default password is ubuntu, but it asks you to change it after the first login.

Now you have a Raspberry-Pi ubuntu server.

🎉✅

Your Raspberry Pi is ready to use

pull your repository from a git and run it locally at 0.0.0.0 instead of localhost or 127.0.0.1

Now you can access the APIs with a laptop on the same network with the Raspberry Pi

Commands and tips you may needed:

here are some command lines you may need to continue setting up to run your express backend project.

Change DNS:

cd /etc/netplansudo nano 10-rpi-ethernet-eth0.yaml

add your dns addresses to this file

sudo netplan apply

install ssh:

sudo apt install openssh-client

generating new ssh key:

ssh-keygen -t rsa -b 4096 -C “your_email@domain.com”

disable firewall:

sudo ufw disable

Update apt:

sudo apt updatesudo apt upgrade

install git:

sudo apt install git

install docker:

sudo apt install docker.io

install npm:

sudo apt install nodejs

install chromium:

sudo install chromium-browser

--

--