-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.sh
39 lines (27 loc) · 1021 Bytes
/
docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Add Jenkins repository key
sudo apt-get update && sudo apt-get install -y gnupg2 curl software-properties-common
sudo curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
# Add Jenkins repository
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
# Update package lists
sudo apt-get update
# Install Jenkins and Docker
sudo apt-get install -y jenkins docker.io
# Start Docker service
sudo systemctl start docker
# Enable Docker service to start on boot
sudo systemctl enable docker
# Start Jenkins service
sudo systemctl start jenkins
# Enable Jenkins service to start on boot
sudo systemctl enable jenkins
# Install Git
sudo apt-get install -y git
# Set hostname
sudo hostnamectl set-hostname Master-server
# Install Java (OpenJDK 11)
sudo apt-get install -y openjdk-11-jdk
# Display Jenkins initial admin password
echo "Jenkins initial admin password:"
sudo cat /var/lib/jenkins/secrets/initialAdminPassword