Advertisement
cardel

script

Aug 9th, 2024 (edited)
624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 5.55 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. my $usuario = 'univalle';
  7.  
  8. # Función para ejecutar comandos del sistema
  9. sub run_command {
  10.     my ($cmd) = @_;
  11.     print "Ejecutando: $cmd\n";
  12.     system($cmd);
  13. }
  14.  
  15. # Actualizar e instalar paquetes
  16. run_command('apt update && apt upgrade');
  17. run_command('apt install net-tools wget gpg git openssh-server curl -y');
  18. run_command('apt install -y software-properties-common apt-transport-https ca-certificates curl gnupg lsb-release');
  19. run_command('apt install -y build-essential libncursesw5-dev libreadline-dev libssl-dev libsqlite3-dev tk-dev libc6-dev libbz2-dev libffi-dev');
  20. run_command('apt install -y python3 python3-pip python3-virtualenv');
  21. run_command('apt install -y libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6');
  22.  
  23. # Instalar Docker
  24. run_command('apt update');
  25. run_command('apt install -y ca-certificates curl');
  26. run_command('curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker.gpg');
  27. run_command('echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null');
  28. run_command('apt update');
  29. run_command('apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose');
  30.  
  31. # Instalar Kubernetes (kubectl y Minikube)
  32. run_command('curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key |  gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg');
  33. run_command('echo \'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /\' |  tee /etc/apt/sources.list.d/kubernetes.list');
  34. run_command(' apt-get update');
  35. run_command(' apt-get install -y kubectl');
  36.  
  37. run_command('curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb');
  38. run_command('dpkg -i minikube_latest_amd64.deb');
  39.  
  40. run_command("usermod -aG docker $usuario");
  41.  
  42. # Instalar Visual Studio Code
  43. run_command('wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg');
  44. run_command('sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg');
  45. run_command('echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null');
  46. run_command('rm -f packages.microsoft.gpg');
  47. run_command('sudo apt install apt-transport-https');
  48. run_command('apt update');
  49. run_command('apt install -y code');
  50.  
  51.  
  52. # Instalar Azure CLI
  53. run_command('curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/keyrings/microsoft.gpg > /dev/null');
  54. run_command('chmod go+r /etc/apt/keyrings/microsoft.gpg');
  55. my $az_dist = `lsb_release -cs`;
  56. chomp($az_dist);
  57. run_command("echo \"Types: deb\nURIs: https://packages.microsoft.com/repos/azure-cli/\nSuites: ${az_dist}\nComponents: main\nArchitectures: $(dpkg --print-architecture)\nSigned-by: /etc/apt/keyrings/microsoft.gpg\" | tee /etc/apt/sources.list.d/azure-cli.sources");
  58. run_command('apt update && apt install -y azure-cli');
  59.  
  60. # Instalar AWS CLI
  61. run_command('apt install awscli -y');
  62.  
  63. # Instalar Google Cloud CLI
  64. run_command('curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg');
  65. run_command('echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list');
  66. run_command('apt update');
  67. run_command('apt-get install google-cloud-cli');
  68.  
  69. # Instalar Terraform
  70. run_command('wget -O- https://apt.releases.hashicorp.com/gpg |  gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg');
  71. run_command("echo \"deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com \$(lsb_release -cs) main\" |  tee /etc/apt/sources.list.d/hashicorp.list");
  72. run_command('apt update');
  73. run_command('apt install -y terraform');
  74.  
  75. # Instalar navegadores y utilidades
  76. run_command('wget -qO- https://deb.opera.com/archive.key | apt-key add -');
  77. run_command('add-apt-repository -y "deb [arch=i386,amd64] https://deb.opera.com/opera-stable/ stable non-free"');
  78. run_command('apt update');
  79. run_command('apt install -y opera-stable chromium chromium-l10n');
  80.  
  81. run_command('echo "export PATH=\$PATH:/usr/sbin" >> /etc/profile');
  82. run_command('systemctl enable docker --now');
  83. #Aceptar conexiones
  84. run_command('iptables -I INPUT -j ACCEPT');
  85.  
  86. # Añadir backports a las sources.list
  87. run_command('echo "deb http://deb.debian.org/debian $(lsb_release -cs)-backports main contrib" | tee /etc/apt/sources.list.d/backports.list');
  88.  
  89. # Instalar la clave del archivo fasttrack
  90. run_command('apt install fasttrack-archive-keyring');
  91.  
  92. # Añadir fasttrack a las sources.list
  93. run_command('echo "deb http://fasttrack.debian.net/debian-fasttrack/ $(lsb_release -cs)-fasttrack main contrib" | tee /etc/apt/sources.list.d/fasttrack.list');
  94. run_command('echo "deb http://fasttrack.debian.net/debian-fasttrack/ $(lsb_release -cs)-backports-staging main contrib" | tee -a /etc/apt/sources.list.d/fasttrack.list');
  95.  
  96. # Actualizar los repositorios
  97. run_command('apt update');
  98. run_command('apt install -y virtualbox virtualbox-ext-pack');
  99.  
  100.  
  101. # Instalar virtualbox-guest-x11
  102. run_command('apt install -y virtualbox-guest-x11');
  103.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement