Skip to content

Instantly share code, notes, and snippets.

@schuhwerk
Created November 9, 2022 10:46
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 schuhwerk/20dd280446bffc020cb496a5cbb7ad7d to your computer and use it in GitHub Desktop.
Save schuhwerk/20dd280446bffc020cb496a5cbb7ad7d to your computer and use it in GitHub Desktop.
Trellis-CLI in Windows (WSL1)
# Do this step by step.
# WSL: https://learn.microsoft.com/de-de/windows/wsl/install
# Trellis-Cli: https://github.com/roots/trellis-cli
# install brew (packet manager) - Just for trellis-cli.
# If you don't have already probably easier to just download and add to Path...
sudo apt update
sudo apt-get install build-essential curl file git
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# add brew to path
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
# install trellis-cli
brew install roots/tap/trellis-cli
# Error: An exception occurred within a child process:
# Errno::EFAULT: Bad address - /home/linuxbrew/.linuxbrew/bin/gcc-12
# so I deleted the symlink /home/linuxbrew/.linuxbrew/bin/gcc-12
# install python & virtualenv. using brew to install did not work for me...
sudo apt-get install -y python3 python-is-python3 python3-pip virtualenv
# install vagrant on wsl. needs to be the same as in windows! check in win with vagrant -v
#sudo apt-get update && sudo apt-get dist-upgrade
## apt list -a vagrant
# sudo apt-get install vagrant=2.2.18 <- didn't find that version, so manual download.
wget https://releases.hashicorp.com/vagrant/2.2.18/vagrant_2.2.18_x86_64.deb
sudo apt install ./vagrant_2.2.18_x86_64.deb
# Add proper file-permissions (remove the first #)
sudo nano /etc/wsl.conf
# [automount]
# options = "metadata"
# [network]
# generateResolvConf = false
# sudo nano /etc/resolv.conf. resolv.conf already existed as a symlink to a non-existing file. so i just deleted the symlink...
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
# you probably have to restart wsl
# now you can set proper permissions the folder...
# You would probably get around that by using "export ANSIBLE_CONFIG='ansible.config'"
sudo chmod 750 .
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
# int local server
# cd /mnt/c/trellis/
trellis init
trellis up
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1" && trellis up && trellis provision development
# had to manually add to hosts file in windows (without #)
# 192.168.56.5 trellis2.test
# 192.168.56.5 www.trellis2.test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment