Created
December 11, 2014 19:42
-
-
Save appnus/1c022da3078c2b879eec to your computer and use it in GitHub Desktop.
PKG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
<<C | |
Debian (testing) - Jessie | |
Amazon EC2 AMI -> ami-1420b57c | |
C | |
dir=/tmp | |
cabal_version=1.20.0.3 | |
go_version=1.4 | |
ghc_version=7.8.3 | |
lua_version=5.2 | |
mysql_version=5.6 | |
nginx_version=1.7.8 | |
nodejs_version=0.10.33 | |
postgresql_version=9.4 | |
postgresql_port=5443 | |
postgresql_password=" " | |
redis_version=2.8.18 | |
ruby_version=2.1.5 | |
ruby_stage=$(echo $ruby_version | awk -F"." '{ print $1"."$2 }') | |
# Must be ran as root | |
[ $EUID -ne 0 ] && echo -e "\n\033[0;31mE: Script must be ran as root user\033[0m" && exit | |
[ ! -d $dir ] && mkdir $dir | |
# cURL is required | |
command -v curl > /dev/null 2>&1 || { | |
apt-get update | |
apt-get install curl libcurl3 libcurl3-dev -y | |
} | |
install() { | |
case "$1" in | |
[eE]*lm) | |
command -v cabal > /dev/null 2>&1 || install haskell | |
cabal update | |
cabal install elm --reinstall | |
;; | |
[fF]*fmpeg) | |
apt-get install deb-multimedia-keyring -y | |
echo "deb http://www.deb-multimedia.org testing main" > /etc/apt/sources.list.d/ffmpeg.list | |
apt-get update && apt-get autoremove -y | |
apt-get install ffmpeg libavcodec-extra-* -y | |
;; | |
[gG]*o) | |
cd $dir | |
curl -LO https://storage.googleapis.com/golang/go$go_version.linux-amd64.tar.gz | |
tar xvf go$go_version.linux-amd64.tar.gz | |
mv go /etc | |
rm -rf go$go_version.linux-amd64.tar.gz | |
cd /usr/local/bin && ln -sf /etc/go/bin/* . | |
;; | |
[hH]*askell) | |
apt-get update && apt-get install build-essential ca-certificates libgmp10 libgmp-dev libffi-dev zlib1g-dev -y | |
cd $dir | |
curl -LO https://www.haskell.org/ghc/dist/$ghc_version/ghc-$ghc_version-x86_64-unknown-linux-deb7.tar.xz | |
tar xvf ghc-$ghc_version-x86_64-unknown-linux-deb7.tar.xz | |
cd ghc-$ghc_version | |
./configure --prefix=/etc/ghc/$ghc_version && make install | |
cd .. && rm -rf ghc-$ghc_version ghc-$ghc_version-x86_64-unknown-linux-deb7.tar.xz | |
export PATH=/etc/ghc/$ghc_version/bin:$PATH | |
curl -LO http://hackage.haskell.org/package/cabal-install-$cabal_version/cabal-install-$cabal_version.tar.gz | |
tar xvf cabal-install-$cabal_version.tar.gz | |
cd cabal-install-$cabal_version | |
PREFIX=/etc/ghc/$ghc_version ./bootstrap.sh --global | |
cd .. && rm -rf cabal-install-$cabal_version cabal-install-$cabal_version.tar.gz | |
cd /usr/local/bin && ln -sf /etc/ghc/$ghc_version/bin/* . | |
;; | |
[lL]*ua) | |
apt-get install lua$lua_version lua$lua_version-doc lua-curses lua-curses-dev lua-posix -y | |
;; | |
[mM]*ysql) | |
apt-get install mysql-server-$mysql_version mysql-client-$mysql_version mysql-common-$mysql_version mysql-server-core-$mysql_version \ | |
mysql-client-core-$mysql_version mysql-source-$mysql_version -y | |
sed -i "s/bind-address/#bind-address/g" /etc/mysql/my.cnf | |
service mysql restart | |
;; | |
[nN]*ginx) | |
cd $dir | |
curl -LO http://nginx.org/download/nginx-$nginx_version.tar.gz | |
tar xvf nginx-$nginx_version.tar.gz | |
cd nginx-$nginx_version | |
./configure --prefix=/etc/nginx && make && make install | |
cd .. && rm -rf nginx-$nginx_version nginx-$nginx_version.tar.gz | |
cd /usr/local/bin && ln -sf /etc/nginx/sbin/nginx . | |
;; | |
[nN]*odejs) | |
cd $dir | |
curl -LO http://nodejs.org/dist/v$nodejs_version/node-v$nodejs_version.tar.gz | |
tar xvf node-v$nodejs_version.tar.gz | |
cd node-v$nodejs_version | |
./configure && make && make install | |
cd .. && rm -rf node-v$nodejs_version node-v$nodejs_version.tar.gz | |
;; | |
[pP]*hp) | |
apt-get install php5 php-pear php5-apcu php-doc php5-geoip php5-imagick php5-json php5-memcache php5-memcached \ | |
php5-mongo php5-redis php5-ssh2 php5-cgi php5-cli php5-curl php5-common php5-dbg php5-dev php5-fpm php5-gd \ | |
php5-imap php5-mcrypt php5-mysql php5-odbc php5-pgsql php5-sqlite php5-xmlrpc php5-xsl php5-xdebug -y | |
sed -i "s/short_open_tag = Off/short_open_tag = On/g" /etc/php5/cgi/php.ini | |
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 25M/g" /etc/php5/cgi/php.ini | |
sed -i "s/;phar.readonly = On/phar.readonly = 0/g" /etc/php5/cgi/php.ini | |
sed -i "s/short_open_tag = Off/short_open_tag = On/g" /etc/php5/cli/php.ini | |
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 25M/g" /etc/php5/cli/php.ini | |
sed -i "s/;phar.readonly = On/phar.readonly = 0/g" /etc/php5/cli/php.ini | |
sed -i "s/short_open_tag = Off/short_open_tag = On/g" /etc/php5/fpm/php.ini | |
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 25M/g" /etc/php5/fpm/php.ini | |
sed -i "s/;phar.readonly = On/phar.readonly = 0/g" /etc/php5/fpm/php.ini | |
sed -i "s/listen = localhost:9000/listen = \/var\/run\/php5-fpm.sock/g" /etc/php5/fpm/pool.d/www.conf | |
sed -i "s/;listen.mode = 0660/listen.mode = 0660/g" /etc/php5/fpm/pool.d/www.conf | |
service php5-fpm restart | |
;; | |
[pP]*ostgresql) | |
apt-get install postgresql-$postgresql_version postgresql-client-$postgresql_version postgresql-contrib-$postgresql_version \ | |
postgresql-server-dev-$postgresql_version libpq-dev -y | |
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'\t/g" /etc/postgresql/$postgresql_version/main/postgresql.conf | |
sed -i "s/port = 5432/port = $postgresql_port/g" /etc/postgresql/$postgresql_version/main/postgresql.conf | |
echo -e "\nhost\tall\t\tall\t\t0.0.0.0/0\t\tmd5" >> /etc/postgresql/$postgresql_version/main/pg_hba.conf | |
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password '$postgres_password';" | |
service postgresql restart | |
;; | |
[rR]*edis) | |
cd $dir | |
curl -LO http://download.redis.io/releases/redis-$redis_version.tar.gz | |
tar xvf redis-$redis_version.tar.gz | |
cd redis-$redis_version | |
make && make install | |
mkdir /var/redis && cp redis.conf /var/redis | |
cd .. && rm -rf redis-$redis_version redis-$redis_version.tar.gz | |
sed -i "s/daemonize no/daemonize yes/g" /var/redis/redis.conf | |
sed -i "s/pidfile \/var\/run\/redis.pid/pidfile \/var\/redis\/redis.pid/g" /var/redis/redis.conf | |
sed -i "s/logfile \"\"/logfile \/var\/redis\/redis.log/g" /var/redis/redis.conf | |
sed -i "s/dbfilename dump.rdb/dbfilename redis.rdb/g" /var/redis/redis.conf | |
sed -i "s/dir .\//dir \/var\/redis/g" /var/redis/redis.conf | |
;; | |
[rR]*uby) | |
cd $dir | |
curl -LO http://cache.ruby-lang.org/pub/ruby/$ruby_stage/ruby-$ruby_version.tar.gz | |
tar xvf ruby-$ruby_version.tar.gz | |
cd ruby-$ruby_version | |
./configure && make && make install | |
cd .. && rm -rf ruby-$ruby_version ruby-$ruby_version.tar.gz | |
;; | |
[rR]*ust) | |
curl -s https://static.rust-lang.org/rustup.sh | sudo sh | |
;; | |
esac | |
} | |
m="$1" && shift | |
for pkg in "$@"; do $m $pkg; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment