Skip to content

Instantly share code, notes, and snippets.

@jseguillon
Last active April 15, 2020 20:01
Show Gist options
  • Save jseguillon/a462aef872b2416b8042c07773626310 to your computer and use it in GitHub Desktop.
Save jseguillon/a462aef872b2416b8042c07773626310 to your computer and use it in GitHub Desktop.
Installing (once again) a dev environnement
# Use quick create like https://gist.github.com/jseguillon/a462aef872b2416b8042c07773626310
# if you want Ubuntu 19 : follow this gist
# Remember modify VM before launching and NOT activate automatic login when installing if wanna use enhanced session mode !
# Install shh server so it will be easy to copy-paste commands via Putty, until we have enhanced session installed
sudo apt install openssh-server
# Now we can connect through putty
# Do updates first
sudo apt update ; sudo apt upgrade ; sudo apt full-upgrade
# Need git
sudo apt install -y git
# Enhancement mode activation
## In vm
sudo apt install -y linux-azure && sudo apt autoremove -y --purge && sudo shutdown -h now # Dont forget to deactivate auto-login on user settings or you wont connect via Xrdp !
## PowerShell as admin
set-vm "Ubuntu 19.04" -EnhancedSessionTransportType HvSocket # Name as shown in HyperV; now you can restart and activate enhanced session
# Done
# Optionaly create backup
Checkpoint-VM -Name "Ubuntu 19.04"
# Restart VM
# Enable VM to Win ssh
See here => https://winaero.com/blog/enable-openssh-server-windows-10/
#Enable Smb host file share
See here => https://linuxhint.com/shared_folders_hypver-v_ubuntu_guest/
BUT mount in ubutun with '-o uid=$(id -u),gid=$(id -g)' as stated here https://unix.stackexchange.com/questions/68079/mount-cifs-network-drive-write-permissions-and-chown#answer-68081
cat << EOF > /tmp/dev-script.sh
sudo apt -y update
# Most needed tools
sudo apt install -y zsh git terminator
# Docker
sudo apt-get remove docker docker-engine docker.io
sudo apt install -y docker-ce
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
sudo apt-get install -y docker-ce
sudo curl -L https://github.com/docker/compose/releases/download/1.25.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo usermod -aG docker $USER
# Python
sudo apt-get install -y python3-pip virtualenv
# Go
export GO_VERSION=1.13.6
curl -SsL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz -o go${GO_VERSION}.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile
echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.zshenv
# vscode
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt-get install -y apt-transport-https
sudo apt-get -y update
sudo apt-get -y install code
EOF
sudo chmod +x /tmp/dev-script.sh
sudo /tmp/dev-script.sh
cat << EOF > /tmp/kubespray-script.sh
git clone https://github.com/kubernetes-sigs/kubespray.git
cd kubespray/
virtualenv -p python3 ./venv
source ./venv/bin/activate
pip install -r requirements.txt
EOF
chmod +x /tmp/kubespray-script.sh
/tmp/kubespray-script.sh
curl -fsSL https://raw.githubusercontent.com/jseguillon/get-awx/master/get-awx.bash | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment