Page 1 of 18 123411 ... LastLast
Results 1 to 15 of 266
  1. #1
    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.
    Last edited by Quartz; 04-27-2011 at 03:45 AM.


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

  2. #2
    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. #3
    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.

  4. #4
    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. #5
    Join Date
    Jan 2011
    Location
    Canada
    Posts
    934
    Might want to stick suhosin in there. I feel so naked without it But thanks for sharing!

  6. #6
    Join Date
    Mar 2010
    Posts
    4,487
    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. #7
    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. #8
    Join Date
    Feb 2004
    Location
    Sacramento CA
    Posts
    3,200
    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. #9
    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. #10
    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. #11
    Join Date
    Mar 2010
    Posts
    4,487
    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. #12
    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. #13
    Join Date
    Mar 2010
    Posts
    4,487
    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. #14
    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. #15
    Join Date
    Mar 2010
    Posts
    4,487
    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.

Page 1 of 18 123411 ... LastLast

Similar Threads

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •