Setting Up A Web Server on Ubuntu – Step 1

Step 1 is to get your server and server environment set up.
1. Install Ubuntu
2. Install GUI desktop environment
3. Install and configure remote login
4. Install Apache, MySql, Php

The first thing is to install Ubuntu on your computer/server. I am using 16.04 Server version. After you get the disk image created, you will boot up the server from the disk. The installation is pretty self-explanatory, and there are plenty of instructions out there for that so I won’t go through those instructions. I will note that when it comes round to the Software selection screen you can select LAMP server to save time installing each component separately. Also, you will want to be sure that you have access to the internet available, either have it plugged in to the network or have a wireless NIC in place so it can find the connection during the installation. That may not be a necessity, but it will make your life a lot easier to be able to access the internet for configuration and updates right away.

The Server version doesn’t install any GUI environments so you will have to install one for yourself.*
The basic one is the default desktop environment (DE) which is Unity. This is optional because we are going to install a smaller DE to use with remote login anyway that is quite functional.
Run these commands to install a desktop environment:
sudo apt-get update
sudo apt-get install ubuntu-desktop
reboot

*You will find suggestions that one wants to eliminate a GUI environment on a server for several reasons. I prefer a GUI environment for simplicity and ease of management. My purposes are small time and instructive; if I were standing up a “real” production environment, I’d probably concur, but for now – eh, I’m using the GUI DE.

Next, we are going to install xrdp for remote login, and I have found the best DE for that is one called Mate. You will find other DEs suggested for remote login, but after fiddling with another DE and running into a string of complications, I have found that Mate just seems to work well and easily and so, I went back to it.
Install xrdp:
sudo apt-get update
sudo apt-get install xrdp

Now install Mate desktop environment:
sudo apt-get update
sudo apt-get install mate

Alternatively you can install a minimal version that will be lean and light:
sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon

Configure xrdp to use the Mate DE:
sudo sed -i.bak ‘/fi/a #xrdp multiple users configuration \n mate-session \n’ /etc/xrdp/startwm.sh

Check that you can log in remotely now from your windows computer. Unless you have assigned your Ubuntu server a static IP, find out what your IP is with ifconfig and get the IP assigned. Now go to Window and try to remote desktop to your new Ubuntu server. Did it work? If so you’re all set.

So now you have a Ubuntu server going and you can remote into it which allows you to move it out of the way and not have to log in directly.

Now let’s set up our LAMP stack and get our server ready to be a web server.

Since I have already set these up when we installed Ubuntu Server I don’t really need to do this as a separate process.  However, if you are just installing Ubuntu Desktop version you will need to do this.  Plus there are a couple of things we will want to do to followup our installs.  Rather than go through all the steps here, there are clear and easy instructions here.  If you don’t need to use the instructions to install the whole LAMP stack I would just suggest you be sure to do the security configurations for MySql and the Apache configurations.

Also, it’s pretty cool to create the info.php file and see that your webserver and your php are in place and working.

That’s it for getting the server ready.  Next we will talk about how to configure your server to be exposed to the world.  If you just want to use this webserver for the learning experience or to just do some personal development you may not want to do the next step.

Related posts

Leave a Comment