what we need for start:
• Free Tier AWS account.
• GitHub account (for source code and documentation).
• MobaXterm – enhanced terminal for windows with X11 Server tabbed SSH clients, network tool and much more.
• Git – local version control system.
Setup Jenkins Server
1. Setup a Linux EC2 instance
2. Install Java
3. Install Jenkins
4. Start Jenkins
5. Access Web UI on port 8080
Setup a Linux EC2 instance
connect to instance
next step:
Official website: – https://pkg.jenkins.io/redhat-stable/
1 2 |
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 |
Installation of Java
1 2 3 4 |
yum install epel-release //fails sudo amazon-linux-extras install epel sudo amazon-linux-extras install java-openjdk11 yum install jenkins |
check instalation – java — version
edit inbound rule access web ui on port 8080
start jenkins :
Jenkins Start
service jenkins status
service Jenkins start
in browser – set vm ip and port 8080
set the key in jenkins
- As prompted, enter the password found in /var/lib/jenkins/secrets/initialAdminPassword.
- Use the following command to display this password:
[ec2-user ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- Use the following command to display this password:
install Jenkins in web
admin amd password and finish
Run First Jenkins Job:
connecting Jenkins to git rep ( GitHub) check if the plugin ware installed auto before you start
if you getting this error you need to install on the Jenkins server – git and than try again
#create py script :
#create Jenkins file
#Create Docker File
#on the EC2 instance create a new directory and clone the repo from git in the directory
#install on the ec2 docker
systemctl start docker
#and run the docker file
#run the docker container and see the result
docker run –name python-devOps 643dc76bc947
Great, it is work!
But we have a typo so we can just do a full CI CD process to see that we fix it 🙂
now let’s build the pipeline
#first, we will go to the ec2 instance and set this command
sudo usermod -aG docker jenkins & sudo systemctl restart jenkins
and we need to install 2 plugins :
1.CloudBees Docker Build and Publish
2.ssh-agent
- Points to take into consideration:
- Storage – set new rep from the network for Jenkins for all data will be able to update and backup the instance (ec2) or the docker
- Security –
- git – set repo as private and use ssh key/ cert
- create FW rule out\in access from ip \ port \ protocol
- Maintainability –
Great article!