For the Linux installation on your VPS to be able to host and serve web pages it needs to be configured with various sets of software. This is the called the server environment. One of the most common server environments is the so called 'LAMP' stack. (Linux, Apache, MySQL, PHP)
It consists of:
- An operating system..in this case a Ubuntu flavor of Linux. all ready installed with your Droplet
- A web server (Apache).
- MYSQL a database engine
- PHP. A programming language.
Firstly we need to log in to our VPS via the SSH terminal (Putty). Open Putty (Click Run) and Enter the IP address you received with your email. Click Open. Ignore this warning (click Yes). this is simply telling you that Putty has not connected to this server before.
A terminal window will open. At the prompt 'Login as' type root then press Enter
Enter the password you received with your welcome email. (you can copy it from the email and use the right click to paste it at the prompt. It will not display anything just right click once in the terminal window then press enter).
You will then be prompted to re enter the password (right click and press enter again and then enter a new password). The new password must include letters and digits. This is your VPS root password.
You should see the 'Welcome to Ubuntu message' and some information about the system. At the bottom is the command prompt. Something like:
As a security precaution it is common practice, and highly recommended to create another user (other than the root) and assign that user the privileges we need. To add a user we type the command (The square brackets are Linux speak for a user variable.):
Replace [username] with a username. It can be (almost) any letter or number combination, but for practice purposes keep it simple.
You will be prompted for a password, enter then re- enter a password of your choice. This is your VPS User password it. Once again for practice sake keep it simple. (this, of course would not be true if this was a production environment).
You will then be prompted for a bunch of stuff. Just keep pressing enter until you get back to the command prompt:
Now we need to assign this user the priveleges we need. To do this enter
adduser [user name] sudo
Now we need to log in as that user. Enter:
The command prompt now changes to
The final thing we need to do before we instale the necessary software is go to our home directory.
You will notice the command prompt changes to
Indicating that you are now in home directory.
Now we need to install Apache, MySQL and PHP. We are also going to install a program that allows us to transfer our files between our local machine and the server.
To make things a little easier I have prepared a script that install all this software in one hit. First you will need to copy the script into your server home directory. We need to use the 'sudo prefix' to ensure the command runs with super user privleges.
sudo wget http://18.104.22.168/assets/lampin.sh
You should see the saving file mesage then the comand prompt when it is finished.
Now we can run this file.
sudo rbash lampin.sh
A bunch of text will scroll past indicating the software is being installed. As each step completes you will be prompted to enter yes or no. Simply press enter, indicating the default 'Yes', at each of these stages. Eventully a screen will appear asking for a MySQL password. For practice purposes just enter a generic password. (once a gain in a production environment you would ensure that you used a complex password) Re enter it at the prompt.
Then you will be prompted to 'enter the current pasword for root'. This is the MySQL root password you entered in the previous step. Simply type it again.
When asked to change the pasword type n and press Enter.
Press Enter for all subsequenty steps until you are returned to the command prompt.
The LAMP stack and FTP have now been installed.
You can checked that the server is running pointing your browser to your IP address. You should see the default Apache welcome page.
To learn more about the linux shell ad setting up LAMP see the Linux Shell section of the Usefull Links page