-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins-server-user-script.sh
54 lines (37 loc) · 1.35 KB
/
jenkins-server-user-script.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
sudo su
# Update packages
sudo yum update -y
# Install git
sudo yum install git -y
# Install wget
sudo yum install -y wget unzip
# Add Jenkins repository
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
# Import key file
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
# Upgrade packages
sudo yum upgrade -y
# Install Java
sudo amazon-linux-extras install java-openjdk11 -y
# Install Teraform
sudo wget https://releases.hashicorp.com/terraform/1.0.8/terraform_1.0.8_linux_amd64.zip
sudo unzip terraform_1.0.8_linux_amd64.zip -d /usr/local/bin/
sudo rm terraform_1.0.8_linux_amd64.zip
sudo echo "export PATH=$PATH:/usr/local/bin" >> ~/.bashrc
# Install Jenkins
sudo yum install jenkins -y
# Enable Jenkins service to start at boot
sudo systemctl enable jenkins
# Start Jenkins as a service
sudo systemctl start jenkins
# remove ask for password
echo 'jenkins ALL=(ALL) NOPASSWD:ALL' | sudo tee -a /etc/sudoers
# Check the status of the Jenkins service
sudo systemctl status jenkins
# change hostname
sudo hostnamectl set-hostname My-Jenkins-Server
# install kubectl
sudo curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.23.6/bin/linux/amd64/kubectl
sudo chmod +x ./kubectl
sudo mkdir -p $HOME/bin && sudo cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin