Skip to content

Instantly share code, notes, and snippets.

@starkfell
Last active October 31, 2021 14:18
Show Gist options
  • Select an option

  • Save starkfell/c382ec34f5f69e03548550569e6e308f to your computer and use it in GitHub Desktop.

Select an option

Save starkfell/c382ec34f5f69e03548550569e6e308f to your computer and use it in GitHub Desktop.
Deploy Ubuntu 20.04 with Cockpit installed
#!/bin/bash
sudo apt-get update && \
sudo apt-get install -y ca-certificates vim jq curl wget docker.io apt-transport-https lsb-release gnupg net-tools make && \
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null && \
AZ_REPO=$(lsb_release -cs) && \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list && \
sudo apt-get update && \
sudo apt-get install -y azure-cli && \
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \
sudo dpkg -i packages-microsoft-prod.deb && \
sudo apt-get update && \
sudo add-apt-repository universe && \
sudo apt-get install -y powershell
sudo apt-get install cockpit -y && \
sudo systemctl enable --now cockpit.socket && \
sudo systemctl start cockpit && \
echo "[cockpit] is installed."
source /etc/os-release && \
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list" && \
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add - && \
sudo apt update && \
sudo apt-get install -y podman && \
sudo systemctl enable podman.service && \
sudo systemctl start podman.service && \
systemctl status podman.service && \
echo "[podman] installed."
# git clone https://github.com/cockpit-project/cockpit-podman.git
# sudo apt update && sudo apt install -y appstream-util
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
# export NVM_DIR="$HOME/.nvm" && \
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \
# echo "[nvm] is ready."
# ~/.bashrc
# nvm install 16.13.0
# nvm alias default 16.13.0
# cd ~ && \
# cd cockpit-podman && \
# make && \
# sudo make install && \
# cd ~
sudo sed -i -e '$a \ renderer: NetworkManager' /etc/netplan/00-installer-config.yaml && \
sudo netplan apply && \
echo "[netplan] updated and restarted."
# sudo ufw enable && \
# sudo ufw allow from any to any port 22 proto tcp && \
# sudo ufw allow from any to any port 9090 proto tcp && \
# echo "Ubuntu Firewall enabled. Inbound Traffic allowed on ports [22] and [9090]."
sudo apt-get install firewalld -y && \
sudo systemctl start firewalld && \
sudo firewall-cmd --permanent --zone=public --add-port=22/tcp && \
sudo firewall-cmd --permanent --zone=public --add-port=9090/tcp && \
sudo systemctl restart firewalld && \
sudo firewall-cmd --list-all && \
echo "[firewalld] enabled. Inbound Traffic allowed on ports [22] and [9090]."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment