Public repo to distribute scripts and config's
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 

63 lignes
1.9 KiB

  1. #!/bin/bash
  2. update_system() {
  3. echo "Updating system and installing mandatory tools"
  4. apt-get update
  5. apt-get install sudo nmon tmux tcpdump nano iputils-ping net-tools -y
  6. }
  7. install_docker() {
  8. echo "Installing Docker"
  9. apt-get install ca-certificates curl gnupg lsb-release -y
  10. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  11. 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
  12. apt-get update
  13. apt-get install docker-ce docker-ce-cli containerd.io -y
  14. systemctl start docker
  15. echo "Docker installation completed"
  16. }
  17. install_caddy() {
  18. echo "Installing Caddy"
  19. apt-get install -y debian-keyring debian-archive-keyring apt-transport-https
  20. curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | tee /etc/apt/trusted.gpg.d/caddy-stable.asc
  21. curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
  22. apt-get update
  23. apt-get install caddy -y
  24. echo "Caddy installation completed."
  25. }
  26. setup_tf_users() {
  27. echo "Setting up TFUsers"
  28. wget https://docs.grid.tf/threefold_public/public/raw/branch/master/add-tf-users.sh
  29. sh add-tf-users.sh
  30. rm add-tf-users.sh
  31. }
  32. configure_ssh() {
  33. echo "Configuring SSH"
  34. wget https://docs.grid.tf/threefold_public/public/raw/branch/master/sshd_config
  35. mv sshd_config /etc/ssh/
  36. systemctl restart ssh
  37. }
  38. update_system
  39. setup_tf_users
  40. configure_ssh
  41. while getopts ":dc" opt; do
  42. case ${opt} in
  43. d )
  44. install_docker
  45. ;;
  46. c )
  47. install_caddy
  48. ;;
  49. \? )
  50. echo "Invalid option: $OPTARG" 1>&2
  51. ;;
  52. esac
  53. done
  54. shift $((OPTIND -1))
  55. echo "Preping VM Completed."