Skip to content

Instantly share code, notes, and snippets.

@lcguida
Last active November 28, 2018 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcguida/b6d73dc70f871add9f993755ba3ed5b6 to your computer and use it in GitHub Desktop.
Save lcguida/b6d73dc70f871add9f993755ba3ed5b6 to your computer and use it in GitHub Desktop.
Ubuntu new install setup
#!/bin/bash
set -xe
# Update the system
sudo apt -y update && sudo apt -y upgrade
# Make GRUB remeber the last chosen entry
function grub_set_remeber_last_option () {
grub_file=/etc/default/grub
if grep -qx "GRUB_DEFAULT=.*" $grub_file
then
sudo sed -i -e 's/GRUB_DEFAULT=\(.*\)$/GRUB_DEFAULT=saved/g' $grub_file
else
echo 'Will add GRUB_DEFAULT'
# echo >> "GRUB_DEFAULT=saved"
fi
if grep -qx "GRUB_SAVEDEFAULT=.*" $grub_file
then
sudo sed -e 's/GRUB_DEFAULT=\(.*\)$/GRUB_SAVEDEFAULT=true/g'
else
echo "GRUB_SAVEDEFAULT=true" | sudo tee -a $grub_file
fi
sudo update-grub
}
grub_set_remeber_last_option
# Install basic packages
sudo apt -y install \
build-essential \
git \
vim \
zsh \
dconf-tools \
fonts-powerline \
curl \
apt-transport-https \
ca-certificates \
software-properties-common
# Clone dotfiles to /tmp
mkdir -p /tmp/install
dotfiles=/tmp/install/dotfiles
git clone https://github.com/lcguida/dotfiles $dotfiles
# Copy basic files
cp $dotfiles/.gemrc ~/.gemrc
cp $dotfiles/.gitconfig ~/.gitconfig
cp $dotfiles/.vimrc ~/.vimrc
# Create a secrest file (used by .zshrc)
touch ~/.secrets
######## Vim ##########
# Install pathogen
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# Base16 color
git clone https://github.com/chriskempson/base16-vim ~/.vim/bundle/base16-vim
# Airline
git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline
# Airline themes
git clone https://github.com/vim-airline/vim-airline-themes ~/.vim/bundle/vim-airline-themes
######### Prezto #########
zsh -c "git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto""
# Setup symlikns
zsh <<'EOF'
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
EOF
# Set zsh as default shell
sudo usermod --shell $(which zsh) $USER
# Copy configurations
cp $dotfiles/.zshrc ~/.zshrc
cp $dotfiles/.zpreztorc ~/.zpreztorc
###### RVM install ########
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
#### Docker #####
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt -y update
sudo apt -y install docker-ce
# Add current user to docker group
sudo adduser $USER docker
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment