First, just start by getting a root shell so we can drop the sudo command from everything (e.g. type sudo bash). This isn’t best practice, but just make sure you exit out of it when you are done :).
Centos 7.x Complete Installation Steps
Note that this installs wget, OpenJDK Java 1.8, Jenkins, enables Jenkins to be on with system start, and then it installs docker, and finally, it adds the Jenkins user to the docker user group so that it can run commands from it effectively (using elevated privileges). Lastly, it restarts Jenkins so that the user has the new docker group permissions in the running process.
yum update -y
yum install wget -y
yum install java-1.8.0-openjdk-devel -y
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
rpm –import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins -y
service jenkins start
chkconfig jenkins on
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl start docker
usermod -a -G docker jenkins
service jenkins restart
Validation
Assuming this all worked, you should see Jenkins running on your localhost:8080 port for that server, and you can follow its on-screen instructions.
For docker, you can run the hello world container to see if it is properly set up (docker run hello-world).
Resources
I got this information from the Jenkins wiki, the docker site itself, and one stack overflow entry as shown below: