Home > All Posts > devops > 2021 January, 09 >
1 min read
1yum install git -y
If not Working
1wget https://github.com/git/git/archive/v2.10.1.tar.gz -O git.tar.gz2tar -zxf git.tar.gz3cd git-2.10.1/4make configure5./configure --prefix=/usr/local6make install
1sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo2sudo 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
Go to yum.repos.d
1cd /etc/yum.repos.d
make new file 'dokcer.repo'
1vim docker.repo
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
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!
1$ # create folder2$ mkdir jenkins_web_jenkins34$ # change dir5$ cd jenkins_web_jenkins67$ # make new html file, write and save it8$ notepad index.html910$ # Create git project11$ git init1213$ # add all files in staging area14$ git add .1516$ # commit messages17$ git commit . -m 'first commit'1819$ # add remote where to push to github url20$ git remote add origin https://github.com/amantiwari1/jenkins_web_server..git2122$ # upload all files to github website using name which add earlier url23$ git push -u origin master
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
Note: Port iis 8080 otherwise Not working!!
it will ask you password
1$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword2435jwhwj4h5jhw3j5hesh45jhw34ehre
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
go to Source Code Management and tick git
copy and paste from github url : https://github.com/amantiwari1/jenkins_web_server..git
go to build and add execute shell
type 'sudo cp -vrf * /web'
save it
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 web12$ 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!!
go to http://192.168.42.164:8080
go to web1 in job
build now if you changed in some file
Related Posts