Setting up your own web server can be a fun thing, simply because you can customize the things you want and optimize it to perform at the highest level. Previously, we have shown you how to install a LAMP server in your Ubuntu machine, but that is using a GUI and it won’t work if you are administering a remote host. Here’s how you can setup a Ubuntu web server on a remote host.
Note: Before we start, we have to assume that:
You already have SSH access to your remote host. For security sake, you might want to setup a public/private SSH key to secure your SSH connection.
The remote host is in a fresh state. No additional software have been installed or any other user has been created.
Get Started
Open a terminal (if you are using Windows, use Putty) and SSH to your remote host.
The first thing to do is to update your remote host so that it is running the latest version of all software.
If you are logging in as the root user, it is best to change the default password for the root user and also create a new user account. It is not a good practice to log in as the root user. Once the new user account is created, you will administer the remote host with this account.
Change the password for the root user.
Create new user account.
It will prompt you to enter your user password and info.
Add the new user to the “sudo” group.
Once this is done, you will need to exit the current SSH session and re-login with the new user account.
- Install LAMP Server. There is no Synaptic or Ubuntu Software Center here, so we have to install everything via the terminal. While you can install a whole bunch of files here, an easier way is to use the tasksel package.
During the installation, it will prompt you a few questions.
Once the installation is done, go to your web browser and type in the domain name (or IP address) associated with the remote host. If you see the “It Works” screen, you are on track.
- Secure MySQL
It will prompt you a few questions:
- Change the root password? – If you have set a secure password previously, you can safely type ‘n’.
- Remove anonymous users? – Type ‘y’.
- Disallow root login remotely? – Type ‘y’.
- Remove test database and access to it? – Type ‘y’.
- Reload privilege table now? – Type ‘y’.
That’s it. You have successfully setup a web server in the remote host.
Optional Stuff
Here are some optional stuff you can install/do:
1. phpMyAdmin
PhpMyAdmin is a frontend GUI that allows you to configure and setup database easily. Since it is accessible via web interface, many people feel that it is unsecured and could be the loophole for hackers to brute-force into your database.
Here’s how to install:
Open a browser and go to http://your-ip-address/phpmyadmin. If you see the phpMyAdmin page, your installation is successfully. If not, you will have to add an extra line to the Apache conf file.
Add the following line to the end of the file.
Save (Ctrl + O) and exit (Ctrl + X).
Restart Apache
2. Configure Apache
There are tons of things that you can do with Apache. I won’t discuss the detail here. Check out this Apache tutorial for the instruction.
3. Install FTP server
If you need to access your remote host via FTP, you will need to install a FTP server. There are several FTP software that you can use. Here, we will be using vsftp.
Don’t forget to add the current user to ftp group.
4. Install Webmin
Webmin is a free web-based control panel for administrators to manage their servers without having to go into the command line.
Add the following to the end of the file:
Import the GPG key:
Install webmin:
Once installed, you can access webmin in your browser at the URL https://your-ip-address:10000/.
Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.
Our latest tutorials delivered straight to your inbox