Skip to content

Instantly share code, notes, and snippets.

@RaphaelDeLaGhetto
Last active December 22, 2018 20:56
Show Gist options
  • Save RaphaelDeLaGhetto/b7305bda04762eb891b2b3a136e431ac to your computer and use it in GitHub Desktop.
Save RaphaelDeLaGhetto/b7305bda04762eb891b2b3a136e431ac to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# For Ubuntu 18.04
# `sudo` Execute as `app` user
#
# Still have some permissions issues. Some folders/files end up belonging to `root`. Gets about halfway through `ruby` install
#
apt update
apt -y upgrade
#
# Git
#
apt install -y git git-core
#
# Vim
#
apt install -y vim
sudo -H -u $USER mkdir -p ~/.vim/autoload ~/.vim/bundle
sudo -H -u $USER wget https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim -P ~/.vim/autoload
#
# Set up NERDTree for `vim`
#
sudo -H -u $USER echo "call pathogen#infect()" >> ~/.vimrc
sudo -H -u $USER echo "map <C-n> :NERDTreeToggle<CR>" >> ~/.vimrc
sudo -H -u $USER echo "set softtabstop=2" >> ~/.vimrc
sudo -H -u $USER echo "set expandtab" >> ~/.vimrc
sudo -H -u $USER git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
#
# Docker
#
apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt install -y docker-ce
groupadd docker
# BUG: This never actually adds $USER to the group
usermod -aG docker $USER
systemctl enable docker
#
# docker-compose
#
curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
curl -L https://raw.githubusercontent.com/docker/compose/master/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
#
# Node
#
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
bash nodesource_setup.sh
apt install -y nodejs build-essential
#
# Ruby
# Note the `-E` switch on the `source` command below. This is untested
# 2018-10-29 https://askubuntu.com/a/379050/212090
apt install -y autoconf bison libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
sudo -H -u $USER git clone https://github.com/rbenv/rbenv.git ~/.rbenv
sudo -H -u $USER echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
sudo -H -u $USER echo 'eval "$(rbenv init -)"' >> ~/.bashrc
# Possible bug
sudo -E su - $USER -c "source ~/.bashrc"
sudo -H -u $USER git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
sudo chown -R app:app .
sudo su - $USER -c "~/.rbenv/bin/rbenv install 2.5.3"
sudo su - $USER -c "~/.rbenv/bin/rbenv global 2.5.3"
sudo -H -u $USER echo "gem: --no-document" > ~/.gemrc
sudo -H -u $USER gem install bundler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment