hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Hosting Talk Tutorials : VPS Tutorials : Debian/Ubuntu LAMP and LNMP setup script
Reply

Forum Jump

Debian/Ubuntu LAMP and LNMP setup script

Reply Post New Thread In VPS Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 02-21-2011, 10:14 PM
Scientist Scientist is offline
Web Hosting Evangelist
 
Join Date: Oct 2008
Posts: 533
Smile

Debian/Ubuntu LAMP and LNMP setup script


Hello everyone,

I've been testing and setting up various kinds of webserver configurations lately, and realized that it would save me a lot of time if I had a script to automatically do a base install" whenever I spin up a fresh new server to benchmark. Had a some spare time this afternoon so I wrote one(two) scripts and figured others might find it useful somehow.

I know there are many low footprint install scripts around like the lowendbox's lowendscript and Centmin posted a few months back. But being a Debian person myself, I prefer Apache over nginx and none of the scripts offer the Debian + Apache combo.

Anyway, lets get down to details. The scripts automatically sets up the following :-

Serversetup Script http://tuxlite.com

- Basic server configuration such as setting the hostname, SSHD ports etc.
- Choice of 3 LAMP setups (switching setup from 1 to 2 or 3 works fine, but I've not tested the other way round)
1. mpm_prefork + mod_php
2. mpm_worker + mod_fcgid
3. mpm_worker + mod_fastcgi + PHP-FPM

- Optimizes LAMP config for low memory usage.
- Extra options to setup rtorrent and cronjobs for backups

Domainsetup Script http://tuxlite.com

- Quickly add a domain to Apache virtualhost config
- Setup awstats + phpmyadmin for each domain with daily log rotation
- Option to remove domain from server


To use the scripts, download them and make them executable. E.g.

Code:
wget http://tuxlite.com
chmod +x serversetup.sh
./serversetup.sh


Why Use These Scripts?


- Setup server, add your domain, set your DNS and you'll be hosting sites within minutes.
- Memory usage is ~50MB under Xen or KVM using mpm_worker setup.
- Apache mpm-worker config gives comparable/adequate performance to nginx for most situations. Setup is also compatible with the latest mpm-event module as well.
- ALL packages are from official Debian repositories, therefore configurations are standard and its easy to keep your server updated
- Functions are coded in simple "english", and some personal preferences of mine are commented out to keep installs as stock as possible. You can easily configure the functions to your liking.


Who Should Use These Scripts?

- Debian 6 users. Scripts will work with Debian 5 (lenny) as well, but remember to change sources.list to oldstable or lenny if you are using the script to reconfigure apt.
- Those using VPS to host personal sites, and do not require multi user / shared hosting environment.
- People who are lazy like me and wants things automated
- People who loves messing about with various LAMP stacks because Apache is win and life is meaningless without .htaccess support
- You are l33t and prefer not to use control panels with pretty GUIs



Bear in mind that my shell scripting skills are anything but good, and some of the code is adapted from various sources.
So if you find something off do let me know and I'll update the scripts accordingly.

__________________


Tuxlite.com Complete LAMP and LNMP script for Debian and Ubuntu.



Last edited by Quartz; 04-27-2011 at 03:45 AM.


Sponsored Links
  #2  
Old 02-21-2011, 10:27 PM
RavC RavC is offline
Premium Member
 
Join Date: Apr 2009
Posts: 479
Thanks, what an excellent contribution!!

I just deployed a "lampworker" configuration in 3m19s including interactive parts and it seems to have worked very nicely straight out-of-the-box

One one warning:
Code:
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...

__________________
Exceptional VPS Hosting. With love, 6sync.

  #3  
Old 02-21-2011, 10:34 PM
Scientist Scientist is offline
Web Hosting Evangelist
 
Join Date: Oct 2008
Posts: 533
Welcome!
For the mysql issue, its probably because Debian packages mysql without the "test" database. The warning message can be ignored.

Quote:
Originally Posted by RavC View Post
Thanks, what an excellent contribution!!

I just deployed a "lampworker" configuration in 3m19s including interactive parts and it seems to have worked very nicely straight out-of-the-box

One one warning:
Code:
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...

__________________


Tuxlite.com Complete LAMP and LNMP script for Debian and Ubuntu.


Sponsored Links
  #4  
Old 02-22-2011, 12:16 AM
Scientist Scientist is offline
Web Hosting Evangelist
 
Join Date: Oct 2008
Posts: 533
Made some changes to the script to fix some (harmless) typos.
Anyone using the scripts before this reply should download them again

__________________


Tuxlite.com Complete LAMP and LNMP script for Debian and Ubuntu.


  #5  
Old 02-22-2011, 12:57 AM
tchen tchen is offline
Web Hosting Master
 
Join Date: Jan 2011
Location: Canada
Posts: 933
Might want to stick suhosin in there. I feel so naked without it But thanks for sharing!

  #6  
Old 02-22-2011, 01:32 AM
techjr techjr is offline
Web Hosting Master
 
Join Date: Mar 2010
Posts: 4,472
Does this happen to secure /tmp etc? That would be a great feature to have.


I have always wanted to use debian with a major website but I wanted to test centmin first. Now that the owner has disappear from the forum and the latest update was to my disliking I am stuck with it since the server has about 100gb of data on it that cannot be backed up.

Although, I am thinking it is time to dump the 100gb of data just to try this

  #7  
Old 02-22-2011, 09:14 AM
Scientist Scientist is offline
Web Hosting Evangelist
 
Join Date: Oct 2008
Posts: 533
Quote:
Originally Posted by tchen View Post
Might want to stick suhosin in there. I feel so naked without it But thanks for sharing!
Both the suhosin source patch and the extension is installed by default Debian PHP package. Fire up a phpinfo page and you'll see it loaded


Quote:
Originally Posted by techjr View Post
Does this happen to secure /tmp etc? That would be a great feature to have.

I have always wanted to use debian with a major website but I wanted to test centmin first. Now that the owner has disappear from the forum and the latest update was to my disliking I am stuck with it since the server has about 100gb of data on it that cannot be backed up.

Although, I am thinking it is time to dump the 100gb of data just to try this
Just added two new options to secure /tmp. I didn't include it earlier because securing /tmp can be very machine specific, especially if you plan to run stuff like eaccelerator that needs huge cache directories. Be sure to know what you're doing before copy-pasting codes from the interwebs.

As for your data, why not rsync it to a backup server and move them back after you're done setting up? That's a lot of data to lose

__________________


Tuxlite.com Complete LAMP and LNMP script for Debian and Ubuntu.


  #8  
Old 02-22-2011, 11:49 AM
Nnyan Nnyan is offline
Web Hosting Master
 
Join Date: Feb 2004
Location: Sacramento CA
Posts: 3,067
Great script! Have you done any performance tests to see how the different options scale with traffic? I'm going to see if any of my test hosts offer Deb 6 and run them through loadimpact and compare it to some of the php/Nginx setups, but ~50MB is really sweet for Apache. Good job!

  #9  
Old 02-22-2011, 01:34 PM
Scientist Scientist is offline
Web Hosting Evangelist
 
Join Date: Oct 2008
Posts: 533
On memory/cpu limited VPS, I find that the mpm-worker (option 2 or 3) config scales much better, especially with concurrent connections. The config that I use for the script is very conservative and will only use ~100MB memory on full load. However it should have no problems handling >50 req/sec for a wordpress site. >200 req/sec if using supercache and I'm getting up to 2000 req/sec when I place varnish in front of it all. This is on a 1CPU 512mb test box.

Though if you have massive amount of RAM and CPU allocation, the vanilla LAMP stack with mpm-prefork should in theory be slightly faster.

It will work with Debian 5 if you don't select the php-fpm option, or else the sources.list needs to be edited because it assumes a Debian 6 OS.

__________________


Tuxlite.com Complete LAMP and LNMP script for Debian and Ubuntu.


  #10  
Old 02-22-2011, 03:36 PM
Amar Amar is offline
Junior Guru
 
Join Date: Dec 2007
Posts: 234
Great stuff : ). Would be great if you could include Varnish part too (or separate script maybe? ) in future..

WHere can I donate?

  #11  
Old 02-22-2011, 03:48 PM
techjr techjr is offline
Web Hosting Master
 
Join Date: Mar 2010
Posts: 4,472
Quote:
Originally Posted by Scientist View Post
On memory/cpu limited VPS, I find that the mpm-worker (option 2 or 3) config scales much better, especially with concurrent connections. The config that I use for the script is very conservative and will only use ~100MB memory on full load. However it should have no problems handling >50 req/sec for a wordpress site. >200 req/sec if using supercache and I'm getting up to 2000 req/sec when I place varnish in front of it all. This is on a 1CPU 512mb test box.
I know some of the other scripts (CentOS) are getting an extreme amount of requests per second. It would be cool if you could include a secondary script that tweaks server settings as traffic grows to better manage to load. Such as installing varnish.

Quote:
Originally Posted by Scientist View Post

As for your data, why not rsync it to a backup server and move them back after you're done setting up? That's a lot of data to lose
Gave away my backup type vps after a buddy's host got shut down. I guess I will download it to my hard drive and then take the drive to a local data-center and borrow there connection (They allow it for a small fee)

  #12  
Old 02-22-2011, 05:07 PM
Scientist Scientist is offline
Web Hosting Evangelist
 
Join Date: Oct 2008
Posts: 533
Quote:
Originally Posted by Amar View Post
Great stuff : ). Would be great if you could include Varnish part too (or separate script maybe? ) in future..

WHere can I donate?
Quote:
Originally Posted by techjr View Post
I know some of the other scripts (CentOS) are getting an extreme amount of requests per second. It would be cool if you could include a secondary script that tweaks server settings as traffic grows to better manage to load. Such as installing varnish.
Just added another 2 functions to quickly turn varnish on and off. As usual just re-download the scripts from the same links.

My test box is hitting 8000 req/sec for phpinfo. Do post your results as well if you folks are doing any benchmarks.

__________________


Tuxlite.com Complete LAMP and LNMP script for Debian and Ubuntu.


  #13  
Old 02-22-2011, 05:30 PM
techjr techjr is offline
Web Hosting Master
 
Join Date: Mar 2010
Posts: 4,472
Quote:
Originally Posted by Scientist View Post
Just added another 2 functions to quickly turn varnish on and off. As usual just re-download the scripts from the same links.

My test box is hitting 8000 req/sec for phpinfo. Do post your results as well if you folks are doing any benchmarks.
This has massive potential, I would get a site setup and get a community going myself. I see it doing great for the average unmanaged user with little to no experience who are running a single forum and such.

Do you recommend lamp setup #2 or #3? Also, may I share this with others? If so do you have any places I may link to in order to provide you the credit of making it?

  #14  
Old 02-22-2011, 07:17 PM
Scientist Scientist is offline
Web Hosting Evangelist
 
Join Date: Oct 2008
Posts: 533
Quote:
Originally Posted by techjr View Post
This has massive potential, I would get a site setup and get a community going myself. I see it doing great for the average unmanaged user with little to no experience who are running a single forum and such.

Do you recommend lamp setup #2 or #3? Also, may I share this with others? If so do you have any places I may link to in order to provide you the credit of making it?
I'd go with setup #2 because its a safe config, as in you can swap #1 and #2 repeatedly as you wish without breaking anything.

Setup #3 is the "better" way of using PHP, but using experimental packages means you don't get timely security updates. I'd personally only use this setup to test out PHP-FPM's features and nothing more. Also once you go option #3, its much harder to revert back to #1 or #2.

And sure, go ahead and share this with anyone, I've posted it in public after all Linking back here will be best until I find a more suitable place to host the scripts. Unless of course WHT mods give me access to edit my first post.
If you find it useful and want to treat me coffee, I'd be happy to oblige

__________________


Tuxlite.com Complete LAMP and LNMP script for Debian and Ubuntu.


  #15  
Old 02-23-2011, 06:01 PM
techjr techjr is offline
Web Hosting Master
 
Join Date: Mar 2010
Posts: 4,472
I just ran the lampworker install on a new server... It said leave the mysql password blank if I did not have it setup, but I am getting access denied. Any ideas?


Also running ./serversetup.sh basic it would be nice if it told you what the ssh port was changed to. Although not needed it makes it easier to see what it is right off the bat.

Using the add user command shows "Current Kerberos password:"


Last edited by techjr; 02-23-2011 at 06:15 PM.
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
CentOS or Ubuntu or Debian Host4Geeks Hosting Software and Control Panels 26 08-24-2010 04:50 AM
Seems Debian BETTER than CentOS for LNMP VPS? 21andy VPS Hosting 8 02-24-2010 03:20 AM
Debian Server - Professional LAMP Setup, Optimization + Hardening Needed SwedeHost-Luke Systems Management Requests 5 07-16-2008 11:49 AM
Any decent guides for chrooting apache2 in ubuntu lamp installation? Georgecooldude Hosting Security and Technology 2 05-12-2008 06:42 PM
Hassle Free CentOS/Ubuntu LAMP install disc? RobinWrit Colocation and Data Centers 2 03-05-2008 01:58 PM

Related posts from TheWhir.com
Title Type Date Posted
Canonical to Close Cloud Storage Service Ubuntu One Web Hosting News 2014-04-03 14:05:25
Joyent Cloud Adds Platform Optimization, Support for Ubuntu Server Images Web Hosting News 2014-02-20 11:19:00
Nginx to be Included in Upcoming Ubuntu Release Web Hosting News 2014-01-08 15:17:12
Free Open Source Hosting Control Panel Neon Seeking Funding Via Kickstarter Web Hosting News 2012-12-31 13:38:04
Canonical Releases Ubuntu Server 12.10 with OpenStack Folsom Web Hosting News 2012-10-19 11:11:43


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?