The purpose of this project is to help me quickly setup a go development environment using either an Ubuntu server or a Chromebook. I created an installation script because (1) I am lazy, (2) I tear down and re-create enviornments all the time, and (3) I want my enviornments to be the same everywhere everytime so that I become proficent with the tools.
Execute the following line from an Ubuntu 14.04 or newer server (see below for Chromebook details):
source <(curl -s https://raw.githubusercontent.com/cboecking/golang-env-setup/master/go_install.sh)
- The script assumes you want to use terminal-based authoring tools
- It installs go (golang)
- It installs and executes a sample project to confirm all worked as expected
- It configures vim with the vim-go development environment
- It installs tmux so that you can create and share terminal sessions
- It appends details (my preferences) to your .profile
My Chromebook is proving to be a great development platform for go. It has a 4-core i3 Intel processor, and the 4GB of RAM seem to be enough given how little ChromeOS and Ubuntu cli consume. If you want more RAM, consider this machine. Or, you can go extreme with the pixel.
I am surprised by and impressed with how easy it is to install Ubuntu inside your Chromebook and access it directly through the Chrome OS terminal.
Configuring Chromebook for Development (more)
- Put chromebook in developer mode. In my case:
- Press
Esc + Refresh function key + Power
==> to enter recovery mode - When the white screen comes up, press
Ctrl-d
==> to enter developer mode - Log into Chrome when it finally boots back up
- Download crouton (direct link)
- Install the Chrome plug-ins listed in the below section
- Press Ctrl-Alt-t to open a terminal window then type
shell
- Go to the downloads directory using:
cd ~/Download
- Make crouton executable using:
chmox +x crouton
- Link to my crouton cheatsheet
- Execute crouton to install a cli version of Ubuntu 14.04 using:
sudo sh crouton -r trusty -t cli-extra
- Create a pristine backup of your new Ubuntu installation using:
sudo edit-chroot -b trusty
- Rename your backup file to include the word 'pristine' for future reference
- Start using Ubuntu from a terminal->shell using:
sudo enter-chroot
- Note: I created an alias in my ~/.bashrc of
ec
to execute: sudo enter-chroot - Once you reach your Ubuntu prompt, install curl using:
sudo apt-get install curl -y
- Install and configure your go environment using the command listed at the top of this page.
- Secure Shell
- Crosh Window - allows you to open a secure shell in a separate window.
Easy way to connect to openvpn server - see openvpn2 script
Put chromebook in developer mode
copy above/link openvpn2 script to ~/Downloads/openpvn2
enter shell
cd /usr/local/bin/
sudo cp ~/Downloads/openvpn2 .
sudo chmod +x openvpn2
cd ~/Downloads/
openvpn2 yourVPNfile.ovpn
ctrl+c to end the session
Below is a copy of the above openvpn2 script - just in case
#!/bin/sh -e
trap '' 2
# Stop shill and restart it with a nicer attitude towards tun0
sudo stop shill
sudo start shill BLACKLISTED_DEVICES=tun0
# Sleep 10 seconds to allow chromebook to reconnect to the network
sudo sleep 10
sudo openvpn --mktun --dev tun0
sudo sleep 3
# Add google DNS on top of current ones, since openvpn command does not do it
sudo sed -i '1s/^/# new DNS\nnameserver 8.8.8.8\nnameserver 8.8.4.4\n# old DNS\n/' /var/run/shill/resolv.conf
# Lauch openvpn, finally...
sudo openvpn --config $1 --dev tun0
# When ctrl-c is hit remove tun0 and cleanup the DNS
sudo openvpn --rmtun --dev tun0
sudo sed -i '/# new DNS/,/# old DNS/d' /var/run/shill/resolv.conf
trap 2
- Written tutorial
- Video tutorial - same as written
- See cheatsheet in this repository