Menu Close

Raspberry Pi Webserver Guide

I run this website and most of the systems it relies on are off of my own, self hosted servers. These are 2 Raspberry Pi computers. Here’s links to the guides I’ve used to install Ubuntu Server, and LAMP onto them. They run extremely well and are very reliable, besides the issues associated with using consumer-grade SD cards for storage and their lack of RAM or processing power.

Install Ubuntu, I highly recommend using Ubuntu Server for ARM. This guide assumes you have a basic knowledge of flashing images to SD cards using programs like Etcher, and some familiarity with a Linux command line. If you don’t that’s ok, just follow the commands and everything should be fine.

1. Install Ubuntu onto your Raspberry Pi initially. Write the .img file you download to a MicroSD card using Etcher or similar software. 

https://ubuntu-pi-flavour-maker.org/download/

You’ll need a keyboard, mouse, and monitor temporarily connected to the device for the initial install. 
2.  Install Open SSH for remote access.

$ sudo apt-get install -y openssh-server

3. Enable the SSH Server using systemctl

$ sudo systemctl start ssh

4. Make OpenSSH a process that starts automatically on boot.

$ sudo systemctl enable ssh.socket

These commands above enable SSH-Server from the terminal and make it autostart on reboot. SSH allows us to remotely control a computer from the command line over the internet- not just your local network.

5. Now remotely connect to your server at it’s local IP address from another computer on the same network. You can find it’s IP address by looking at your router’s configuration page or executing “ip addr show” from terminal on the Pi. You’ll login using the username and password you setup when installing Ubuntu.

6. Now install LAMP (Linux, Apache, MySQL, PHP) using this guide from DigitalOcean:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

I recommend installing some other software (not yet included in this guide) to help you administer your completed server.

  • vsftpd – This is a fast and light FTP server for remote filesystem access.
  • Adminer or PHPMyAdmin – Adminer is a one page, lightweight MySQL database management utility. It runs as a virtual host on Apache Webserver, (for example yoursite.com/adminer). PHPMyAdmin is more feature rich, but is substantially larger and more resource intensive. It installs it’s own webserver (which is great if Apache is not working and you still need to access and manage databases).
  • Webmin – Webmin is a full management dashboard for Linux. It has modules for controlling Apache, SSH, MySQL, and more. It can control all aspects of a Linux server from one place.

That’s essentially it! You have your own self-hosted website up and running.