Coder Social home page Coder Social logo

lowendscript's Introduction

Debian 6 VPS Script

Remove excess packages (apache2, sendmail, bind9, samba, nscd, etc) and install the basic components needed for a light-weight HTTP(S) web server:

  • dropbear (SSH)
  • iptables (firewall)
  • dash (replaces bash)
  • syslogd
  • MySQL (v5.1+ W/O Innodb, configured for lowend VPS)
  • PHP-FPM (v5.3+ with APC installed and configured)
  • exim4 (light mail server)
  • nginx (v1.0+ from dotdeb, configured for lowend VPS. Change worker_processes number in /etc/nginx/nginx.conf according to number of your CPUs)
  • vim, nano, mc, htop, iftop & iotop (more to come...)

Includes sample nginx config files for PHP sites. You can create a basic site shell (complete with nginx vhost) like this:

./setup-debian.sh site example.com

When running the iptables or dropbear install you must specify a SSH port. Remember, port 22 is the default. It's recomended that you change this from 22 just to save server load from attacks on that port.

Usage (in recomended order)

Warning! This script is self destructive, it'll overwrite previous configs during reinstallation.

wget --no-check-certificate https://raw.github.com/Xeoncross/lowendscript/master/setup-debian.sh
$ ./setup-debian.sh dotdeb # not required if using Ubuntu
$ ./setup-debian.sh system
$ ./setup-debian.sh dropbear 22  # or any other port number
$ ./setup-debian.sh iptables
$ ./setup-debian.sh mysql
$ ./setup-debian.sh nginx
$ ./setup-debian.sh php
$ ./setup-debian.sh exim4
$ ./setup-debian.sh site example.com
$ ./setup-debian.sh wordpress example.com

... and now time for some extras

Webmin
$ ./setup-debian.sh webmin
vzfree

Supported only on OpenVZ only, vzfree reports correct memory usage

$ ./setup-debian.sh vzfree
Classic Disk I/O and Network test

Run the classic Disk IO (dd) & Classic Network (cachefly) Test

$ ./setup-debian.sh test
Neat python script to report memory usage per app

Neat python script to report memory usage per app

$ ./setup-debian.sh ps_mem
sources.list updating (Ubuntu only)

Updates Ubuntu /etc/apt/sources.list to default based on whatever version you are running

$ ./setup-debian.sh apt
Info on Operating System, version and Architecture
$ ./setup-debian.sh info
SSH-Keys

Either you want to generate ssh-keys (id_rsa) or a custom key for something (rsync etc) Note: argument is optional, if its left out, it will write "id_rsa" key

$ ./setup-debian.sh sshkey [optional argument_1]
Extras

Fixing locale on some OpenVZ Ubuntu templates

$ ./setup-debian.sh locale

Configure or reconfigure MOTD

$ ./setup-debian.sh motd

After installation

MySQL root is given a new password which is located in ~root/.my.cnf. After installing the full set, ram usage reaches ~40-45Mb. By default APC configured to use 16Mb for caching. To reduce ram usage, you may disable APC by moving or deleting the following file - /etc/php5/conf.d/apc.ini I recommend installing Ajenti and/or Webmin to manage your VPS. For security reasons delete, move or password protect "new_domain/public/phpinfo.php" file, which installed automatically on each new site installation.

Credits

lowendscript's People

Contributors

xeoncross avatar ilevkov avatar asimzeeshan avatar lowendbox avatar kevcenteno avatar shaunpud avatar

Watchers

James Cloos avatar

Forkers

sodeve bhyvex

lowendscript's Issues

PHP Warning stating that module apc and suhosin are already loaded

PHP is outputting warning saying that Module 'apc' and Module 'suhosin' are already loaded

root@italy:~# php -v
PHP Warning:  Module 'apc' already loaded in Unknown on line 0
PHP Warning:  Module 'suhosin' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

The reason is that we should take backups to a different location in the script

function install_php {
....
        mv /etc/php5/conf.d/apc.ini /etc/php5/conf.d/orig.apc.ini
....
        mv /etc/php5/conf.d/suhosin.ini /etc/php5/conf.d/orig.suhosin.ini

apc.shm_size now uses M/G suffixes, please update your ini files

root@italy:/etc/php5/fpm/conf.d# php -v
PHP Warning:  PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

The script needs to update /etc/php5/conf.d/apc.ini and replace

apc.shm_size=16

with

apc.shm_size=16M

Notice the 'M' at the end of the line

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.