How to Install Jenkins in Linux OS
Here's a simple step-by-step guide to install Jenkins on Linux (I'll explain for Ubuntu/Debian-based systems.
Step 1: Install Java (JDK)
Jenkins needs Java.
- Update system packages:
sudo apt update
- Install OpenJDK (recommended version: 11 or 17):
sudo apt install openjdk-11-jdk -y
- Verify Java installation:
You should see Java 11 (or higher).java -version
Step 2: Add Jenkins Repository
-
Add the GPG key:
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \ /usr/share/keyrings/jenkins-keyring.asc > /dev/null
-
Add the Jenkins repository:
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ https://pkg.jenkins.io/debian binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null
Step 3: Install Jenkins
-
Update packages again:
sudo apt update
-
Install Jenkins:
sudo apt install jenkins -y
Step 4: Start and Enable Jenkins
-
Start Jenkins service:
sudo systemctl start jenkins
-
Enable Jenkins to start on boot:
sudo systemctl enable jenkins
-
Check Jenkins status:
sudo systemctl status jenkins
(It should show active (running).)
Step 5: Adjust Firewall (optional)
If your system uses a firewall (like ufw):
- Allow port 8080:
sudo ufw allow 8080 sudo ufw reload
Step 6: Setup Jenkins via Browser
-
Open Jenkins in browser:
http://your_server_ip_or_hostname:8080
(If you are on local machine, use
http://localhost:8080
.) -
Unlock Jenkins:
- Find the initial admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- Copy that password.
- Paste it into the browser to unlock Jenkins.
- Find the initial admin password:
-
Install Suggested Plugins.
-
Create Admin User.
Step 7: Start Using Jenkins
- After setup, you will reach the Jenkins Dashboard!
- Ready to create jobs, pipelines, and automations.
Comments
Post a Comment