-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-jenkins.sh
58 lines (44 loc) · 1.53 KB
/
install-jenkins.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
54
55
56
57
58
#!/bin/bash
#
# Get INSTALL AND CONFIGURE Jenkins on REDHAT 7
#
# Based on a bash script by Saddam ZEMMALI - 10/11/2017
#
# Author = Saddam ZEMMALI - 10/11/2017
# cat /etc/resolv.conf
# Generated by NetworkManager
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf
echo "Install last EPEL Repo"
yum -y localinstall https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y update
yum clean expire-cache
# How to install Jenkins on RedHat 7
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
echo "Install JAVA"
sudo yum install java-1.8.0-openjdk.x86_64
java -version
echo $JAVA_HOME
echo $JRE_HOME
cp /etc/profile /etc/profile_backup
ll /usr/lib/jvm/jre-1.8.0-openjdk
echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' | sudo tee -a /etc/profile
ll /usr/lib/jvm/jre
echo 'export JRE_HOME=/usr/lib/jvm/jre' | sudo tee -a /etc/profile
source /etc/profile
echo $JAVA_HOME
echo $JRE_HOME
echo "Start Jenkins Service Using Systemd"
sudo systemctl start jenkins.service
echo "Enable Jenkins Service Using Systemd"
sudo systemctl enable jenkins.service
netstat -ntlp | grep 8080
echo "Add New Rule to Firewalld"
sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
firewall-cmd --list-all
systemctl stop firewalld.service
systemctl disable firewalld.service
cat /var/lib/jenkins/secrets/initialAdminPassword