Skip to content

Instantly share code, notes, and snippets.

@hayamiz
Last active November 25, 2020 17:53
Show Gist options
  • Save hayamiz/cb85b78ddcc492c710d802aaa68238c0 to your computer and use it in GitHub Desktop.
Save hayamiz/cb85b78ddcc492c710d802aaa68238c0 to your computer and use it in GitHub Desktop.
WSL Ubuntu environmet setup
#!/bin/bash
set -ex
# enable src in apt/sources.list
sudo sed -i -e 's/^# deb-src/deb-src/g' /etc/apt/sources.list
sudo apt-get update -y
sudo apt-get install -y build-essential git curl zsh zsh-doc cmake
cd ~
# setup time server
sudo apt-get install -y chrony
sudo update-rc.d chrony enable
# checkout env repo
if ! [[ -d ~/env ]]; then
git clone git@bitbucket.org:hayamiz/env.git
cd ~/env/dotfiles/
./setup.sh
cd ~/env/conffiles/
./setup.sh
cd ~
fi
# install utilities
sudo apt-get install -y silversearcher-ag peco mosh
# rbenv dependencies
sudo apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline-dev zlib1g-dev libncurses-dev libffi-dev libgdbm-dev
# install rbenv
if ! [[ -d ~/.rbenv ]]; then
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="$HOME/.rbenv/shims:$PATH"
echo $PATH
# install via rbenv-installer
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash
# load rbenv in the current shell
export PATH="$PATH:$HOME/.rbenv/bin"
eval "$(rbenv init -)"
fi
if [[ $(rbenv versions | wc -l) -lt 1 ]]; then
# get latest ruby version
rbv=$(rbenv install -l 2>/dev/null | egrep '^[2-3]\.[0-9]+\.[0-9]+$' | tail -n1)
rbenv install $rbv
rbenv global $rbv
fi
gem install google-api-client pry --no-document
# install emacs
sudo apt-get build-dep -y emacs
if ! [[ -e /usr/local/bin/emacs ]]; then
cd /tmp/
wget http://ftp.jaist.ac.jp/pub/GNU/emacs/emacs-25.3.tar.xz -O emacs-25.3.tar.xz
tar xvf emacs-25.3.tar.xz
cd emacs-25.3
./configure --prefix=/usr/local
make -j4
sudo make install
cd ~
fi
# install node.js
if (! which npm ) && (! which node); then
sudo apt install -y nodejs npm
sudo npm install n -g
sudo n stable
sudo apt purge -y nodejs npm
fi
# install awscli
sudo apt-get install -y python3-pip
sudo pip3 install awscli
# install clasp (Google Apps CLI)
sudo npm install @google/clasp -g
# install grive2
if ! which grive; then
sudo apt-get install -y libgcrypt-dev libcurl4-openssl-dev libboost-dev libboost-program-options-dev libboost-filesystem-dev libboost-regex-dev libboost-test-dev libexpat-dev libyajl-dev
mkdir -p ~/usr/src
cd ~/usr/src/
git clone https://github.com/vitalif/grive2.git
cd grive2
mkdir build
cd build
cmake ..
make -j4
sudo make install
cd ~
echo "============================================================"
echo " Register Google API Oauth for Grive2"
echo " => https://console.developers.google.com/apis/dashboard"
echo "============================================================"
fi
# install google-sheets-cli
sudo npm install -g google-sheet-cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment