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. 😂😆

Discussion (68)

Collapse
manrix profile image
manrix

Hi.
Always wanted to try that. How are the performances ?
Thanks.

Collapse
sarthology profile image
Sarthak Sharma Author

Well better than a 5$ digitalocean server.

Collapse
knyzorg profile image
Slava Knyazev

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 Author

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

Thread Thread
knyzorg profile image
Slava Knyazev

You said it was better than DigitalOcean in terms of performance

Thread Thread
sarthology profile image
Sarthak Sharma Author

Yes, better than a 5$ server

Thread Thread
knyzorg profile image
Slava Knyazev

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 Author

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
knyzorg profile image
Slava Knyazev

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 Author

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 Author

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 Author

Nginx, NodeJS and MongoDB so Far.

Collapse
gijovarghese profile image
Gijo Varghese

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

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 Petrov • Edited on

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 (he/him)

[Total Cost of Ownership needed]

Collapse
sarthology profile image
Sarthak Sharma Author

Interesting, well

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

Collapse
tiguchi profile image
Thomas Iguchi

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 Author

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 (he/him)

also hourly rate of the person installing and running that thing

Thread Thread
sarthology profile image
Sarthak Sharma Author

Oh Yeah 😂😅

Thread Thread
samel profile image
Samuel El.

And internet costs too = )

Thread Thread
sarthology profile image
Sarthak Sharma Author

Not really. It can work offline.

Thread Thread
rafaelbadan profile image
Rafael • Edited on

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 Author

Exactly

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
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 Author

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 Author

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

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
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 Author

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 Author

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
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
christian102094 profile image
Christian Tapia

Sorry for this question, but what is a dev server?

Collapse
david_j_eddy profile image
David J Eddy

dev server => development server

Typically the first environment an application is deployed to after a developer has commited/pushed changes. Least restrictive, typically limited public internet access, but accessible by the development teams for debugging / trouble shooting.

Collapse
jecsham profile image
Jecsham

A server for deploy and test/debug your projects

Collapse
sarthology profile image
Sarthak Sharma Author

Well, something that’s not a production server, used by dev team or test team in house. 😊

Collapse
vaibhav profile image
Vaibhav

It is going to be very interesting. 😉

Collapse
sarthology profile image
Sarthak Sharma Author

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 Iguchi

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 Author

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

Collapse
lesha profile image
lesha 🟨⬛️

Ok but seriously. What differs this guide from tens to hundreds of other guides? How is this not just a rehash?

Is there not enough guides on how to burn iso to SD card? Is there not enough guides on raspi-config?

Collapse
treddson profile image
Taylor Short

Thanks, Sarthak! I’ve got a rasberry pi just lying around. This article really gave me some more motivation to try and use it!

Collapse
sarthology profile image
Sarthak Sharma Author

😊😊😊

Collapse
abdurrahmaanj profile image
Abdur-Rahmaan Janhangeer

brilliant 👍

Collapse
sarthology profile image
Sarthak Sharma Author

Thanks Abdur.

Collapse
jecsham profile image
Jecsham

Nice post!

Collapse
sarthology profile image
Sarthak Sharma Author

Thanks 😊

Collapse
tiguchi profile image
Thomas Iguchi

What's the name of your terminal font?

Collapse
sarthology profile image
Sarthak Sharma Author

Operator Mono

Collapse
kissu profile image
Konstantin BIFERT

Sad that Etcher is plagued by the Balena thing right now...was the best and simplest software ever before.
Far bigger size, some useless ads and not necessary stuff...

Collapse
sarthology profile image
Sarthak Sharma Author

That's why I always go for CLI.

Collapse
mortoray profile image
edA‑qa mort‑ora‑y

If the pi can now drive a 4K UHD HDMI signal then I might finally have to setup my media server.

Thanks for the clear instructions. It reduces the too-lazy-to-research hurdle. :)

Collapse
sarthology profile image
Sarthak Sharma Author

Thanks 😊

Collapse
dennisk profile image
Dennis Keirsgieter

Used my Pi3+ for a while but i found it to be slow (even with highclass sd card). Running NPM commands took way to much time for me in the end. Are you optimizing anything or?

Collapse
sarthology profile image
Sarthak Sharma Author

That’s weird. In my case, npm install worked like butter. 🤷🏻‍♂️

Collapse
kamalhm profile image
Kamal

Genuinely asking, how is this better than running a local dev server on your own pc?

Collapse
sarthology profile image
Sarthak Sharma Author

Dependency of others on your presence won’t be required.

Collapse
8detect profile image
Infinity Detective

yeah right just for dev purpose