Creating a home server with CasaOS on Debian from that old dusty PC in your closet.
Tags: webdev, tutorial, serverless, beginners
Published: 2024-07-06 19:41:20

## Introduction
Setting up a home server can be an exciting project, especially when you aim to centralize backups, file sharing, and possibly even media streaming. Recently, I decided to repurpose my old desktop as a home server using Debian as the base operating system. During the process, I encountered a black screen issue caused by my graphics card, but removing the GPU resolved it since a home server doesn't require a dedicated graphics card. In this guide, I will walk you through the steps to install Debian on an old PC and then install CasaOS on your Debian home server.

## Prerequisites
1. An old desktop, laptop, Raspberry Pi, or any computer that can install Debian.
2. A USB/External drive (at least 8GB) for flashing.
3. Software such as [Rufus (Windows)](https://rufus.ie/en/) or [Etcher (Mac/Linux)](https://etcher.balena.io)to flash the Debian iso to the USB drive.
4. Basic knowledge of terminal commands.

## Step 1: Install Debian on Your Old PC

### Download Debian
1. Go to the [Debian website](https://www.debian.org/distrib/) and download the latest stable version of Debian. Choose the appropriate ISO file for your system architecture (usually `amd64` for modern PCs).

### Create a Bootable USB Drive
1. Use a tool like Rufus or Etcher to create a bootable USB drive with the downloaded Debian ISO file.
2. Insert the USB drive into your old PC.

### Boot from USB and Install Debian
1. Boot your old PC from the USB drive. You may need to change the boot order in the BIOS settings to prioritize USB boot, this is dependent on your MOBO bios.
2. Follow the on-screen instructions to install Debian. Here are some key points:
   - Select your language, location, and keyboard layout.
   - Configure the network (you can set up a static IP later if needed).
   - Set up the root password and create a new user.
   - Partition the disk (the guided option is recommended for beginners).
   - Select the software to install. At the software selection screen, choose:
     - Debian desktop environment
     - GNOME (or any of the preferred desktop environments, you could go 
       UI less and stick with terminal for performance but odds are you 
       won't have major issues with that using GNOME or a basic interface)
     - Web server
     - SSH server
     - Standard system utilities

Once Debian is up and running, be sure to update packages and that bash and curl commands are installed (bash should already be installed but feel free to check):
```
sudo apt-get update
```
```
sudo apt-get install bash
```
```
sudo apt-get install curl
```
You can verify installations:
```
bash --version
curl --version
```
### Troubleshooting 
- If you encounter a black screen with just a mouse cursor after installing Debian with the GNOME desktop environment, it could be due to issues with the display manager or graphics drivers. In my case, removing the graphics card was the key to resolve the issue. 
- You can also access the TTY2 by pressing CTR+ALT+F2 to bring up the terminal/login and install drivers (dependent on system) from there if needed. Further troubleshooting may be needed if encountered and the above doesn't resolve anything, feel free to reach out for assistance!
- Check Logs: If you encounter other issues, check system logs using: 
```
journalctl -xe
```

## Step 2: Install CasaOS

[CasaOS](https://casaos.io) provides a straightforward installation script that sets everything up for you. To install CasaOS, run the following command in your terminal on the newly created Debian machine (BY THIS POINT YOU SHOULD KNOW THE MACHINES IP AND LOGIN DETAILS):
```
bash
curl -fsSL https://get.casaos.io | sudo bash
```
CasaOS should take several minutes to execute and install dependencies. Once complete, you should be able to access the CasaOS interface be either entering:
```
casaos
```
or going to any web browser (connected to your router) and entering the IP, port, and then /#/:
```
EX: 196.168.1.1:81/#/
```
If you are having trouble finding or remembering the IP, simple enter this into the Debian terminal:
```
hostname -I
```

## Completion
![ScreenShot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5t1pr4mpt0594etbhhin.png)

Congratulations, you now have a fully functioning home server. You still have plenty to configure, but CasaOS has an entire app store with detailed, documented, open-source programs to accomplish many things, including home media server, photo backups (goodbye Google Photos), and so much more. By default, the installation already includes a file system ready to implement between the many machines using your network.

If you found this guide helpful, share it with others who might benefit from setting up their own home server and give me a like! Happy hosting!

Feel free to ask any questions, share your experiences, or help debug in the comments below.