New jenkins.sh
This commit is contained in:
32
jenkins.sh
32
jenkins.sh
@@ -2,20 +2,27 @@
|
|||||||
set -eux
|
set -eux
|
||||||
apt update
|
apt update
|
||||||
apt upgrade -y
|
apt upgrade -y
|
||||||
apt install default-jdk -y
|
|
||||||
mkdir -p /usr/share/keyrings
|
sudo apt update
|
||||||
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
|
sudo apt install fontconfig openjdk-21-jre -y
|
||||||
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
|
java -version
|
||||||
https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
|
|
||||||
apt update
|
# 1. Instalar Java (Jenkins requiere Java para funcionar)
|
||||||
apt install jenkins -y
|
sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc \
|
||||||
|
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc]" \
|
||||||
|
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
|
||||||
|
/etc/apt/sources.list.d/jenkins.list > /dev/null
|
||||||
|
sudo apt update -y
|
||||||
|
sudo apt install jenkins -y
|
||||||
|
|
||||||
systemctl status jenkins --no-pager -l
|
systemctl status jenkins --no-pager -l
|
||||||
sudo systemctl enable --now jenkins
|
sudo systemctl enable --now jenkins
|
||||||
|
|
||||||
# 3. Instalar Git
|
# 2. Instalar Git
|
||||||
sudo apt-get install -y git
|
sudo apt-get install -y git
|
||||||
|
|
||||||
# 4. Instalar Terraform
|
# 3. Instalar Terraform
|
||||||
sudo apt-get install -y gnupg software-properties-common
|
sudo apt-get install -y gnupg software-properties-common
|
||||||
wget -O- https://apt.releases.hashicorp.com/gpg | \
|
wget -O- https://apt.releases.hashicorp.com/gpg | \
|
||||||
gpg --dearmor | \
|
gpg --dearmor | \
|
||||||
@@ -26,15 +33,16 @@ sudo tee /etc/apt/sources.list.d/hashicorp.list
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y terraform
|
sudo apt-get install -y terraform
|
||||||
|
|
||||||
# 5. Instalar Ansible
|
# 4. Instalar Ansible
|
||||||
sudo add-apt-repository --yes --update ppa:ansible/ansible
|
sudo add-apt-repository --yes --update ppa:ansible/ansible
|
||||||
sudo apt-get install -y ansible
|
sudo apt-get install -y ansible
|
||||||
|
|
||||||
# Iniciar Jenkins
|
# 5. Iniciar Jenkins
|
||||||
sudo systemctl enable jenkins
|
sudo systemctl enable jenkins
|
||||||
sudo systemctl start jenkins
|
sudo systemctl start jenkins
|
||||||
|
|
||||||
|
# 6. Verificar que Jenkins esté corriendo
|
||||||
echo "¡Instalación completa! Jenkins está corriendo en el puerto 8080."
|
echo "¡Instalación completa! Jenkins está corriendo en el puerto 8080."
|
||||||
# Imprimir la contraseña inicial para facilitar el primer login
|
# 7. Imprimir la contraseña inicial para facilitar el primer login
|
||||||
echo "La contraseña inicial de Admin es:"
|
echo "La contraseña inicial de Admin es:"
|
||||||
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
|
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
|
||||||
Reference in New Issue
Block a user