Steps to setup a remote dev environment to code on the go.
- A remote server setup like AWS EC2 running on Linux
- For Mac, install brew via
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- For Mac, instal wget by
brew install wget
- Login as the root user
- Add a new user with sudo privileges
- Change hostname in remote machine to something easy to remember (e.g. DevMachine)
- Add the new hostname in local machine's
/etc/hosts
likexx.xxx.xxx.xxx DevMachine
- Install Mosh on both client and remote
sudo apt-get install mosh
# brew install mosh
- Update firewall on remote server to accept UDP connection from Mosh (Linux)
sudo ufw allow 60000:61000/udp
- If there is a locale error, use this on remote server (Linux)
sudo apt-get update
sudo apt-get install -y locales
sudo locale-gen "en_US.UTF-8"
sudo update-locale LC_ALL="en_US.UTF-8"
- Install ZSH (Linux)
sudo apt-get install zsh
# brew install zsh
- Copy the path to the installation. The path can be found using:
which zsh
- Make ZSH the default shell
chsh -s /usr/local/bin/zsh
- Install Oh-my-ZSH
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
- Add a .zshrc file and source it
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
source ~/.zshrc
- Setup user config
git config --global user.email "nishantdania@gmail.com"
git config --global user.name "nishantdania"
- Setup SSH keys on Github - Guide
- Generate access token
- Setup login credentials
echo 'machine api.github.com login <user> password <token>' >> ~/.netrc
gem install solargraph
- Install Ripgrep (Linux)
sudo apt-get install ripgrep
# brew install ripgrep
- Install fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
- Fetch the latest vimrc from devmachine repo
git clone git@github.com:remote-dev-machine/rdm-setup.git
- Setup symbolic links to the new vimrc and vim plugins
mkdir ~/.vim
ln -s ~/rdm-setup/.vimrc ~/.vimrc
cp ~/rdm-setup/coc-settings.json ~/.vim/coc-settings.json
- Make Vim the default editor (Linux)
sudo update-alternatives --config editor
- Install new plugins >> Open vim using
vi
. It should start downloading the required packages. If it does not, using:PlugInstall
- Run the following command in vim
:CocInstall coc-json coc-css coc-elixir coc-ember coc-eslint coc-html coc-stylelint coc-solargraph coc-tsserver coc-yaml coc-vimlsp coc-kotlin coc-java coc-xml coc-sql coc-sh coc-graphql
- Install tmux
sudo apt-get install tmux
# brew install tmux
- Add tmux config symlink
ln -s ~/rdm-setup/.tmux.conf ~/.tmux.conf
- Install tmuxinator
sudo apt-get install -y tmuxinator
# brew install tmuxinator
That's it !