Skip to content

Instantly share code, notes, and snippets.

@stormpython
Last active May 1, 2019 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stormpython/9502324 to your computer and use it in GitHub Desktop.
Save stormpython/9502324 to your computer and use it in GitHub Desktop.
Setting up a Raspberry Pi Home Server

Setting up a Home Server with Raspberry Pi

Downloading and Installing Wheezy Raspbian

Download the latest wheezy raspbian raw image and install onto a 4GB+ SD card following the RPi Easy SD Card Setup instructions.

Server Setup

  1. Insert the SD Card. Attach a keyboard, mouse, and monitor to your Raspberry Pi before booting it up.

  2. The Raspberry Pi has a nice "raspi-config" screen that you'll see on first boot. For a home server, the following selections will be useful:

    • expand_rootfs: resizes the default 2GB OS image to fill the rest of the Flash card.
    • change_pass: the default password is "raspberry", but something more secure than that would be better.
    • Set your locale and timezone.
    • memory_split: assign the minimum amount possible (16) to the GPU to leave as much room as possible for services.
    • SSH: don't forget to enable the SSH server.
    • boot_behaviour: turn off boot to desktop (again, to save memory for your services).
  3. When finished, you'll be at the pi@raspberrypi prompt. The setup script can be re-run at any time via sudo raspi-config.

Network Configuration

A static IP makes everything easier, so switch the network settings for eth0:

sudo vi /etc/network/interfaces

Change the eth0 line iface eth0 inet dhcp to the following (modify to meet your home network setup):

======/etc/network/interfaces======
...
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.254
...
======/etc/network/interfaces======

Adding a User

Create a local user, and put it in the users and sudo group:

sudo adduser YOURUSERIDHERE
sudo usermod -a -G users YOURUSERIDHERE
sudo usermod -a -G sudo YOURUSERIDHERE

Rebooting

Update the system to ensure that it has the latest and greatest copies of all the libraries:

sudo apt-get update; sudo apt-get upgrade

At this point, you're ready to go headless! Shut down the Raspberry Pi:

sudo /sbin/shutdown -h now

Once it's down (monitor the green status LEDs on the Raspberry Pi circuit board to know when it has finished shutting down), unplug the monitor, keyboard, mouse and power cord. Attach the USB storage, then restart the Raspberry Pi by plugging the power back in.

Once the Raspberry Pi starts up (again, those green LEDs are the clue to its state), you can ssh in to the RPi from any other machine on the network and finish all the configuration remotely from here on out (modify the following for your static IP):

ssh YOURUSERIDHERE@192.168.1.10 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment