Installing Docker and Jenkins

Installing Docker and Jenkins

A package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system

Installing Docker on Ubuntu

Setting up the repository

Update the apt package index and install packages to allow apt to use a repository over HTTPS:

sudo apt-get update

sudo apt-get install \

ca-certificates \

curl \

gnupg \

lsb-release

Add Docker’s official GPG key:

sudo mkdir -p /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Use the following command to set up the repository:

echo \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \

$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Installing Docker Engine

Update the apt package index:

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

sudo docker run hello-world

Installing Docker on CentOS

Setting up the repository

sudo yum install -y yum-utils

sudo yum-config-manager \

--add-repo \

https://download.docker.com/linux/centos/docker-ce.repo

Installing Docker Engine

sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

sudo systemctl start docker

sudo docker run hello-world

Installing Jenkins on Ubuntu

Add the repository key to your system:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key |sudo gpg --dearmor -o /usr/share/keyrings/jenkins.gpg

Next, let’s append the Debian package repository address to the server’s sources.list:

sudo sh -c 'echo deb [signed-by=/usr/share/keyrings/jenkins.gpg] http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

After both commands have been entered, run apt update so that apt will use the new repository.

sudo apt update

sudo apt install Jenkins

sudo systemctl start jenkins.service

Adjusting the Firewall

sudo ufw allow 8080

sudo ufw allow OpenSSH

sudo ufw enable

sudo ufw status

Installing Jenkins on CentOS

Installation

sudo yum install java-1.8.0-openjdk-devel

curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo

sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

sudo yum install Jenkins

sudo systemctl start Jenkins

Adjusting the Firewall

sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp

sudo firewall-cmd –reload

Note : To set up your installation, visit Jenkins on its default port, 8080, using your server domain name or IP address: http://your_server_ip_or_domain:8080