0% found this document useful (0 votes)
2 views

5- How to Install and Configure Jenkins on MacOS and Uninstall (Online Course)

The document provides instructions for installing and starting Jenkins LTS on macOS using Homebrew, including commands for starting the service and accessing the Jenkins interface. It also details how to uninstall Jenkins completely and how to configure Jenkins to communicate with a Minikube Kubernetes cluster and Colima Docker platform. Additionally, it includes a sample Jenkins pipeline script that retrieves the status of pods from Minikube and Docker.

Uploaded by

Kashif Kamal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

5- How to Install and Configure Jenkins on MacOS and Uninstall (Online Course)

The document provides instructions for installing and starting Jenkins LTS on macOS using Homebrew, including commands for starting the service and accessing the Jenkins interface. It also details how to uninstall Jenkins completely and how to configure Jenkins to communicate with a Minikube Kubernetes cluster and Colima Docker platform. Additionally, it includes a sample Jenkins pipeline script that retrieves the status of pods from Minikube and Docker.

Uploaded by

Kashif Kamal
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

kkamal@NIS-PK356 ~ % brew install jenkins-lts

Removing: /Users/kkamal/Library/Logs/Homebrew/[email protected]... (3 files, 185.8KB)


Removing: /Users/kkamal/Library/Logs/Homebrew/vault... (115B)
==> Caveats
==> jenkins-lts
Note: When using launchctl the port will be 8080.

To start jenkins-lts:
brew services start jenkins-lts
Or, if you don't want/need a background service you can just run:
/usr/local/opt/openjdk@11/bin/java -Dmail.smtp.starttls.enable=true -jar
/usr/local/opt/jenkins-lts/libexec/jenkins.war --httpListenAddress=127.0.0.1 --httpPort=8080
kkamal@NIS-PK356 ~ % brew services start jenkins-lts
brew services start jenkins-lts
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 1422, done.
remote: Counting objects: 100% (301/301), done.
remote: Compressing objects: 100% (218/218), done.
remote: Total 1422 (delta 117), reused 231 (delta 77), pack-reused 1121
Receiving objects: 100% (1422/1422), 420.06 KiB | 1.43 MiB/s, done.
Resolving deltas: 100% (593/593), done.
Tapped 1 command (35 files, 519.4KB).
==> Successfully started `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
Verification
kkamal@NIS-PK356 ~ % ps aux | grep -i jenkins-lts
jenkins-lts
kkamal 60106 0.0 14.3 11378392 2405664 ?? S 1:09PM 2:25.75
/usr/local/opt/openjdk@11/bin/java -Dmail.smtp.starttls.enable=true -jar
/usr/local/opt/jenkins-lts/libexec/jenkins.war --httpListenAddress=127.0.0.1 --httpPort=8080
kkamal 64564 0.0 0.0 4259008 324 s001 R+ 1:24PM 0:00.00 grep -i
jenkins-lts

kkamal@NIS-PK356 ~ % cat /Users/kkamal/.jenkins/secrets/initialAdminPassword

0310cef8b9284ab48c2e23f0a1bd6523
Put on above screenshot
Url: http://localhost:8080/

Username: admin
Password: temp123
How to remove Jenkins from macOS completely
brew services stop jenkins-lts

If you have installed Jenkins using homebrew and if you want to uninstall it completely, this
is how you do it:

brew uninstall jenkins --force

Remove the hidden .jenkins directory in your home directory that contains the
configuration.

% rm -rf ~/.jenkins

Verification
kkamal@NIS-PK356 /Applications % ps aux | grep jenkins-lts
kkamal 31437 0.0 0.0 34131004 812 s007 R+ 3:46AM 0:00.01 grep jenkins-
lts

How to locally installed jenkins (Installed on MAC) can communicate with


minikube k8s cluster and also with Colima docker platform

First you need to copy echo $PATH result from your MAC terminal and then paste into

Go to Manage Jenkins >> Configure jenkins >> Environment variable

Verification

Create a jenkins job >>


pipeline {
agent any

stages {
stage('Hello') {
steps {
sh 'minikube kubectl -- get pods'
sh 'kubectl get pods'
sh 'docker ps -a'
}
}
}
}

Console Output
Started by user kashif kamal
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /Users/kkamal/.jenkins/workspace/test-cd
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Hello)
[Pipeline] sh
+ minikube kubectl -- get pods
NAME READY STATUS RESTARTS AGE
api-deploy-6fb454f76b-v95hp 1/1 Running 0 43h
db-deploy-5dbc8d7c7d-c9jt8 1/1 Running 0 44h
sql 1/1 Running 1 (43h ago) 44h
webapp-deploy-589c989bf6-tknds 1/1 Running 0 43h
[Pipeline] sh
+ kubectl get pods
NAME READY STATUS RESTARTS AGE
api-deploy-6fb454f76b-v95hp 1/1 Running 0 43h
db-deploy-5dbc8d7c7d-c9jt8 1/1 Running 0 44h
sql 1/1 Running 1 (43h ago) 44h
webapp-deploy-589c989bf6-tknds 1/1 Running 0 43h
[Pipeline] sh
+ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS
NAMES
38b0b2572a75 kicbase/stable:v0.0.30 "/usr/local/bin/entr…" 4 days ago
Up 4 days 127.0.0.1:49162->22/tcp, 127.0.0.1:49161->2376/tcp,
127.0.0.1:49160->5000/tcp, 127.0.0.1:49159->8443/tcp, 127.0.0.1:49158-
>32443/tcp minikube
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

You might also like