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
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
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
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
Now, this is the most important step to set up your Raspberry Pi, run:
sudo raspi-config
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
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
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)
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.
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.
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.
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
[Total Cost of Ownership needed]
Interesting, well
Raspberry Pi :- 40$
SD Card :- 4$
Wifi dongle:- 5$
Raspberry Pi 3 B+ comes with Wifi included 😃 raspberrypi.org/products/raspberry...
I bought the one from Element14:
amazon.com/ELEMENT-Element14-Raspb...
Yeah. I have that too 😊
Wifi dongle:- 5$ (optional) ;)
TCO should include installation and power consumption costs.
also hourly rate of the person installing and running that thing
Oh Yeah 😂😅
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)
Well better than a 5$ digitalocean server.
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.
Well, as I mentioned it’s good for small team managing small projects. It can easily take the load.
You said it was better than DigitalOcean in terms of performance
Yes, better than a 5$ server
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.
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?
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.
I understand that but still for a small team with small project there won’t be problem. Trust me.
wait, really? or sarcasm? :3
Well, it’s kind of real bro.
That's fantastic. What tools do you use to do dev on it ?
Nginx, NodeJS and MongoDB so Far.
No, no way it better than a $5 DO server
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!
You mean how to add domain name in a local server ?
Exactly, that type of stuff. As a front end developer I struggle sometimes with things like local servers, SSH, etc
Ohk then, I will try to write about that too.
nice clickbaity title!!
It's fun to create one, but...
Never Use it for Production
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.
Even for development, I won't recommend this
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.
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 :-)
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.
It is going to be very interesting. 😉
I know you are going to use that on second raspberry pi in office 😂😂
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.
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
...or
Well, Now you know what to do with it. Go for it. 😊
Not really. It can work offline.
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.
Exactly