Skip to content

Instantly share code, notes, and snippets.

@kittolau
Last active April 19, 2017 20:40
Show Gist options
  • Save kittolau/ea92d9d12303e9c75abc to your computer and use it in GitHub Desktop.
Save kittolau/ea92d9d12303e9c75abc to your computer and use it in GitHub Desktop.
Ubuntu 14.04 software install script, curl -L <url> | bash
#!/bin/sh
#==============================
#Install beanstalkd - from apt-get
#https://www.digitalocean.com/community/tutorials/how-to-install-and-use-beanstalkd-work-queue-on-a-vps
#==============================
sudo apt-get install beanstalkd -y < "/dev/null"
#!/bin/sh
#==========================
#Install Bower - from NPM
#=========================
sudo npm install bower -g
#!/bin/sh
#============================
#Install Chef - from GEM
RVM_VERSION=2.1.3
#============================
rvm install $RVM_VERSION
#change to RVM_VERSION
rvm $RVM_VERSION
#install chef
gem install chef ruby-shadow --no-ri --no-rdoc
#change back to user specified default rvm version
rvm default
#!/bin/sh
#============================
#Install Composer - from http://getcomposer.org
#============================
sudo apt-get install php5-cli -y < "/dev/null"
curl -s http://getcomposer.org/installer | php
sudo cp composer.phar /usr/local/bin/composer.phar
rm composer.phar
composer.phar --version
#!/bin/sh
#==============================
#Install docker - from https://get.docker.com/
#==============================
#check if Ubuntu OS versions is higher than 3.10
if echo $(uname -r) | grep -P "^[3-9]\.[1-9]\d{1,}" -
then
if echo $(lsb_release -a) | grep -P "precise" -
then
if echo $(uname -r) | grep -P "^[3-9]\.(?:[1-9][3-9]{1,}|[1-9]\d{2,})" -
then
sudo apt-get update
sudo apt-get install linux-image-generic-lts-trusty -y < "/dev/null"
sudo reboot
fi
fi
curl -sSL https://get.docker.com/ | sh
else
echo "Kernels older than 3.10 lack some of the features required to run Docker containers"
fi
#!/bin/sh
#==============================
#install firefox - from apt-get
#==============================
sudo apt-get install firefox -y < "/dev/null"
#!/bin/sh
#============================
#Install Git - from apt-get
#============================
sudo apt-get install git -y < "/dev/null"
#!/bin/sh
#==============================
#Install imagemagick - from apt-get
#this should handle most of the needs come from different image library
#==============================
#lib required by ruby's rmagick
sudo apt-get install libmagickcore-dev libmagickwand-dev ruby-dev -y < "/dev/null"
#lib required by python's pillow
sudo apt-get install libjpeg-dev -y < "/dev/null"
#try symlink lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
#adding support for jpg jpg2000 and png, must install this first, otherwise imagemagick won't be able to add support for jpg
sudo apt-get install libjpeg62 libjpeg62-dev libjasper-runtime libjasper-dev libpng12-0 libpng12-dev -y < "/dev/null"
#install imagemagick
sudo apt-get install imagemagick -y < "/dev/null"
#!/bin/sh
#==============================
#Install jdk - from apt-get
#==============================
sudo apt-get install python-software-properties -y < "/dev/null"
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
#A good idea to minimise any Java conflicts is to remove OpenJDK.
sudo apt-get remove --purge openjdk* -y < "/dev/null"
sudo apt-get install oracle-java8-installer -y < "/dev/null"
#!/bin/sh
#==============================
#Install jre - from apt-get
#==============================
sudo apt-get install default-jre -y < "/dev/null"
#!/bin/sh
#==============================
#Install apache mysql php - from apt-get
#==============================
#install apache2
sudo apt-get install apache2 -y < "/dev/null"
#install mysql
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql -y < "/dev/null"
#install mysql system table
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
#install php
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt -y < "/dev/null"
#change index.php as high priority than index.html
#sudo nano /etc/apache2/mods-enabled/dir.conf
#install php module(optional)
sudo apt-get install php5-gd php5-cli php5-mcrypt -y < "/dev/null"
#install sqlite
#sudo apt-get install sqlite php5-sqlite -y < "/dev/null"
#create a symbolic link and enable the module
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
#restart apache2
sudo service apache2 restart
#!/bin/sh
#==============================
#Install mongodb - from apt-get via http://repo.mongodb.org/apt/ubuntu
#==============================
#import they key for the official MongoDB repository
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
# add the MongoDB repository details so APT will know where to download the packages from
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install mongodb-org -y < "/dev/null"
#!/bin/sh
#============================
#Install Mysql
#============================
sudo apt-get install mysql-server mysql-client libmysqlclient-dev -y < "/dev/null"
#!/bin/sh
#============================
#Install Nginx
#============================
sudo apt-get install nginx -y < "/dev/null"
#!/bin/sh
#==========================
#Install NodeJS - from apt-get/PPA
#=========================
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs -y < "/dev/null"
sudo apt-get install build-essential -y < "/dev/null"
#!/bin/sh
#==============================
#Install Nodejs - from NVM
NODEJS_VERSION=stable
#==============================
nvm install $NODEJS_VERSION
#To set a default Node version to be used in any new shell
nvm alias default $NODEJS_VERSION
#!/bin/sh
#==============================
#Install NVM - from https://raw.githubusercontent.com/creationix
#==============================
#dependencies for NVM to buildnecessary components
sudo apt-get install build-essential libssl-dev -y < "/dev/null"
#install NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash
#source for current session
source ~/.profile
#!/bin/sh
#==============================
#Install php-fpm for nginx
#prerequisite: nginx
#==============================
sudo apt-get install php5-fpm -y < "/dev/null"
#turn cgi.fix_pathinfo as 0
if grep -q '^;cgi.fix_pathinfo=1' "/etc/php5/fpm/php.ini"; then
echo "default ;cgi.fix_pathinfo=1 exists, changing to cgi.fix_pathinfo=0"
sed -i 's/^;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini
else
if grep -q '^cgi.fix_pathinfo=1' "/etc/php5/fpm/php.ini"; then
echo "cgi.fix_pathinfo=1 exists, changing to cgi.fix_pathinfo=0"
sed -i 's/^cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini
else
echo "cgi.fix_pathinfo=0"
fi
fi
#ensure listen listen = /var/run/php5-fpm.sock
if grep -q '127\.0\.0\.1:9000' "/etc/php5/fpm/pool.d/www.conf"; then
echo "default listen = 127.0.0.1:9000 exists, changing to listen = /var/run/php5-fpm.sock"
sed -i 's/127\.0\.0\.1:9000/\/var\/run\/php5-fpm\.sock/g' /etc/php5/fpm/pool.d/www.conf
else
echo "127.0.0.1:9000 does not exist in /etc/php5/fpm/pool.d/www.conf"
fi
#uncomment the listen.owner = www-data
if grep -q '^;listen\.owner = www-data' "/etc/php5/fpm/pool.d/www.conf"; then
echo "default ;listen.owner = www-data exists, changing to listen.owner = www-data"
sed -i 's/^;listen\.owner = www-data/listen\.owner = www-data/g' /etc/php5/fpm/pool.d/www.conf
else
echo "default ;listen.owner = www-data not exists"
fi
#uncomment the listen.group = www-data
if grep -q '^;listen\.group = www-data' "/etc/php5/fpm/pool.d/www.conf"; then
echo "default ;listen.group = www-data exists, changing to listen.group = www-data"
sed -i 's/^;listen\.group = www-data/listen\.group = www-data/g' /etc/php5/fpm/pool.d/www.conf
else
echo "default ;listen.group = www-data not exists"
fi
#uncomment the listen.mode = 0660
if grep -q '^;listen\.mode = 0660' "/etc/php5/fpm/pool.d/www.conf"; then
echo "default ;listen.mode = 0660 exists, changing to listen.mode = 0660"
sed -i 's/^;listen\.mode = 0660/listen\.mode = 0660/g' /etc/php5/fpm/pool.d/www.conf
else
echo "default ;listen.mode = 0660 not exists"
fi
#restart php5-fpm
sudo service php5-fpm restart
#!/bin/sh
#==============================
#Install Python pip pillow's dependencies
#NOTICE
# - INSTALL THIS BEFORE pip install pillow, otherwise it needs to reinstall package using pip install --no-cache-dir -I pillow
#==============================
sudo apt-get install libjpeg-dev -y < "/dev/null"
#!/bin/sh
#============================
#Install PIP - from apt-get
#============================
sudo apt-get install python-pip python-dev build-essential -y < "/dev/null"
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
#!/bin/sh
#============================
#Install Rails - from GEM
RAILS_VERSION=4.2.1
#============================
#install Rails
gem install rails -v $RAILS_VERSION
#!/bin/sh
#==============================
#Install redis - from apt-get
#==============================
sudo apt-get install redis-server -y < "/dev/null"
#!/bin/sh
#==============================
#Install Rails Gem rmagick's dependencies
#NOTICE
# - INSTALL THIS BEFORE bundle install, otherwise rmagick would not be installed
# - Use deploy user to install
#=============================
#lib required by rmagick
sudo apt-get install libmagickcore-dev libmagickwand-dev ruby-dev -y < "/dev/null"
#adding support for jpg jpg2000 and png, must install this first, otherwise imagemagick won't be able to add support for jpg
sudo apt-get install libjpeg62 libjpeg62-dev libjasper-runtime libjasper-dev libpng12-0 libpng12-dev -y < "/dev/null"
#install imagemagick
sudo apt-get install imagemagick -y < "/dev/null"
#show image magick version
convert -v
#show supported type
identify -list format
#check if JPG is supported
identify -list format | grep 'JPEG' -
#!/bin/sh
#============================
#Install Ruby - from RVM
RUBY_VERSION=2.1.3
#============================
rvm install $RUBY_VERSION
rvm $RUBY_VERSION --default
#The last step is to tell Rubygems not to install the documentation for each package locally
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
#!/bin/sh
#============================
#Install RVM - from https://get.rvm.io
#============================
#install Ruby required dependency
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libpcre3-dev libncurses5-dev libreadline6-dev python-software-properties -y < "/dev/null"
#install ruby using rvm
#gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
\curl -sSL https://get.rvm.io | bash -s stable
source /home/$(whoami)/.rvm/scripts/rvm
source /etc/profile.d/rvm.sh
#!/bin/sh
#==============================
#Download selenium standalone server
#==============================
cd ~/
sudo wget http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.2.jar
sudo mkdir -p /usr/local/share/java
sudo cp selenium-server-standalone-2.48.2.jar /usr/local/share/java/selenium-server-standalone-2.48.2.jar
sudo ln -fs /usr/local/share/java/selenium-server-standalone-2.48.2.jar /usr/local/share/java/selenium-server
#clean up the downloaded file
sudo rm selenium-server-standalone-2.48.2.jar
#!/bin/sh
#==============================
#Install tesseract-ocr - from apt-get
#==============================
sudo apt-get install tesseract-ocr -y < "/dev/null"
#!/bin/sh
#==============================
#Install tor - from apt-get
#==============================
CODENAME=$(lsb_release -c | sed -r 's/Codename://g' | sed -r 's/\s+//g')
if [ ! -f /etc/apt/sources.list.d/tor.list ]; then
sudo touch /etc/apt/sources.list.d/tor.list
sudo bash -c " echo 'deb http://deb.torproject.org/torproject.org $CODENAME main' >> /etc/apt/sources.list.d/tor.list"
sudo bash -c " echo 'deb-src http://deb.torproject.org/torproject.org $CODENAME main' >> /etc/apt/sources.list.d/tor.list"
fi
iptables -A OUTPUT -p tcp -d keys.gnupg.net --dport 11371 -j ACCEPT
gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
iptables -D OUTPUT -p tcp -d keys.gnupg.net --dport 11371 -j ACCEPT
apt-get update
apt-get install tor deb.torproject.org-keyring
TOR_VERSION='tor-0.2.6.10'
#install build tool
sudo apt-get install build-essential libevent-dev -y < "/dev/null"
cd ~/
sudo wget https://www.torproject.org/dist/$TOR_VERSION.tar.gz
tar -xvzf $TOR_VERSION.tar.gz
cd $TOR_VERSION
make distclean
./configure --disable-asciidoc && make && sudo make install
#clean up
cd ~/
sudo rm $TOR_VERSION.tar.gz
sudo rm -r $TOR_VERSION
#!/bin/sh
#==============================
#Install firefox & dependencies - from apt-get
#==============================
sudo apt-get install xvfb -y < "/dev/null"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment