Jenkins installation
Yum install Jenkins
To install Jenkins on CentOS 7, you can follow these steps:
- Update system packages:
sudo yum update
- Install Java Development Kit (JDK). Jenkins requires Java to run. You can choose to install OpenJDK or Oracle JDK. The following is an example command to install OpenJDK:
sudo yum install fontconfig java-11-openjdk
- Import the GPG key for the Jenkins repository:
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key --no-check-certificate
- Install Jenkins:
sudo yum install jenkins
- Start the Jenkins service:
sudo systemctl start jenkins && sudo systemctl daemon-reload
- Configure Jenkins to start automatically at boot:
sudo systemctl enable jenkins
- Open the firewall port to allow access to Jenkins’ web interface:
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
sudo firewall-cmd --reload
http://your_server_ip:8080
You can now access the Jenkins web interface by typing in your web browser and follow the on-screen instructions to complete the Jenkins installation setup.
Please note that installing Jenkins may take some time depending on your internet connection speed and system configuration.
View password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Docker install Jenkins
docker run \
-u root \
--rm \
-d \
-p 8080:8080 \
-p 50000:50000 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
Unable to find image 'jenkinsci/blueocean:latest' locally
latest: Pulling from jenkinsci/blueocean
213ec9aee27d: Pull complete
9fb6b045bfc8: Pull complete
1a7d7223e42d: Pull complete
8f2b061b68da: Pull complete
bba48a821480: Pull complete
0061c72f26bd: Pull complete
f65ed3fbea93: Pull complete
3509f53c6b7b: Pull complete
28ea9c56d127: Pull complete
b3b3ea5ca7f4: Pull complete
e5ecc395b9e7: Pull complete
a4cea1bad4ff: Pull complete
d2d0e6e9298c: Pull complete
f786c314ed83: Pull complete
Digest: sha256:f27933313986f7fb0b5784aa6520ebddc455ce258cbf4d13a3e3cf9d4c94d992
Status: Downloaded newer image for jenkinsci/blueocean:latest
3f48f3cace6f56061dc2ba8d4d49a55e58d6c36a5dd40ac239a7715fa11f8883
Start up and visit ip:8080
View password
[root@test jvm]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3f48f3cace6f jenkinsci/blueocean "/sbin/tini -- /usr/…" 4 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:50000->50000/tcp, :::50000->50000/tcp compassionate_torvalds
23b7595758f6 app:0.0.1 "/bin/sh -c 'java -j…" 3 days ago Up 3 days 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp pedantic_curran
[root@test jvm]# docker exec -it 3f48f3cace6f /bin/bash
bash-5.1# cat /var/jenkins_home/secrets/initialAdminPassword
0e458fdef7d1402186537c3a66428c4a
The account is: admin
Copy the password
Successful installation