{"id":1153,"date":"2021-04-13T06:14:07","date_gmt":"2021-04-13T06:14:07","guid":{"rendered":"https:\/\/codeinsightacademy.com\/blog\/?p=1153"},"modified":"2021-04-13T08:43:47","modified_gmt":"2021-04-13T08:43:47","slug":"install-jenkins-on-ubuntu","status":"publish","type":"post","link":"https:\/\/codeinsightacademy.com\/blog\/devops\/install-jenkins-on-ubuntu\/","title":{"rendered":"Install Jenkins on Ubuntu"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install default-jdk default-jre\njavac\nwget -q -O - https:\/\/pkg.jenkins.io\/debian\/jenkins.io.key | sudo apt-key add -\nsudo sh -c \"echo deb http:\/\/pkg.jenkins.io\/debian-stable binary\/ &gt; \/etc\/apt\/sources.list.d\/jenkins.list\"\nsudo apt update\nsudo apt install jenkins\nsudo service jenkins start\nsudo service jenkins status<\/code><\/pre>\n\n\n\n<p>Open Browser and hit following url<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;localhost:8080\/<\/code><\/pre>\n\n\n\n<p>To view default initial password<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cat \/var\/lib\/jenkins\/secrets\/initialAdminPassword<\/code><\/pre>\n\n\n\n<p>Install recommended Plugins. Make sure Git Plugin is installed<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Username: admin\nPassword: Shift + 5\nFull name: Administrator<\/code><\/pre>\n\n\n\n<p>Jenkins URL: http:\/\/localhost:8080\/<br>Or<br>http:\/\/youripaddress:8080\/<br>Or<br>http:\/\/yourdomain:8080\/<\/p>\n\n\n\n<p>Create New Item (New project for build)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image.png\"><img loading=\"lazy\" width=\"350\" height=\"485\" src=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image.png\" alt=\"\" class=\"wp-image-1161\" srcset=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image.png 350w, https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-216x300.png 216w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-1.png\"><img loading=\"lazy\" width=\"729\" height=\"548\" src=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-1.png\" alt=\"\" class=\"wp-image-1162\" srcset=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-1.png 729w, https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-1-300x226.png 300w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-2.png\"><img loading=\"lazy\" width=\"943\" height=\"575\" src=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-2.png\" alt=\"\" class=\"wp-image-1163\" srcset=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-2.png 943w, https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-2-300x183.png 300w, https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-2-768x468.png 768w\" sizes=\"(max-width: 943px) 100vw, 943px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-3.png\"><img loading=\"lazy\" width=\"923\" height=\"611\" src=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-3.png\" alt=\"\" class=\"wp-image-1164\" srcset=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-3.png 923w, https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-3-300x199.png 300w, https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-3-768x508.png 768w\" sizes=\"(max-width: 923px) 100vw, 923px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-4.png\"><img loading=\"lazy\" width=\"656\" height=\"571\" src=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-4.png\" alt=\"\" class=\"wp-image-1168\" srcset=\"https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-4.png 656w, https:\/\/codeinsightacademy.com\/blog\/http:\/\/codeinsightacademy.com\/blog\/wp-content\/uploads\/2021\/04\/image-4-300x261.png 300w\" sizes=\"(max-width: 656px) 100vw, 656px\" \/><\/a><\/figure>\n\n\n\n<p>Create release_project.sh file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rsync -av --exclude-from='.releaseignore' &lt;src_dir_path> &lt;dest_dir_path><\/code><\/pre>\n\n\n\n<p>Add files and directories entries in .releaseignore file to skip rsync<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node_modules\n.git\nprivate_documents<\/code><\/pre>\n\n\n\n<p>After creating freestyle project if you face any permission issue then try one of the following solutions<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo su -\nvim \/etc\/sudoers<\/code><\/pre>\n\n\n\n<p>Add following entry at end of file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#add jenkins as sudoer\njenkins        ALL=(ALL)       NOPASSWD: ALL<\/code><\/pre>\n\n\n\n<p>OR add user to the group<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -a -G sudo jenkins<\/code><\/pre>\n\n\n\n<p>Ref:<br><a rel=\"noreferrer noopener\" href=\"https:\/\/medium.com\/try-except-finally\/install-jenkins-on-wsl-ubuntu-d6cfeec8cd60\" target=\"_blank\">medium.com<\/a><br><a rel=\"noreferrer noopener\" href=\"https:\/\/stackoverflow.com\/questions\/17096784\/is-it-possible-to-allow-jenkins-to-access-the-files-that-only-root-or-some-speci\" data-type=\"URL\" data-id=\"https:\/\/stackoverflow.com\/questions\/17096784\/is-it-possible-to-allow-jenkins-to-access-the-files-that-only-root-or-some-speci\" target=\"_blank\">stackoverflow<\/a><br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Open Browser and hit following url To view default initial password Install recommended Plugins. Make sure Git Plugin is installed Jenkins URL: http:\/\/localhost:8080\/Orhttp:\/\/youripaddress:8080\/Orhttp:\/\/yourdomain:8080\/ Create New Item (New project for build) Create release_project.sh file Add files and directories entries in .releaseignore file to skip rsync After creating freestyle project if you face any permission issue then [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,31],"tags":[],"_links":{"self":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/1153"}],"collection":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/comments?post=1153"}],"version-history":[{"count":7,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/1153\/revisions"}],"predecessor-version":[{"id":1170,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/posts\/1153\/revisions\/1170"}],"wp:attachment":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/media?parent=1153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/categories?post=1153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/tags?post=1153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}