Recommended VPS Complete list of best VPS hosting providers.

Easiest Way To Install LAMP and LNMP Stack On Ubuntu

This tutorial will guide you how to install (you choose) either Apache or Nginx on your server. This method is the one which I know the easiest method so far and this is so perfect for new users trying unmanaged server. Yet, as claimed by its developer, using this method you can even setup and host your website in budget VPS with very low RAM. Meet Tuxlite, a working installer of LAMP* and LNMP** stack on a server running either Ubuntu or Debian.

note:Each time I say “server” it can refer to both VPS or Dedicated server
* LAMP stands for “Linux, Apache, MySQL and PHP”
** LNMP stands for “Linux, Nginx, MySQL and PHP”

What Tuxlite does is automating most common configuration of server for web hosting. It helps newbies to setup a working server to host their website, blog or forum easily in less than an hour.

Many Shared Hosting users worry about complexity of setting up and managing a VPS so they hesitate to switch from Shared Hosting environment to virtual private server. Yet, there are three other things that most newbie users are worrying: First, VPS plans are usually expensive. Secondly, even there is a cheap budget VPS, it only offers small amount of allocated RAM so they can deploy control panel software in it. Lets take WHM/cPanel for instance, it is recommended to be installed on a server with minimum 768MB of RAM. Lastly, even the RAM is sufficient to run cPanel, a user will also need to pay additional monthly cost for the license.

Tuxlite is just ideal for users who are worrying about those problems. This scripts can really simplify the process of installing necessary stack to setup live server so their websites can be online within minutes.

Again, in this page I will show you how easy it is to install Tuxlite on your server. Keep up!

Requirements

  1. A server running one of these distros: Debian 6, Ubuntu 11.04, Ubuntu 11.10 or Ubuntu 12.04. In this example I use Ubuntu 12.04.
  2. Putty or Terminal to access your server
  3. Basic knowledge about most common Unix commands.
  4. Tuxlite script

How To Install (Step by step)

Step 1 – Launch Putty up and login to your server via SSH. If you didn’t change the port yet, it should be port 22. I assume you didn’t also follow our basic guide for initial Ubuntu server setup so you’ll still login as root.

login ssh as root

Step 2 – Now use these commands to create new directory called “tuxlite” and navigate to that directory (hit enter after each line):

mkdir tuxlite
cd tuxlite

mkdir

Step 3 – Now run this command to download Tuxlite script. Current version is 2.0 but you can check latest version here.

wget http://tuxlite.com/scripts/tuxlite.zip

download tuxlite

Step 4 – Now extract the downloaded .zip file using this command:

unzip tuxlite.zip

Can’t unzip? Read how to zip and unzip file in SSH here.

unzip tuxlite

Step 5 – Now you’ll need to firstly edit the “options.conf” file before continuing to install. Use Nano editor to do that task:

nano options.conf

Edit these:

  • HOSTNAME : change “srv1” to your own hostname. I’ll use “host” for my own.
  • HOSTNAME_FQDN : change “srv1.yourdomain.com”. I’ll use mine which is “host.servermom.com”
  • SERVER_IP : change this with your server’s IP address
  • SSHD_PORT : leave it as it is if you haven’t change it yet.
  • WEBSERVER= Use “1” if you wish to install Nginx or “2” for Apache. I will use Nginx.
  • MYSQL_ROOT_PASSWORD : change “abcd1234” to your own password. Note: MySQL password is not the same as SSH root password (or any other user). This password is used to authenticate your script for establishing connection to database. I’m sure you knew this already.
  • DB_GUI : Use “1” if you wish to install PhpMyAdmin or “2” if you prefer to use Adminer. I prefer PhpMyAdmin to use in this tutorial.
  • VARNISH_CACHE_SIZE : The value here is used to set amount of RAM Varnish Cache will use. You can leave it as it is as in this guide I will not use Varnish.

edit config file

next screenshot:

edit config file

Once done, hit Control+O on your keyboard to save and hit Control+X to exit Nano editor.

Step 6 – Now change permission of options.conf file and all files with .sh extension to 700. Use this command:

chmod 700 *.sh
chmod 700 options.conf

chmod 700

Step 7 – Before you proceed to the installation, it is better to also update APT database using following command syntax:

apt-get update && apt-get -y install aptitude

apt get update

Step 8 – So it is the time to run the script installer. Run install.sh file as following:

./install.sh

In this stage you can sit tight and wait for the process to run but don’t leave your computer as the process will ask you some questions you need to answer. It is not something complicated all you have to do is to choose and to answer with Yes or No.

install script

choose answer

process

Step 9 – Once done, default root login should be already disabled so you have to add new user using this command:

adduser newuser

example:

adduser sawiyati

Upon hitting Enter you’ll be asked to enter new password twice for that newly created user. Next time you access your server via SSH you should login using that new username not root.

create user

Step 10 – So here you’ve basically installed either LNMP or LAMP already but you will also need to setup where your website should be located in the server. In this case you’ll need to add your domain first. Use this syntax:

./domain.sh add username domain.tld

In this example I use:

./domain.sh add sawiyati servermom.com

add domain

As what you can see, once added, all files of your website should be located under following path:

/home/username/domains/domain.tld/public_html/

In my example:

/home/sawiyati/domains/servermom.com/public_html/

Step 11 – That’s it. Now your server is ready to host your website in it. Still missing something? Yup, you may be wondering how to upload your site’s database to your server. Luckily Tuxlite has also installed GUI-based MySQL manager which in this case I use PhpMyAdmin. You can manage all tasks related to database there including to create new MySQL user, create new database, editing tables, exporting or importing databases and so on. But firstly you have to enable it using this command:

./domain.sh dbgui on

Once enabled, you can access it on your browser via this url (after your domain resolves to server):

http://domain.tld/dbgui/

in my example is : http://servermom.com/dbgui/

p.s: You may enable PhpMyAdmin only when you need it. You better disable it again once you finish using it. That’s to prevent PhpMyAdmin from being publicly accessible to avoid brute force attacks on your server. Use this command to disable it:

./domain.sh dbgui off

Step 12 – This very last but not least step. Your server is basically up, running and online. You can access it via IP but you still can’t access it by typing your domain in browser. In this case you have to setup your domain to connect and resolve to your server. I explained you a method to do that by using Bind9 DNS software here. That’s a pretty long but easy process so that’s why I said “not least”.

Once you’ve followed all those steps above including the last step, you can test it on your browser. In this example I simply editing my computer’s hosts file. You’ll see a welcome page like this:

welcome page

Well done!!

Further reading: Tuxlite.

12 Comments

Add a Comment

Your email address will not be published. Required fields are marked *

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.