DEV Community

Cover image for Make a Linux dev server for less than 50$/life 😱
Sarthak Sharma for XenoX

Posted on

Make a Linux dev server for less than 50$/life 😱

In case you didn't already know this, Raspberry Pi is an absolutely brilliant piece of hardware. It is gold when it comes to doing fun and crazy experiments, and I personally think it's a device that every developer should own. There are a lot of things that you can do with a Raspberry Pi, but in this article, we are going to make a dev server for your team. So let's get started 👨🏻‍💻

1. Prerequisites

First things first, this is ideal if you have a small team working in the same office as you or if you work alone. If that's not the case, don't worry, I have this coupon for you. Anyways, to start, you need the following things in starting.

Hardware

1. Raspberry Pi (duh!)
2. Wifi dongle or Ethernet Cable
3. Micro SD Card(8GB+)
4. HDMI Cable*
5. Monitor*
6. USB keyboard*

*optional

Software

7. BalenaEtcher 👉🏼 Download
8. Raspbian Stretch Lite 👉🏼 Download
or
8. Ubuntu 👉🏼 Download

2. Booting the Micro SD

For this, we will use BalenaEtcher. Although it's completely optional, if you are a beginner, you'd prefer this. This makes it really easy to install and saves a lot of time.


If not, these commands can be used:



diskutil list


Enter fullscreen mode Exit fullscreen mode

Recognize your card using this command as this command will give you a list of all the drives available

Next, unmount your disk using:



diskutil unmountDisk /dev/disk3


Enter fullscreen mode Exit fullscreen mode

Now flash your card using this command, and do remember to change values according to your computer:



sudo dd bs=1m if=/Path/to/image/ubuntu-16.04-preinstalled-server-armhf+raspi3.img.xz  of=/dev/disk3 conv=sync


Enter fullscreen mode Exit fullscreen mode

To check status, press cntrl+t. If something breaks, check this guide.

3. Running the Raspberry Server

So in this section, I will demonstrate how to set up your server with the Raspbian image. When you plug in power and see something like this, that means you are good to go, give it some time to boot up.

NOTE: If you have Ethernet cable, you don't even need a monitor, though if something goes wrong with bootup, you won't be able to debug it. So it's good to have one.

After bootup, It will ask you for username and password. Following are the default values:

Default Username: pi
Default Password: raspberry

Once you are logged in, check if the internet is working fine by running ping 8.8.8.8. If everything is working fine, these are the commands that you need to run next.



apt-get install update 
apt-get install upgrade


Enter fullscreen mode Exit fullscreen mode

Now, this is the most important step to set up your Raspberry Pi, run:



sudo raspi-config


Enter fullscreen mode Exit fullscreen mode

This command is your friend. Using this, you can configure pretty much anything in Raspberry Pi. Here are a few useful ones:

Go wireless with a Wifi Dongle

Add a Wifi name and password, and boom! You are done.

Enable/Disable SSH

Expand Filesystem

By default, all the space on your SD card won't be available to you, but using this, you can have all that good space.

Connect to Internet While Boot Up

Most important, this will ensure that your server is connected to the internet.

4. Connect to your server 🥳

Finally, connecting now is really easy. Just use command:



ssh pi@your-ip-address


Enter fullscreen mode Exit fullscreen mode

Note:
1. If you don't know your IP address, use/sbin/ifconfig wlan0
2. You should be on the same network as the Raspberry Pi

Now, let's install nginx on our server with this simple command.



sudo apt-get install nginx


Enter fullscreen mode Exit fullscreen mode

After this, open your browser and add the IP address of the Raspberry Pi. If everything is good, you will see this.

CONGRATULATIONS! YOUR SERVER IS UP AND RUNNING!!

Conclusion

I hope you guys will enjoy doing this as much as I did. I will make sure to post more such experiments. If you get stuck somewhere, feel free to ask questions in the comments section below.
Okay guys, I have to go now. Throwing a party in the office with all that 🤑 money 🤑 we saved today. 😂😆

Top comments (66)

Collapse
 
david_j_eddy profile image
David J Eddy

It'll be better than a $5 VPS for three main reasons:

1) VPS = virtual private server. You are on shared hardware with a throttle cap
2) Since the Pi ins on-prem network latency is nearly no-existent.
3) $30 hardware > $5 rented virtual.

I run a Pi w/ Pi-hole as my DNS / ad-blocker on my home network; pref. test before and after show nearly no measurable difference in throughput speeds.

Collapse
 
george profile image
George Nance

One bad thing I have noticed about the pi is with external storage. The USB ports and ethernet port share the same bus, so your speed will be pretty bad if you are downloading something large . I used to use mine to seed linux distros and I only got 1-2mb down max. Things may be different if you use wifi.

Thread Thread
 
petarov profile image
Petar G. Petrov • Edited

That one bad thing could actually be a pretty major one, I believe. Having a bunch of PIs for private projects is cool, I've got several myself. Once you start sharing with other people and having the PIs do lots of I/O, things get somewhat sluggish.

Thread Thread
 
becomingcoder profile image
Jason Scott

With the extremely cheap costs of microSD cards...this should be a none issue. 256GB cards are nearing $30. There's always an upfront cost with having on-site hardware. Using DO you're also paying for convenience. Also if you decide you're done using the pi for a server.....use it for other side projects. I think for teams this would be a bad idea but for a one/two person show....this is easily cheapest option.

$30 - Rpi 3 with wifi built in
$40 - 256GB microSD

Collapse
 
kayis profile image
K

[Total Cost of Ownership needed]

Collapse
 
sarthology profile image
Sarthak Sharma

Interesting, well

Raspberry Pi :- 40$
SD Card :- 4$
Wifi dongle:- 5$

Collapse
 
tiguchi profile image
Thomas Werner

Raspberry Pi 3 B+ comes with Wifi included 😃 raspberrypi.org/products/raspberry...

I bought the one from Element14:
amazon.com/ELEMENT-Element14-Raspb...

Thread Thread
 
sarthology profile image
Sarthak Sharma

Yeah. I have that too 😊

Collapse
 
david_j_eddy profile image
David J Eddy

Wifi dongle:- 5$ (optional) ;)

TCO should include installation and power consumption costs.

Thread Thread
 
kayis profile image
K

also hourly rate of the person installing and running that thing

Thread Thread
 
sarthology profile image
Sarthak Sharma

Oh Yeah 😂😅

Collapse
 
thomasredstone profile image
Thomas Redstone

Nice article, but it ain't for life!
The SD will almost certainly die sooner or later, the actual Pi might last a very long time though, maybe $100 over your lifetime (assuming your Pi just keeps going)

Collapse
 
sarthology profile image
Sarthak Sharma

Well better than a 5$ digitalocean server.

Collapse
 
vezyank profile image
Slava

How did you measure that? In my experience, DigitalOcean has some pretty great performance. Raspberry PI uses a low power ARM processor, DO has Xeon processors. My DO hosts a build server, don’t know a PI could manage.

Thread Thread
 
sarthology profile image
Sarthak Sharma

Well, as I mentioned it’s good for small team managing small projects. It can easily take the load.

Thread Thread
 
vezyank profile image
Slava

You said it was better than DigitalOcean in terms of performance

Thread Thread
 
sarthology profile image
Sarthak Sharma

Yes, better than a 5$ server

Thread Thread
 
vezyank profile image
Slava

Yeah going to step in now and dispel this misinformation. DigitalOcean has x86 processors clocking at 2.4GHZ, the Raspberry PI has a 1.4GHZ ARM CPU. DigitalOcean features DDR4 RAM, the PI is on LPDDR2.

You simply cannot even compare them. You're unlikely to ever hit 1/10th of the performance a DO VPS offers.

Thread Thread
 
sarthology profile image
Sarthak Sharma

Totally Agree with you. But the thing is in most of the cases Beginner developer doesn't even need that much of processing speed to run their small projects and the fact is 5$ is the least you can pay. So It's better than 5$ digital ocean droplet, isn't it?

Thread Thread
 
vezyank profile image
Slava

Whatever computer you're using in the moment is likely better. Dev servers are usually supposed to have much better performance than any other device, not less.

Thread Thread
 
sarthology profile image
Sarthak Sharma

I understand that but still for a small team with small project there won’t be problem. Trust me.

Collapse
 
d1p profile image
Debashis Dip

wait, really? or sarcasm? :3

Thread Thread
 
sarthology profile image
Sarthak Sharma

Well, it’s kind of real bro.

Thread Thread
 
geefygeorge profile image
David Salter

That's fantastic. What tools do you use to do dev on it ?

Thread Thread
 
sarthology profile image
Sarthak Sharma

Nginx, NodeJS and MongoDB so Far.

Collapse
 
gijovarghese profile image
Gijo Varghese

No, no way it better than a $5 DO server

Collapse
 
guidovizoso profile image
Guido Vizoso

Adding this to the reading list! If you could follow up this tutorial with things like a domain for the server and security it'll be great for us beginners.

Great article!

Collapse
 
sarthology profile image
Sarthak Sharma

You mean how to add domain name in a local server ?

Collapse
 
guidovizoso profile image
Guido Vizoso

Exactly, that type of stuff. As a front end developer I struggle sometimes with things like local servers, SSH, etc

Thread Thread
 
sarthology profile image
Sarthak Sharma

Ohk then, I will try to write about that too.

Collapse
 
gijovarghese profile image
Gijo Varghese

nice clickbaity title!!

It's fun to create one, but...

Never Use it for Production

  • AWS, Google cloud has free vms which has much better specs (cloud.google.com/free/)
  • A $5/month DigitalOcean is much faster, and only costs $60 for a year
  • Cloud providers like Google automatically upgrade your hardware with latest CPU without any downtime
  • You can only build the server for $50, you need to pay for the internet usage and electricity
  • Upload speed for normal internet connections are way slow, hosting providers speed are way fast
  • Cloud providers like DO, Google, AWS use high-speed networks powered by Fibre cables
  • $1/month extra, you can get backups
  • What if there is a hardware failure? How will you keep your site up? Order another raspberry pi?
  • Horizontal and Vertical scaling will be difficult
Collapse
 
sarthology profile image
Sarthak Sharma

It’s a Dev Server for small teams to test their apps locally on one network ( If you have read the article you can tell 😁). Obviously this can’t be used for production and in that case all your reasoning is valid.

This article is for beginners.

Collapse
 
gijovarghese profile image
Gijo Varghese

Even for development, I won't recommend this

Thread Thread
 
sarthology profile image
Sarthak Sharma

Yeah, it’s fine no problem. I respect your recommendations but still working fine for me so gonna use it as long as I can.

Collapse
 
aleon1220 profile image
Andres Leon

This is a nice server for HTTP server e.g. nginx. How about an article describing how to have a dev server running containers and connected to a physical storage to store nice data.
like a raspberry connected to a small 1 TB external hard drive and the raspberry is a kubernetes cluster that contains webapps, demos, static pages, etc :-)

Collapse
 
dmitriip profile image
DmitriiP

Not saying that this approach is bad or anything, just want to point out a potential concern with this setup. One will most likely develop code on an x86 machine, use the same architecture for production as well, and Pi is based on ARM. Although most of the packages should be available for both platforms, no one can guarantee that the behavior will be always 1-to-1. So if you have a case of "it works on my machine" this might be the case.

Collapse
 
vaibhav profile image
Vaibhav

It is going to be very interesting. 😉

Collapse
 
sarthology profile image
Sarthak Sharma

I know you are going to use that on second raspberry pi in office 😂😂

Collapse
 
george profile image
George Nance

This is a great tutorial! I love the raspberry pi.

Mine unfortunately has been collecting a-lot of dust because I haven't found a project that interests me enough to put on there.

Collapse
 
tiguchi profile image
Thomas Werner

I use mine at the moment as a remote git repository for syncing my personal branches across my desktop and notebook at home.

I also use it as a PostgreSQL database server for development and testing. It works reasonably well, but if you happen to forget using indexes you will notice that it can slow down to a crawl. Which is great! Because you will catch these errors super early in the process before it could hit a production environment.

Some ideas:

Attach a big external hard drive and

  • Use it as a cheap network storage device
  • Use it as media server or "smart TV" device connected to your TV

...or

  • Run Alexa or Google assistant services on your Raspberry Pi
Collapse
 
sarthology profile image
Sarthak Sharma

Well, Now you know what to do with it. Go for it. 😊

 
sarthology profile image
Sarthak Sharma

Not really. It can work offline.

Thread Thread
 
rafaelbadan profile image
Rafael • Edited

That's a great advantage comparing to remote Servers or cloud services if you live in poor internet connection areas. Having a local server outside your machine that let's you practice the work flow of uploading, installing, updating an app or whatever project you have, and test it, is really nice.

Thread Thread
 
sarthology profile image
Sarthak Sharma

Exactly