Continuing with the series of setting up and running Linux on the Raspberry Pi, this article covers establishing and securing SSH access and installing the LAMP Server components (Linux, Apache, MySQL, PHP).
Note that enabling SSH on the Pi is not a prerequisite for running it with a monitor/screen, keyboard/mouse, as these will allow direct access to the system in the usual way. However if a nerdy, headless (no monitor) boot is required, then SSH will be needed to access and configure the Pi operating system..
In order to access the Pi from the network, an SSH client is required. The IT cognoscenti tend to favour good ol' PuTTY because it's powerful, easy to use and hard to beat. Download and install the SSH client of your choice. The Windows PuTTY doesn't need installation, just run it from the executable.
Open PuTTY on another workstation on the same LAN and type in the IP Address of your Rasperry Pi system (you may have to check your router's DHCP log to see which IP has been allocated). Also give the link a session name..
Click the 'Open' button to connect. The default login credentials for SSH on the Pi are username: pi, password: raspberry. Click 'Yes' for the initial security alert popup when first connecting PuTTY.
In the console, type the command to perform some initial configuration..
The Pi configuration tool appears with various keyboard-controlled options..
Select Option 1. to change the Pi login password from 'raspberry' to something more unique and secure (the SSH username will remain 'pi').
Select Option 2. to change the hostname to something unique..
Tab down to 'Finish' to allow the system to reboot for the changes to take effect. Reconnecting with PuTTY will prompt a new security alert to confirm once more (new hostname = new security warning).
It's usually a good idea to update a newly-installed Linux system with its various repositories and libraries, which might be needed at a later date. With the Pi connected with internet access, reconnect with PuTTY and type the following commands in the console on one line..
sudo apt-get update && sudo apt-get upgrade -y
Go and have a coffee as this can take a little while..
If the plan is to run a web server from the Pi, then Apache is highly favoured by 'Nix heads. Type the following command and let the system do the rest..
sudo apt-get install apache2 php5 mysql-server mysql-client
A prompt may pop up to change the default MySQL password. Do so if required. Once installed, Apache et al. should be running straight off. Test the server by opening a web browser from another system on the LAN and typing the usual http, colon, slash, slash (don't omit this bit) and the IP Address of the Pi server in the URL field, i.e..
If the default Apache Debian page appears, the web server is up and running and ready to go. Congratulations, you now have a working Raspberry Pi with secured SSH login, a unique hostname and a working web server..
AndyM | Updated July 2019