Code Done Right!

Required hardware

The list of hardware that you need is quite short. First of all you need a physical computer to act as your server. RaspberryPi is a perfect candidate! You do not need much else to start your journey. Take a look at the list of things you need

  • Raspberry Pi
  • Power supply
  • SD Card
For email capability
  • Domain
  • Internet access
Optional hardware
  • Ethernet cable
  • Raspberry Pi case
  • Additional storage

The total cost of the hardware that you need is around $50–$60. RPi 4B costs around $35 for the 2GB version, power supply is between $5–$10, ethernet cable in your local market should be around a $1 and a decent SD Card will cost about $10.

Raspberry Pi

Raspberry Pi 4B
Raspberry Pi 4B. Image credit Raspberry Pi Foundation

Get one with an ethernet port, this is the most important part. Ethernet port will allow for a cable connection to your router and in turn provide a more stable connection than Wi-Fi.

If you do not plan to have a server with many users and many services you can get the cheapest version (2GB for $35) or even a previous model. If you are looking for the best performance get the newest Pi4B with 8GB RAM ($75).

Cheap alternative

If you have no idea if running a server is for you you can get Pi Zero W for just $10. It has no ethernet port but it does have Wi-Fi, which means that you can still test everything on it. Should you decide that you actually want to host a server, you can drop $75 for the newest model. Pi Zero, that you will be left with, will enable you to mirror your main server and test new features before uploading them to your production server – neat! Or you can make a retro gaming console out of it, or learn Linux – possibilities are endless.

Grab an OTG USB cable as well, it costs a $1 and allows the use of USB hubs, as Pi 0 has but one micro USB OTG port. Don’t complain, the idea was to make a really small and cheap computer.

There are three models of Pi Zero! The basic Pi Zero has no GPIO headers and no Wi-Fi, and in turn is of no use to us as we are looking for a cheap and out-of-box solution! Pi Zero W has no GPIO headers but has Wi-Fi, we do not care about GPIO, but we do want out-of-box internet connectivity. Get this model! There is also Pi Zero WH, same as Pi Zero W, but is has pre-soldered GPIO headers. If you want, you can get this one for use in DIY projects. If you are not into DIY and prefer software side of things then skip the WH version. Cost is as follows $5/$10/$15 for Pi 0/Pi 0W/Pi 0WH. respectively

You can find a local authorized reseller on the official Raspberry Pi Foundation website.

Choosing model based on operating system

Tutorials on this page will focus on Raspbian as I am using RPi4B. Everything will be applicable to any Raspberry Pi model, provided you are running Raspbian. Debian GNU/LINUX and Ubuntu servers might require some modification of commands and/or packages that are being installed but you should be able to follow on those systems as well without much difficulty since both Raspbian and Ubuntu are forks of Debian.

Raspbian – The official RaspberryPi OS will run on any Pi. SD Cards with Raspbian installed are generally interchangeable between models, unless you install something model-specific that changes the standard functionality

Debian GNU/LINUX – It is also possible to run a Debian distribution on Raspberry. Unfortunately it does not run on RPi4, more information can be found on debian.org

Ubuntu Server – Can be run on Pi as well, check out which version you need on Ubuntu.com.

Power supply

Raspberry Pi power supply
Official Raspberry Pi power supply. Image credit Raspberry Pi Foundation

All electronic devices require power, RPi is no different. You will need a charger.

CAUTION when using Pi4 it is advised to use the official power supply unit. Due to some mishaps in engineering department, RPi can throttle itself due to lack of power, not power up properly or not supply enough power to peripherals with a third party power supply unit! With RPi4 use only the official power supply unit!

Other Pi versions can be powered with your nearest mobile phone charger. Make sure that it is of good quality and outputs 5V and at least 1A.

Raspberry case

FLIRC Raspberry Pi 4B case
FLIRC Raspberry Pi 4B case. Image credit FLIRC

It is also important to invest in a good case for your Raspberry. Get one with cooling – either active in form of a fan, or passive in form of a case like FLIRC shown above. You will get away with a case without cooling as well, but bear in mind that your server might get hot. But unless you exceed 85 Celsius there is nothing to worry about.

Active cooling means fan noise, but the case should be very cheap. Passive cooling is a bit more expensive but you have an absolutely silent server. Performance-wise there is no difference. The choice is yours.

My RPi runs enclosed in the FLIRC case with passive cooling. At idle, the CPU temperature is around 41°C. According to some testers, on full CPU load the temperature should not exceed 60°C. Take a look below at temperature comparison chart to see the difference.

Temperature comparison
Temperature comparison

The spike between 5:00am and 5:30am is caused by antivirus scan.

With the FLIRC case the average temperature dropped 10°C, that is a 20% drop! Moreover, the maximum temperature in FLIRC case is the same as the lowest recorded without any cooling.

It might seem like I am advertising here, but I want to show you how important, in the long run, a good case actually is. I just really like the look of the case and the cooling does its job very well. There are dozens if not hundreds of cases out there for you to choose from!

Word on cases to avoid

Do not buy a case that encloses the Pi, does not let it breathe and has no passive cooling! RPi will constantly overheat and throttle. No holes, no ventilation – no use to us. Do not buy an oven for your RPi.

Another thing to consider are cases that are too fancy for their own good. Check out access to all ports, how easy it is to take out the SD card. I bought a $5 iron case for Pi Zero and that is money I am never getting back. I could have powered my server for the whole year with that!

If you are in a hurry, get the cheapest case that looks like it will be ‘accessible’ enough. You can buy a proper case once you familiarize yourself with the RPi and you will understand what do you actually need. Maybe the RPi will sit next to your TV in a fancy box to be displayed? Maybe you will decide to keep your Pi on the wall and you will need a case with a wall mount? Get it? Pi on the wall? Yeah… Sorry about that…

Ethernet cable

Ethernet cable
Typical ethernet cable

Any ethernet cable will do. You can grab one from your local supermarket. Make sure it is long enough to connect your Raspberry to your router and that is it.

SD Card

Micro SD card with micro SD card adapter
Typical micro SD card with SD adapter

Required hardware list just would not be complete witout an SD card. You need at least 4GB one. Furthermore, it should be UHS-1 Class or above as well. Do not get one that is larger than 32GB it will complicate the setup process and it is best to keep files on a different medium anyways. You will end up paying for storage you do not need.

CAUTION do not get an RPi card with NOOBS pre-installed. Those cards are usually overpriced, low on storage (usually 8GB or 16GB) and you will install a minimal Raspbian over them anyways. Those cards are for people who are 6 or 60.

Domain

Mouse, rodent
I have no idea for a domain picture, here is a mouse instead

If you want to have email capability, proper website name and encryption certificate get a domain. In order to receive an email to some_account@mydomain.com you need control over a domain called mydomain.com

Before you buy a domain you can get one for free and use it for the testing. They are usually free for a month or two, after which you have to pay to continue using it. For testing purposes it is totally fine to get a free domain that you will discard later on.

A good source of free domains is freenom.com. They will supply you with a domain on the other side of the globe totally for free for three months. That is more than enough time to learn how to set up everything.

You can decide if you want to buy an address later, but bear in mind that if you are planning a website that is supposed to have actual reach it is unwise to change the name every three months. You will lose your readers and your rank in search engines. Use those three months from Freenom to think of a good domain name and use domain hacks for more pizzazz!

Bonus: PoE Hat

If you have a router that supports PoE (Power over Ethernet) you can buy a PoE Hat for your RPi. It is an accessory that allows for ditching the power supply! You can power your Pi directly from your router. This device does require a router supporting PoE. Hold off with PoE until you know why you should get it.

Bonus: UPS

You can also get a UPS (Uninterruptible Power Supply) Hat for your Pi. This is an accessory that will protect your Pi against a power outage. Depending on the UPS you get, your Raspberry might survive even a full day without any power coming from your wall socket!

Why is that of interest to us? SD card errors. Unfortunately your SD card might easily get corrupted if you lose power and do not shut down the Pi before that happens. There is nothing you can do to prevent accidental corruption with an abrupt power outage, but you can prevent the power outage. Mind you that your server will still be unreachable, as your router will most likely go down with the rest of your home appliances, but at least when the power comes back your Pi will not have a corrupt card! Neat!

This is not considered to be required hardware, but a highly recommended one when running a server. You can also get a standalone UPS that will be plugged between your main power supply and your Pi. Such a UPS is usually used in a professional setup and quite expensive.

Word of caution with UPS hats

This is an accessory that will draw power 24/7 and direct it either to a battery or to your RPi. Get something that actually is trustworthy. UPS hat is not something you want to get from Aliexpress. Get it from a trusted source! Same goes for the battery. I had one dying on me right on my desktop due to a chip failure. Not a pretty smell, not to mention the danger of fire or explosion.

Conclusion

Required hardware list for a Raspberry Pi powered server is short, cheap and also a good way to start learning about self-hosting or working with web in general.

The total cost of required hardware can be as low as $20 if you buy everything brand new. The only recurring charge is the domain, but if you look around, you might just find a provider that will set you up with a cheap one. I paid $15 to get mine for 10 years.

You will also have to pay for internet and electricity, but you have internet anyways and that $5 for powering the RPi is just negligible.

Bonus: my setup

I have a pretty basic setup as the main server

I also have a backup Pi for testing purposes.

  • Pi Zero W
  • Nearest phone charger
  • Cheapest USB HDD case I could find
  • Leftover HDD from a laptop
  • SanDisk Ultra 32 GB
  • Total price: US$25

It is unwise to test services on a live production server. Get yourself a cheap Pi0 for testing!

2 thoughts on “Required hardware

  1. Leilf Falkenström

    Thank you for sharing this great guide. Have just got thro the first part and would like to ask if it would be doable to have an mail server on a domain you can get by duckduckgo or by your routers dns service like asus have?

    1. CodeDoneRight Post author

      Any domain that you can point to a specific IP will do. It is more important to make sure that the IP you are pointing to can send / receive email.

      Open ports for that system, set up a service on a particular port and check here https://www.yougetsignal.com/tools/open-ports/ – if your port is open the domain will work. Remember about port forwarding on router if you’re using home setup.

      Remember that ISPs tend to block email on their network so there’s no guarantee that it will work even if your setup is perfect.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.