Tutorial - Prepare your Raspberry Pi to become a web server
In this tutorial, we will take a number of steps in preparation for using your Raspberry Pi as a web server
In this tutorial, you'll learn how to squeeze as much performance as possible out of your Raspberry Pi, and prepare it ready to become a live functioning web server. Be sure to follow Installing Apache, PHP and MySQL on your Raspberry Pi once you're done.
I'm assuming you know your way around Terminal, and you've got Raspian installed.
Step 1 – Disabling the desktop environment
To provide the web services with plenty of resources (which are limited on the RPi) begin with disabling the desktop environment. The simplest way of doing this is by using Raspi-config. Type the following command:
You will see the familiar configuration utility:
Arrow down to 'boot_behaviour' (****Tip: pressing 'b' on your keyboard will jump straight to this option) and hit enter. The utility will now ask:
"Should we boot straight to Desktop?" – Choose "No"
Step 2 – Allocating more memory to system processes
An important step in getting your own 'Dingleberry Pi' web server up and running is ensuring your RPi has the right resource balance. Since we're not going to be using the desktop environment, we'll shift the split of memory allocation between graphics and system more towards system.
You could also overclock your Raspberry Pi to get squeeze that little more power out!
Still in Raspi-config, arrow down to 'memory_split' (hotkey m). You will see the following presets are available:
Choose '240 240MiB for RAM, 16MiB for VideoCore'. This gives us the maximum allocation to system processes.
Step 3 – Securing your Raspberry Pi
An important step before we make our Raspberry Pi a public web server is securing it by changing the default 'Pi' superuser account password.
Still in Raspi-config, arrow down to 'Change password for pi user'. You will now be asked to enter a new password for pi user. Choose a password which isn't going to be guessed easily, and type it.
**Tip: **You won't see the new password as you type, nor will asterisks appear (*). You'll be asked to type it a second time to confirm. 'Password changed successfully' should now show.
Step 4 – Enabling SSH
SSH allows you to remotely connect to the shell of your Raspberry Pi. This should be enabled by default on your RPi, but just in case it isn't, here's how to enable it.
Still in Raspi-config, arrow down to 'SSH' and hit enter. You'll be asked if you want to enable SSH, choose 'enable'. Done!
That's it, you're ready to begin the next step – installing Apache, PHP and MySQL on your Raspberry Pi. Feel free to leave any comments or questions below.