Last active
October 11, 2015 06:17
-
-
Save dgolds/3815651 to your computer and use it in GitHub Desktop.
Install stuff I use on a new Ubuntu box
This file contains 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 | |
# Dgolds' special recipe - Setup Node, Ruby etc on a fresh Ubuntu box | |
# | |
# Just do the following from a clean Ubuntu terminal... | |
# | |
# wget https://gist.github.com/raw/3815651/dgInstallGoodStuff.sh && chmod +x dgInstallGoodStuff.sh && ./dgInstallGoodStuff.sh | |
# | |
# (note it is best to first copy your SSH keys to ~/.ssh, or set them up per https://help.github.com/articles/generating-ssh-keys) | |
# TODO: Make this work on Mac (dgbin has already been Mac-ized) | |
# TODO: - Add brew for Mac | |
# TODO: Bring in enscript | |
# TODO: Move most of this to dgbin and make it fully idempotent so I can just keep re-running it | |
# TODO: Bring in 'ag' (the_silver_surfer) | |
# TODO: Bring in IntelliJ idea | |
mylog=/tmp/dgInstallStuff.sh.$$.log | |
printf "Logging Installation Summary to %s\n" $mylog | tee > $mylog | |
gnome-terminal --geometry=110x16+100+500 -t "Installation activity Summary ($mylog). Press CTRL-C to close..." -x tail -f $mylog & | |
printf "This windows just shows a summary of Installation activity.\n" | |
printf "\nYou will need to respond to some initial prompts in the original window where the script is executing..\n" >> $mylog | |
itexists () | |
{ | |
echo "" | |
echo " =======> Exists: $1" | tee >> $mylog | |
} | |
installingit() | |
{ | |
echo "" | |
echo " =======> Installing: $1" | tee >> $mylog | |
} | |
getit () | |
{ | |
dpkg -s $1 &> /dev/null | |
if [ $? -eq 1 ]; | |
then | |
installingit "$1" | |
sudo apt-get install -y $1 | |
else | |
itexists $1 | |
fi | |
} | |
makedirectory () | |
{ | |
# Create directory $1 | |
if [ -d $1 ] | |
then | |
itexists $1 | |
else | |
mkdir $1 | |
printf "\n =======> Created: %s/\n" $1 | tee >> $mylog | |
fi | |
} | |
############## The actual installation steps ############## | |
makedirectory ~/Apps | |
makedirectory ~/Code | |
makedirectory ~/dgbin | |
getit "xclip" | |
# Install Curl | |
getit "curl" | |
curl --version | grep curl | tee >> $mylog | |
# Install Chrome -- info at http://ubuntuforums.org/showthread.php?t=1351541 | |
dpkg -s google-chrome-stable &> /dev/null | |
if [ $? -eq 1 ]; | |
then | |
installingit "Google Chrome" | |
# Need to Add the repository and signing key for chrome first | |
grep " http://dl.google.com/linux/chrome/deb/" /etc/apt/sources.list.d/google.list | |
if [ $? -eq 1 -o ! -e /etc/apt/sources.list.d/google.list ]; | |
then | |
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google.list | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo apt-get update | |
fi | |
# Now that's done, we can install chrome easily | |
sudo apt-get -y install google-chrome-stable | |
else | |
itexists "Google Chrome" | |
fi | |
#install vim | |
getit "vim" | |
vim --version | grep "VIM - " | tee >> $mylog | |
# Install git | |
getit "git" | |
git --version | tee >> $mylog | |
# Install C++ stuff (needed for NodeJs and other things) | |
getit "build-essential" | |
getit "libssl-dev" | |
g++ --version | grep g++ | tee >> $mylog | |
# Install Nodejs Version Manager (NVM) and then NodeJS | |
if [ -d ~/nvm ] | |
then | |
itexists "Nodejs Version Manager (NVM)" | |
source ~/nvm/nvm.sh | |
echo -n "NodeJs" | |
else | |
installingit "Nodejs Version Manager (NVM)" | |
git clone git://github.com/creationix/nvm.git ~/nvm | |
source ~/nvm/nvm.sh | |
nvm install v0.8.16 | |
nvm alias default 0.8.16 | |
fi | |
nvm version | tee >> $mylog | |
# Install a JDK | |
getit "default-jre" | |
java -version | tee >> $mylog | |
# Install WebStorm IDE | |
if [ -e ~/Downloads/webstorm.tar.gz ] | |
then | |
itexists "~/Downloads/webstorm.tar.gz" | |
else | |
installingit "JetBrains WebStorm IDE for Javascript" | |
curl -L -o ~/Downloads/webstorm.tar.gz http://download.jetbrains.com/webide/WebStorm-5.0.4.tar.gz | |
pushd . | |
cd ~/Apps | |
tar xvf ~/Downloads/webstorm.tar.gz &> /dev/null | |
cd WebStorm-*/bin | |
#./webstorm.sh | |
popd | |
fi | |
# REDIS | |
if [ -d ~/Apps/redis ]; | |
then | |
itexists "Redis" | |
else | |
installingit "Redis" | |
pushd . | |
cd ~/Apps | |
mkdir redis | |
git clone https://github.com/antirez/redis.git | |
cd redis | |
make | |
sudo make install | |
echo TRY... redis-server AND/OR redis-cli | |
popd | |
fi | |
redis-server --version | tee >> $mylog | |
redis-cli --version | tee >> $mylog | |
# Sublime Text 2 | |
if [ -e ~/Downloads/SublimeText2.tar.bz2 ] | |
then | |
itexists "Sublime Text 2" | |
~/Apps/SublimeText2/sublime_text --version | |
else | |
installingit "Sublime Text 2" | |
wget -O ~/Downloads/SublimeText2.tar.bz2 http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2 | |
pushd . | |
cd ~/Apps | |
mkdir SublimeText2 | |
cd SublimeText2 | |
tar xvf ~/Downloads/SublimeText2.tar.bz2 --strip-components=1 --bzip2 &> /dev/null | |
popd | |
fi | |
# Ruby Version Manager (and Ruby) | |
#if [ -d ~/.rvm ] | |
#then | |
# itexists "Ruby Version Manager" | |
# ruby --version | |
#else | |
# installingit "Ruby Version Manager" | |
# # See https://github.com/wayneeseguin/rvm | |
# curl -L https://get.rvm.io | bash -s stable --ruby | |
# rvm install 1.9.2 | |
#fi | |
############ Now, let's make this a good baseline for BOSH / CLOUDFOUNDRY DEVELOPMENT ############ | |
# See https://github.com/cloudfoundry/oss-docs/tree/master/bosh/documentation | |
## 1 - Start with RBENV. See https://github.com/cloudfoundry/oss-docs/blob/master/bosh/documentation/install_ruby_rbenv.md | |
getit git-core | |
getit build-essential | |
getit libsqlite3-dev | |
getit curl | |
getit libmysqlclient-dev | |
getit libxml2-dev | |
getit libxslt-dev | |
getit libpq-dev | |
printf "\nInstalling RBenv from github\n" | tee >> $mylog | |
## 2 = Get RBEnv from git | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
## 3 - Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility | |
printf "Adding ~/.rbenv/bin to your PATH for access to the rbenv command-line utility\n" | tee >> $mylog | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
## 4 - Add rbenv init to your shell to enable shims and autocompletion | |
printf "Adding rbenv init to your shell to enable shims and autocompletion\n" | tee >> $mylog | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
## 5 - Download Ruby 1.9.2 | |
printf "Downloading Ruby 1.9.2-p290\n" | tee >> $mylog | |
# Note: You can also build ruby using ruby-build plugin for rbenv. See https://github.com/sstephenson/ruby-build | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz | |
## 6 - Unpack and install Ruby | |
printf "Unpacking and installing Ruby\n" | tee >> $mylog | |
tar xvfz ruby-1.9.2-p290.tar.gz | |
cd ruby-1.9.2-p290 | |
./configure --prefix=$HOME/.rbenv/versions/1.9.2-p290 | |
make | |
make install | |
printf "Ruby installation completed\n" | tee >> $mylog | |
## 7 - Restart your shell so the path changes take effect | |
source ~/.bash_profile | |
## 8 - Set your default Ruby to be version 1.9.2 | |
printf "Using rbenv global 1.9.2-p290 to set your default Ruby to be Ruby 1.9.2.p290\n" | tee >> $mylog | |
rbenv global 1.9.2-p290 | |
## 9 - Note: The rake 0.8.7 gem may need to be reinstalled when using this method | |
printf "issuing gem pristine rake\n" | tee >> $mylog | |
gem pristine rake | |
gem install rake | |
# Note: After installing gems (gem install or bundle install) run rbenv rehash to add new shims | |
printf "rbenv rehash\n" | tee >> $mylog | |
rbenv rehash | |
## 10 - Update rubygems and install bundler. | |
printf "gem update --system\n" | tee >> $mylog | |
gem update --system | |
printf "gem install bundler\n" | tee >> $mylog | |
gem install bundler | |
## 11 - basex is a neat tool for seeing XML files as treemaps using basexgui. Great for grokking big XML files | |
## .. I need a yaml2xml tool to let me see YAMl same way (and JSON) | |
getit "basex" | |
# Note: After installing gems (gem install or bundle install) run rbenv rehash to add new shims | |
printf "rbenv rehash\n" | tee >> $mylog | |
rbenv rehash | |
## | |
# Note: After installing gems (gem install or bundle install) run rbenv rehash to add new shims | |
## | |
# Suggestions | |
printf "\nIMPORTANT Things to do next..\n" | tee >> $mylog | |
printf "\n1. Set up your ~/.ssh\n" | tee >> $mylog | |
printf "\n2. Start chrome using the Ubuntu windows manager and then pin it to the task bar\n" | tee >> $mylog | |
printf "\n3. Set up git username and password...\n" | tee >> $mylog | |
printf " git config --global user.name \"David Golds\"\n" | tee >> $mylog | |
printf " git config --global user.email [email protected]\n" | tee >> $mylog | |
printf "\n4. Get the ~/dgbin/ stuff via git clone [email protected]:dgolds/dgbin.git \n" | tee >> $mylog | |
printf "\n5. Get hacking!\n" | tee >> $mylog | |
printf "\n\nComplete\n\n" | tee >> $mylog | |
printf "(press CTRL-C to close window)" >> $mylog | |
printf " YOU SHOULD restart your shell so the path changes take effect for Ruby/RBENV...\n" | |
printf " Type... \n source ~/.bash_profile\n\n" | |
printf " ..oh, and remember, it is SHIFT-CTRL-C and SHIFT-CTRL-V for copy and paste in terminal windows!\n\n" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment