Install and Configure Jenkins on GCE
Apr 21, 2022
Installation:
- Spin up a VM with CentOS
sudo yum install wget -y
This is needed as wget is not installed on centos base imagesudo yum install git -y
This will be needed to integrate Jenkins with GitHub- Follow the steps below to install Jenkins.
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
sudo yum install java-11-openjdk -y
sudo yum install jenkins -y
sudo systemctl daemon-reload
Configuration:
- Configure Jenkins (Log in using Admin password, Create users, etc.)
ssh-keygen -t rsa
#Create credentials to connect to GitHub. Note the private and public key folder locations. You will need those.- Create Jenkins “SSH Username and SSH key” Credentials using the private key.
- Add ‘Deploy Key’ to your GitHub repo using the public key.
ssh -T git@github.com
# Test the connection- Create a quick test pipeline to test.