Created
January 26, 2022 20:23
-
-
Save edinnen/141bbb635fc03214bda596ab302a9768 to your computer and use it in GitHub Desktop.
Bash script to install Rancher Desktop 0.7.1 and Nerdctl automatically for OSX, Windows, and Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
linux_install(){ | |
echo "Installing brew package manager. Required to install nerdctl..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo "Installing nerdctl..." | |
brew install nerdctl | |
echo "Downloading rancher-desktop to ~/rancher-desktop" | |
rancher_url="https://github.com/rancher-sandbox/rancher-desktop/releases/download/v0.7.1/rancher-desktop-0.7.1-linux.zip" | |
cd ~/ | |
curl $rancher_url -O -J -L | |
unzip rancher-desktop-0.7.1-linux.zip -d ~/rancher-desktop | |
cd ~/rancher-linux | |
echo "Installations complete. Run ./rancher-desktop to start Rancher Desktop" | |
echo "I recommend adding a Bash alias like \"alias docker=\$(nerdctl)\" to your ~/.bashrc or ~/.zshrc file for ease of use/transitioning" | |
rm ~/rancher-desktop-0.7.1-linux.zip | |
} | |
windows_install(){ | |
echo "Downloading Rancher Desktop .exe file..." | |
rancher_url="https://github.com/rancher-sandbox/rancher-desktop/releases/download/v0.7.1/Rancher.Desktop.Setup.0.7.1.exe" | |
curl $rancher_url -O -J -L | |
echo "Launching Rancher Desktop install. Press enter when completed. [Enter]:" | |
./Rancher.Desktop.Setup.0.7.1.exe | |
read -s -N 1 -t 1 key | |
echo "Installing brew package manager. Required to install nerdctl..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo 'eval "$(/home/linux/brew/.linuxbrew/bin/brew shellenv)"' >> ~/.profile | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
sudo apt-get install build-essential | |
echo "Installing nerdctl..." | |
brew install gcc nerdctl | |
echo "Installations successful. Please use the command nerdctl rather than docker to start and manage images" | |
rm ./Rancher.Desktop.Setup.0.7.1.exe | |
} | |
osx_install(){ | |
echo "Installing Rancher Desptop to /Applications..." | |
rancher_url="https://github.com/rancher-sandbox/rancher-desktop/releases/download/v0.7.1/Rancher.Desktop-0.7.1-mac.x86_64.zip" | |
curl $rancher_url -O -J -L | |
sudo unzip Rancher.Desktop-0.7.1-mac.x86_64.zip /Applications | |
echo "Installing brew package manager. Required to install nerdctl..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo "Installing lima (used to run nerdctl in VM)..." | |
brew install lima | |
echo "Starting lima..." | |
limactl start | |
echo "Installations successful. Nerdctl can be run like: lima nerdctl" | |
echo "I recommend adding a Bash alias like \"alias docker=\$(lima nerdctl)\" and \"alias nerdctl=\$(lima nerdctl)\" to your ~/.bashrc or ~/.zshrc file for ease of use/transitioning" | |
rm Rancher.Desktop-0.7.1-mac.x86_64.zip | |
} | |
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | |
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then | |
windows_install | |
else | |
linux_install | |
fi | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
osx_install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment