Install Jenkins in Ubuntu
add the repository key to the system.
$wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
append the Debian package repository address to the server's sources.list:
$echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
When both of these are in place, we'll run update so that apt-get will use the new repository:
$sudo apt-get update
Finally, we'll install Jenkins and its dependencies, including Java:
sudo apt-get install jenkins
Starting Jenkins
$sudo systemctl start jenkins
use its status command to verify that it started successfully:
sachin@sachin-E470:~$ sudo systemctl status jenkins
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated; vendor preset: enabled)
Active: active (exited) since Sat 2017-12-30 00:13:42 IST; 2min 31s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/jenkins.service
Dec 30 00:13:41 sachin-E470 systemd[1]: Starting LSB: Start Jenkins at boot time...
Dec 30 00:13:41 sachin-E470 jenkins[27728]: * Starting Jenkins Automation Server jenkins
Dec 30 00:13:41 sachin-E470 su[27746]: Successful su for jenkins by root
Dec 30 00:13:41 sachin-E470 su[27746]: + ??? root:jenkins
Dec 30 00:13:41 sachin-E470 su[27746]: pam_unix(su:session): session opened for user jenkins by (uid=0)
Dec 30 00:13:42 sachin-E470 jenkins[27728]: ...done.
Dec 30 00:13:42 sachin-E470 systemd[1]: Started LSB: Start Jenkins at boot time.
Now that Jenkins is running, we'll adjust our firewall rules so that we can reach Jenkins from a web browser to complete the initial set up.
Opening the Firewall
By default, Jenkins runs on port 8080, so we'll open that port using ufw:
$sudo ufw allow 8080
We can see the new rules by checking UFW's status.
$sudo ufw status
Note: If the firewall is inactive, the following commands will make sure that OpenSSH is allowed and then enable it.
$sudo ufw allow OpenSSH
$sudo ufw enable
Setting up Jenkins
add http://<ip_address_or_domain_name>:8080 in the browser.
Unlock Jenkins" screen, which displays the location of the initial password
sachin@sachin-E470:~$ sudo tail -f /var/lib/jenkins/secrets/initialAdminPassword
You will get password like 5989a6235bcc4548a0d156fdf050c0bd
Copy this password and enter in above input text box.
Click on Install suggested plugins.
When the installation is complete, we'll be prompted to set up the first administrative user. It's possible to skip this step and continue as admin using the initial password we used above, but we'll take a moment to create the user.
Once the first admin user is in place, you should see a "Jenkins is ready!" confirmation screen.
Click "Start using Jenkins" to visit the main Jenkins dashboard:
Jenkins has been successfully installed.
No comments:
Post a Comment