Low End Box

Hosting Websites on Bare Minimum VPS/Dedicated Servers

Bootstraping Low End VPS with Pre-built Scripts

Tags: Date/Time: September 16, 2009 @ 1:52 am

It was fun setting up your very own server. I remembered the time when I received the root password to my very first virtual server back in March 2006 ($22/month for a merely 192MB of memory), it took me hours setting it up to exactly the way I wanted. At the end of the day when it started to pump out my websites on TCP port 80 — joy!

Well. It’s still fun the second time around when I moved hosting, but it wasn’t the same. 3rd time? Hmm. By now I probably have set up 30+ virtual servers due to expansion or migration, and it feels a lot like work than fun. In the effort to possess the 3 great virtues of a programmer according to Larry Wall, laziness, impatience, and hubris, I decided to write some simple scripts to quickly get my low end virtual servers up running and configured in no time!

Here is one that I want to share today.

Usage:

  1. Buy a new low end VPS from any provider
  2. Build a standard Debian 5 minimum install
  3. Got the root password
  4. ssh into your new low end box, and
    $ ssh root@my-new-box
    Linux lowendbox 2.6.18-blah #1 SMP Wed Aug 26 15:47:17 MSD 2009 i686
    ...
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    # wget -q http://www.lowendbox.com/scripts/lowend-debian.sh
    # bash ./lowend-debian.sh
    ...
    

What it does is:

  • Remove rsyslogd (memory hog on OpenVZ system) and portmap (mostly useless).
  • Run apt-get update && apt-get upgrade to get the server up to date.
  • Install and configure dash as /bin/sh.
  • Install and configure inetutils-syslog as default system logger.
  • Install and configure dropbear as OpenSSH replacement.

Once done, it should bring the memory usage to around 4-5MB on a 32bit Debian (where 2.8MB is from bash and dropbear that handles the SSH connection). It should also work on Ubuntu-based distributions (tested on a 64MB Ubuntu 9.04 VPS). Feel free to check the code to make sure I am not doing anything malicious like hijacking the server and install a ssh key or something :)

14 Comments

  1. Neves wrote:

    Nice, but there is no security setup by default. What do you do?

    September 16, 2009 @ 3:26 am
  2. victor wrote:

    Download link is broken.
    …/scirpts/lowend-debian.sh
    should be
    …/scripts/lowend-debian.sh
    :)

    September 16, 2009 @ 3:42 am
  3. LowEndAdmin wrote:

    Arg. Link fixed.

    As of security — that really depends on your need (setting up sudoer, creating users, setting up firewalls). I have my scripts for those but I prefer not to show them :)

    September 16, 2009 @ 4:27 am
  4. Moi wrote:

    You install inetutils-syslog as default syslogger, how do you think about limiting rsyslogd by using ulimit -s 128? Is it safe to do that?

    September 16, 2009 @ 7:07 am
  5. dne wrote:

    Instead of “rm -rf /bin/sh”, I’d recommend “dpkg-divert –rename /bin/sh”.

    September 16, 2009 @ 7:19 am
  6. LowEndAdmin wrote:

    @Moi — the main issue I found with rsyslogd is its VSZ which is a lot greater than RSS. Although it might not use that much memory, it is still bad on an OpenVZ system where privvmpages counts the pages that are allocated.

    @dne — thanks for the suggestion.

    September 16, 2009 @ 8:22 am
  7. IWTFI wrote:

    it will better to start some tutorial series, like:

    1) vps start configuration
    2) lighttpd and php install
    3) mysql and bind install
    4) postfix install and full configuration for virtual domains
    6) (whatever else you think)
    5) security tricks/tips

    let me know what you think.

    September 16, 2009 @ 2:39 pm
  8. IWTFI wrote:

    btw something you forgot on the script..

    September 19, 2009 @ 1:41 pm
  9. Tyler wrote:

    Thanks for this :)

    Btw you spelled virtues wrong :p (virues)

    November 9, 2009 @ 11:48 pm
  10. LowEndAdmin wrote:

    Thanks. Fixed. Last time I checked spelling was not in the list of virtues of programmers :)

    November 10, 2009 @ 1:05 am
  11. IWTFI wrote:

    hey lowenbox. release more scripts!

    December 19, 2009 @ 9:39 pm
  12. cling[y] wrote:

    Thanks for the script!

    December 20, 2009 @ 7:40 pm
  13. scotty wrote:

    Thanks for the great script!

    I tried dropbear but it doesn’t play nice with git and none of the fixes I’ve seen work for me so I’ve abandoned it for just now.
    Seemingly the ulimit -s limit isn’t honoured by default ssh configurations, a bit of googling found me:

    UsePrivilegeSeparation = no

    Which will have ssh respecting your limits. Dropped ~3MB VSZ with that, google for the connotations.

    January 23, 2010 @ 11:44 pm
  14. Will's Blog » Post Topic » [Review] BuyVM / Frantech VPS wrote:

    [...] ist wirklich Minimal – 15Mb Ramauslastung nach der Installation, mit einigen Tweaks (Siehe Hier) konnte ich die Auslastung auf 9Mb drücken – unter voller Konfiguration als IRC Bouncer mit [...]

    July 15, 2010 @ 12:37 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Quoting webhostingtalk.com URL seems to get binned consistently here, but I do peek into the spam box frequently to publish those comments.