Skip to content

Instantly share code, notes, and snippets.

@RaphaelDeLaGhetto
Last active December 22, 2018 17:19
Show Gist options
  • Save RaphaelDeLaGhetto/f23266d5c7c2ae74a331d8391db0b28c to your computer and use it in GitHub Desktop.
Save RaphaelDeLaGhetto/f23266d5c7c2ae74a331d8391db0b28c to your computer and use it in GitHub Desktop.
Setup all my usual post-install goodies on an Ubuntu 16.04 server
#!/bin/bash
#
# As detailed here: https://libertyseeds.ca/2017/07/10/A-Home-Based-Ubuntu-16-04-Production-Server-with-Salvaged-Equipment/
# `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
#
# Vim
#
apt install -y vim
sudo -u $USER mkdir -p ~/.vim/autoload ~/.vim/bundle
sudo -u $USER wget https://raw.github.com/tpope/vim-pathogen/HEAD/autoload/pathogen.vim -P ~/.vim/autoload
#
# Set up NERDTree for `vim`
#
sudo -u $USER echo "call pathogen#infect()" >> ~/.vimrc
sudo -u $USER echo "map <C-n> :NERDTreeToggle<CR>" >> ~/.vimrc
sudo -u $USER echo "set softtabstop=2" >> ~/.vimrc
sudo -u $USER echo "set expandtab" >> ~/.vimrc
sudo -u $USER git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
#
# Docker
#
apt install 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
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 | sudo bash -
apt install -y nodejs build-essential
#
# 2018-2-25
# At this point, much of what's been saved to the home directory is owned by `root`.
# The `exec $SHELL` commands below do not execute. For next time, remember to change
# ownership and try running the `exec` commands as the `app` user.
#
# Ruby
#
apt install -y git curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs
sudo -u $USER git clone https://github.com/rbenv/rbenv.git ~/.rbenv
sudo -u $USER echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
sudo -u $USER echo 'eval "$(rbenv init -)"' >> ~/.bashrc
sudo -u $USER exec $SHELL
sudo -u $USER git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
sudo -u $USER echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
sudo -u $USER exec $SHELL
sudo -u $USER rbenv install 2.5.3
sudo -u $USER rbenv global 2.5.3
sudo -u $USER gem install bundler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment