Prerequisites:
- Provision machine of your choice:
- locally
- Virtual Machine
- In cloud (e.g. EC2 instance in AWS with public IP address and 8080 port open)
wget
tool installed on CentOS machine:sudo yum install -y wget
Installation:
- Install required Java JDK 8 library:
sudo yum install -y java-1.8.0-openjdk-devel
- Create and write a Jenkins repo on the machine:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
- Import the Jenkins key for the repo:
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
- Install Jenkins:
sudo yum install -y jenkins
- Enable autostartup of Jenkins:
sudo systemctl enable jenkins
- Start Jenkins:
sudo systemctl start jenkins
Configuration:
- By default you can access Jenkins server on port 8080 of the public IP address of your machine or on
localhost
if installed locally.http://[server_ip_address]:8080
- To unlock Jenkins you need to copy the initial Admin password in the given path on the server:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- After unlocking Jenkins you have two options of installing plugins. Use suggested plugins or install manually:
- The list of suggested plugins installed on Jenkins by default:
- After installation of plugins is completed you need to create an admin user account:
- After creating admin user you will get an instance URL of Jenkins server:
- Log-in into dashboard and start using Jenkins:
Notes:
We can install new software on Red Hat/CentOS Linux with yum install packagename
command from console. Running this command first checks for existing YUM Repository configuration files in /etc/yum.repos.d/ directory. It reads each YUM Repository configuration file to get the information required to download and install new software, resolves software dependencies and installs the required RPM package files.
YUM Repository configuration files must:
- be located in /etc/yum.repos.d/ directory
- have .repo extension, to be recognized by YUM
If you need to get logs of Jenkins server:
sudo cat /var/log/jenkins/jenkins.log