Update 'prep-grid-vm.sh'
This commit is contained in:
1 parent
6a65e27c5c
commit
e16a8dca01
1 file changed
+59
-27
+59
-27
@@ -1,31 +1,63 @@
|
|||||||
#/bin/bash
|
#!/bin/bash
|
||||||
apt update
|
|
||||||
# install ops tools
|
|
||||||
apt install sudo nmon tmux tcpdump nano iputils-ping net-tools -y
|
|
||||||
|
|
||||||
# install Docker + docker-compose
|
update_system() {
|
||||||
apt install ca-certificates curl gnupg lsb-release -y
|
echo "Updating system and installing mandatory tools"
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
apt-get update
|
||||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
apt-get install sudo nmon tmux tcpdump nano iputils-ping net-tools -y
|
||||||
apt update
|
}
|
||||||
apt install docker-ce docker-ce-cli containerd.io -y
|
|
||||||
systemctl start docker
|
|
||||||
#curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
||||||
#chmod +x /usr/local/bin/docker-compose
|
|
||||||
|
|
||||||
# set TF users
|
install_docker() {
|
||||||
wget https://docs.grid.tf/threefold_public/public/raw/branch/master/add-tf-users.sh
|
echo "Installing Docker"
|
||||||
sh add-tf-users.sh
|
apt-get install ca-certificates curl gnupg lsb-release -y
|
||||||
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
apt-get update
|
||||||
|
apt-get install docker-ce docker-ce-cli containerd.io -y
|
||||||
|
systemctl start docker
|
||||||
|
echo "Docker installation completed"
|
||||||
|
}
|
||||||
|
|
||||||
# install Caddy
|
install_caddy() {
|
||||||
#apt install -y debian-keyring debian-archive-keyring apt-transport-https
|
echo "Installing Caddy"
|
||||||
#curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | tee /etc/apt/trusted.gpg.d/caddy-stable.asc
|
apt-get install -y debian-keyring debian-archive-keyring apt-transport-https
|
||||||
#curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | tee /etc/apt/trusted.gpg.d/caddy-stable.asc
|
||||||
#curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
||||||
#apt update
|
apt-get update
|
||||||
#apt install caddy -y
|
apt-get install caddy -y
|
||||||
|
echo "Caddy installation completed."
|
||||||
|
}
|
||||||
|
|
||||||
# set propper sshd config
|
setup_tf_users() {
|
||||||
wget https://docs.grid.tf/threefold_public/public/raw/branch/master/sshd_config
|
echo "Setting up TFUsers"
|
||||||
cp sshd_config /etc/ssh/
|
wget https://docs.grid.tf/threefold_public/public/raw/branch/master/add-tf-users.sh
|
||||||
systemctl restart ssh
|
sh add-tf-users.sh
|
||||||
|
rm add-tf-users.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_ssh() {
|
||||||
|
echo "Configuring SSH"
|
||||||
|
wget https://docs.grid.tf/threefold_public/public/raw/branch/master/sshd_config
|
||||||
|
mv sshd_config /etc/ssh/
|
||||||
|
systemctl restart ssh
|
||||||
|
}
|
||||||
|
|
||||||
|
update_system
|
||||||
|
setup_tf_users
|
||||||
|
configure_ssh
|
||||||
|
|
||||||
|
while getopts ":dc" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
d )
|
||||||
|
install_docker
|
||||||
|
;;
|
||||||
|
c )
|
||||||
|
install_caddy
|
||||||
|
;;
|
||||||
|
\? )
|
||||||
|
echo "Invalid option: $OPTARG" 1>&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND -1))
|
||||||
|
|
||||||
|
echo "Preping VM Completed."
|
||||||
Reference in new issue
Block a user