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
- 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.
- Putty or Terminal to access your server
- Basic knowledge about most common Unix commands.
- 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.
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
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
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.
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.
next screenshot:
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
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
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.
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.
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
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:
Well done!!
Further reading: Tuxlite.
i have tried multiple times but never succeeded in getting the phpmyadmin screen to appear; all ia get is :
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
Hello,
you forgot to install phpmyadmin by running “./setup.sh dbgui” before trying to enable the dbgui access with the command “./domain.sh dbgui on”.
As a result the page http://domain.tld/dbgui/ returns either a 404 or an access denied as there is no phpmyadmin installed anywhere.
Cheers,
Tuxlite is wonderful.
However, it misses some things.
Example: PHP command is not working. It seems that some packages are missing from the installation, as a result of this, we cannot execute cron jobs.
Could you please guide us on how to install it?
php5-fpm: unrecognized service
Webserver + PHP-FPM + MySQL install complete!
Optimizing AWStats, PHP, logrotate & webserver config.
php5-fpm: unrecognized service
sed: can’t read /etc/php5/fpm/pool.d/www.conf: No such file or directory
sed: can’t read /etc/php5/fpm/pool.d/www.conf: No such file or directory
sed: can’t read /etc/php5/fpm/pool.d/www.conf: No such file or directory
sed: can’t read /etc/php5/fpm/pool.d/www.conf: No such file or directory
sed: can’t read /etc/php5/fpm/pool.d/www.conf: No such file or directory
sed: can’t read /etc/php5/fpm/pool.d/www.conf: No such file or directory
sed: can’t read /etc/php5/fpm/php.ini: No such file or directory
sed: can’t read /etc/php5/fpm/php.ini: No such file or directory
sed: can’t read /etc/php5/fpm/php.ini: No such file or directory
sed: can’t read /etc/php5/fpm/php.ini: No such file or directory
sed: can’t read /etc/php5/fpm/php.ini: No such file or directory
sed: can’t read /etc/php5/fpm/php.ini: No such file or directory
sed: can’t read /etc/php5/fpm/php.ini: No such file or directory
is this normal ?
No that’s not normal. Try cd to /etc/php5/fpm/pool.d/ and check if http://www.conf is there. And so with php.ini.
Same problem :
1. php5-fpm: unrecognized service
Webserver + PHP-FPM + MySQL install complete!
How to resolve this problem ?
2. New problem :
I can not use ./domain.sh add newuser domain.com command because there is no tuxlite directory in new user event I use root user to create it, I can’t be done…
And I can not, etc …
This tutorial is ambigue, too many problem on it …
Sorry for My bad English.
Hi!
After following this tutorial my website is located under /user/domains/XXX
But when I access the site with my browser via IP I get served by the files located under /var/www
and not under the user and domain directory.
Please advice.
Cheers!
Great site!!!
You should copy your site’s files to /home/username/domains/domain.tld/public_html/
accessing via IP? yes it should bring you /var/www by default. You can change that manually at your virtualhosts file
Ok got it!
The problem is I cant access dbgui from browser :/
it says:
Forbidden
You don’t have permission to access /dbgui/ on this server.
Please advice. Cheers!
Execute
./domain.sh dbgui on
and retry Ben.
Its strange, when i run #php -v, then its output
-bash: php: command not found
but php5-fpm service is exists, how to make “php” globally?
thanks
I fix it with #apt-get install php5-cli
Btw how to safely upgrade from php5.3 to 5.5?
Thanks