1 min read

Git, Jenkins, Docker Tutorial

how to install Git, Jenkins and Docker in Redhat 8


Git Setup

you have to download git software below and Install it
Windows

Install Git in Windows

MacOS

Install Git in MacOS

Redhat 8

1yum install git -y

If not Working

1wget https://github.com/git/git/archive/v2.10.1.tar.gz -O git.tar.gz
2tar -zxf git.tar.gz
3cd git-2.10.1/
4make configure
5./configure --prefix=/usr/local
6make install

Jenkins Setup in RedHat 8

Note : only Works in Redhat

Download repo file and Import to /etc/yum.repos.d

1sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
2sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

Install jenkins

1yum install jenkins -y

Install openjdk by jenkins

1yum install java-11-openjdk -y

Docker Setup in Redhat 8

Step by Step

Go to yum.repos.d

1cd /etc/yum.repos.d

make new file 'dokcer.repo'

1vim docker.repo

or

1gedit docker.repo

type it in docker.repo

1[docker]
2baseurl = https://download.docker.com/linux/centos/7/x86_64/stable/
3gpgcheck=0

install docker

1yum install docker-ce -y --nobest

Get Start Together Git, Docker, and Jenkins!!

Create New Github Account

Git Account Sign up

Create New repository in github

Create repository

password

Step 1 : Type Name repository.

Step 2 : Create repository

button

Step 3 : Go To Command/Terminal/ Git Bash

Step 4 : Go to login in Command First Below

1$ git config --global user.name "myname"
2$ git config --global user.email myemail@example.com

Note : It will ask you password itself!!! for security reasons!

Step 5 : Create folder , Create new Html File , Add remote from Github Repository

1$ # create folder
2$ mkdir jenkins_web_jenkins
3
4$ # change dir
5$ cd jenkins_web_jenkins
6
7$ # make new html file, write and save it
8$ notepad index.html
9
10$ # Create git project
11$ git init
12
13$ # add all files in staging area
14$ git add .
15
16$ # commit messages
17$ git commit . -m 'first commit'
18
19$ # add remote where to push to github url
20$ git remote add origin https://github.com/amantiwari1/jenkins_web_server..git
21
22$ # upload all files to github website using name which add earlier url
23$ git push -u origin master

Switch to Jenkins !!

start service in rhel 8

1$ systemctl start jenkins

find ip address using command

1$ ifconfig

it is my ip is 192.168.42.164

go to jenkins website

http://192.168.42.164:8080

Note: Port iis 8080 otherwise Not working!!

it will ask you password

1$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
2435jwhwj4h5jhw3j5hesh45jhw34ehre

password

go to Manage Jenkins > Manage Users > setting logo > password

change password

go to DeshBoard

go to Manage Jenkins > Manage Plugins > Available

search 'github'

tap tick it

tap 'Download now and install after restart'

go to DeshBoard

tap Create New jobs

type 'web1'

tap Freestyle project and ok

newitems

go to Source Code Management and tick git

copy and paste from github url : https://github.com/amantiwari1/jenkins_web_server..git

gitjob

go to build and add execute shell

buildshell

type 'sudo cp -vrf * /web'

save it


Switch to Docker !!!

Disable Linux Security

1$ setenforce 0

Docker start in service

1$ systemctl start docker

docker download new image 'httpd' for web server

1$ docker pull httpd

launch httpd with port !!

1$ cd web1
2$ docker run -dit --name web1 -p 8081:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd

go to http://192.168.42.164:8081

check if it is working!!


Switch to Jenkins!!

go to http://192.168.42.164:8080

go to web1 in job

build now if you changed in some file

Related Posts

1 min read

Git, Jenkins, Docker Tutorial

1 min read

How to Setup Multi-Nodes in k8s using Virtual Box in Redhat 8 or Centos

4 min read

Globally Style the Gatsby Default Starter with styled-components v5


All Rights Reserved © 2021