Skip to content

Instantly share code, notes, and snippets.

@zuckercode
Created September 7, 2012 11:57
Show Gist options
  • Save zuckercode/3665572 to your computer and use it in GitHub Desktop.
Save zuckercode/3665572 to your computer and use it in GitHub Desktop.
install development server by script
#!/bin/bash
#
# These lines installing the complete software for a nginx - php5-fpm - mysql machine
# This script runs on:
# - Hetzner Root EX4 (Debian6 minimal installation)
# - Strato Root Server Linux Level 3 (v1209.1.42) Debian 6.0 64bit
# Installation:
# copy this lines to /root/install.sh
# if vim is not already installed
# aptitude install vim
# vim /root/install.sh
# chmod +x install.sh
# ./install.sh
read -n1 -p "This script is installing many software packages and only requesting when user input is required for installation. Do you really want to proceed? y|n" key
echo
case $key in
"Y" | "y") true ;;
"N" | "n") echo 'Installation aborted'; exit;;
*) exit; echo ' ' ;;
esac
read -p "Please provide a name for a new user:" name
if [ "$name" == "" ]; then
echo "You did not entered a user name, so no user will be added after setup"
fi
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
aptitude -y install pwgen vim locate
updatedb &
aptitude -y safe-upgrade
rm /etc/apt/sources.list
echo "deb http://ftp.informatik.rwth-aachen.de/ftp/pub/Linux/debian/ squeeze main
deb-src http://ftp.informatik.rwth-aachen.de/ftp/pub/Linux/debian/ squeeze main
deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main
deb http://ftp.informatik.rwth-aachen.de/ftp/pub/Linux/debian/ squeeze-updates main
deb-src http://ftp.informatik.rwth-aachen.de/ftp/pub/Linux/debian/ squeeze-updates main
deb http://packages.dotdeb.org squeeze all
deb http://packages.dotdeb.org squeeze-php54 all
deb http://pkg.jenkins-ci.org/debian binary/" > /etc/apt/sources.list
wget -q -O - http://www.dotdeb.org/dotdeb.gpg | apt-key add -
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
aptitude -y update
aptitude -y install build-essential make git zsh dnsutils telnet
aptitude -y install postfix postgrey
aptitude -y install nginx
update-rc.d nginx defaults
/etc/init.d/nginx start
aptitude -y install mysql-server-5.5
aptitude -y install php5-cgi php5-cli php5-dev php5-gd php5-geoip php5-imagick php5-imap php5-intl php5-mcrypt php5-memcached php5-mysql php5-suhosin php5-xdebug php5-xsl
# actually php5-fpm is not functional in this setup, https://bugs.php.net/bug.php?id=62954
# aptitude -y install php5-fpm
# as alternative install spawn-fcgi
aptitude -y install spawn-fcgi
aptitude -y install php-pear
pecl install APC-3.1.13
touch /etc/php5/mods-available/apc.ini && echo 'extension=/usr/lib/php5/20100525/apc.so
; configuration for php apc module
apc.enabled="1"
; alternativ apc.shm_segments="4"
apc.shm_segments="1"
; alternativ apc.shm_size="30"
; groesser RT #1002231
apc.shm_size="1024M"
apc.num_files_hint="2048"
apc.ttl="3600"
apc.user_ttl="600"
apc.gc_ttl="3600"
apc.cache_by_default="1"
apc.slam_defense="0"
apc.file_update_protection="0"
apc.enable_cli="0"
apc.max_file_size="1M"
apc.stat="0"
apc.write_lock="1"
apc.report_autofilter="0"
apc.include_once_override="0"
apc.rfc1867="0"
apc.rfc1867_prefix="upload_"
apc.rfc1867_name="APC_UPLOAD_PROGRESS"
apc.rfc1867_freq="0"
apc.localcache="1"
;GL: obwohl size anscheinend keine Unit fuer localcache.size
apc.localcache.size="1024"
apc.coredump_unmap="0"' > /etc/php5/mods-available/apc.ini
ln -s /etc/php5/mods-available/apc.ini /etc/php5/conf.d/20-apc.ini
pear config-set auto_discover 1
pear channel-discover pear.phing.info
pear install --alldeps phing/phing
pear channel-discover pear.symfony-project.com
pear channel-discover pear.phpunit.de
pear install --alldeps phpunit/PHPUnit
pear install --alldeps phpunit/PHP_Timer
pear install --alldeps pear.phpunit.de/phpcpd
pear install --alldeps channel://pear.netpirates.net/phpDox-0.4.0
aptitude -y install memcached redis-server
aptitude -y install jenkins ant openjdk-6-jdk curl
echo "change root shell to zsh"
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
chsh --shell /bin/zsh
/bin/zsh
if [ "$name" != "" ]; then
echo "add new user"
#---- NEW USER with zsh shell ----#
USER=$name
HOME=/home/$USER
echo "Add user $USER"
adduser $USER --disabled-login
echo "generate .ssh dir in homedir for user $USER"
mkdir $HOME/.ssh
chmod 0700 $HOME/.ssh
echo "clone zsh git repo in $USER homedir"
git clone git://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
chmod 0755 $HOME/.oh-my-zsh
echo "setup default zsh settings"
cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
chmod 0755 $HOME/.zshrc
echo "set correct permissions"
chown -R $USER:$USER /home/$USER
echo "change shell for user $USER"
chsh --shell /bin/zsh $USER
#---- NEW USER with zsh shell ----#
fi
#---- FIREBIRD SPECIAL ----
aptitude -y install xinetd
aptitude -y install libstdc++5
aptitude -y install ia32-libs ia32-libs-dev
aptitude -y install libfbclient2
cd /tmp
wget http://downloads.sourceforge.net/project/firebird/firebird-linux-i386/1.5.6-Release/FirebirdCS-1.5.6.5026-0.i686.tar.gz?r=http%3A%2F%2Fwww.firebirdsql.org%2Fen%2Ffirebird-1-5%2F&ts=1347007894&use_mirror=switch
tar xvfz FirebirdCS-1.5.6.5026-0.i686.tar.gz
cd FirebirdCS-1.5.6.5026-0.i686
./install.sh
#---- FIREBIRD SPECIAL ----
#vim /etc/ssh/sshd_config
#PermitRootLogin no
#pwgen -s -y 20 20
#passwd PASSWORD
echo "\nPlease adjust your zsh settings.\n"
echo "\nInstallation finished, please set a password for new user $USER!\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment