Building an Amazon Linux 2 Server Part 3 (Jenkins Installation)
Let's install NginX, Tomcat, Jenkins on Amazon Linux 2 server
In this part, we will install Jenkins.
Execute the following command to use the repo.
$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
$ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Amazon Linux 2 OS does not support the daemonize module by default.
Install daemonize.
# sudo vi /etc/yum.repos.d/epelfordaemonize.repo
Add the following to the epelfordaemonize.repo file.
[daemonize]
baseurl=https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/
gpgcheck=no
enabled=yes
Install the epel-release module.
$ sudo yum install -y epel-release # repository that provides 'daemonize'
Check the java-11-openjdk-devel installation.
If it is already installed, you do not need to install java-11-openjdk-devel.
$ rpm -qa java*jdk-devel
java-1.8.0-openjdk-devel-1.8.0.312.b07-1.amzn2.0.2.x86_64
If installation is required, install java-11-openjdk-devel.
$ sudo yum install java-11-openjdk-devel
Install jenkins.
$ sudo yum install jenkins
Installed:
jenkins.noarch 0:2.319.1-1.1
Change the port by editing the jenkins file.
Make a copy and change the port in the jenkins file.
$ sudo cp /etc/sysconfig/jenkins /etc/sysconfig/jenkins-20121222
Change the jenkins port to 9090 port.
$ sudo vi /etc/sysconfig/jenkins
JENKINS_PORT="9090"
Start jenkins.
$ sudo /etc/init.d/jenkins start
Starting jenkins (via systemctl): [ OK ]
$ sudo service jenkins start
Starting jenkins (via systemctl): [ OK ]
Configure jenkins to run when the server is restarted.
$ sudo chkconfig jenkins on
Check the initial password.
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
a80a7bc8706c428588b3b64fbd6b224c
Enter the https://ip:9090 address using the initial password and log in.
After logging in, select the Install suggested plugins for jenkins menu to install the required Plug In, and change the password in the Manage Jenkins menu of the Dashboard.
After installing Nginx, Tomcat, and Jenkins, the remaining storage space is 5.4 gigabytes.
When I created an EC2 instance with 8GB of EBS storage, the storage space was 6.4 gigabytes, and about 1GB was used for Nginx, Tomcat, and Jenkins installations.
$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 474M 0 474M 0% /dev
tmpfs 483M 0 483M 0% /dev/shm
tmpfs 483M 420K 483M 1% /run
tmpfs 483M 0 483M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 2.7G 5.4G 33% /
tmpfs 97M 0 97M 0% /run/user/1000