{"id":1313,"date":"2021-06-16T22:14:11","date_gmt":"2021-06-16T14:14:11","guid":{"rendered":"https:\/\/www.siediyer.cn\/?p=1313"},"modified":"2021-06-16T22:14:11","modified_gmt":"2021-06-16T14:14:11","slug":"how-to-install-jenkins-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.siediyer.cn\/?p=1313","title":{"rendered":"How to Install Jenkins on CentOS 7"},"content":{"rendered":"<figure class=\"relative -mx-6 lg:mx-0 mb-6\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/featured_hu21e6cb9563d789b6110a7e8fe6724505_37265_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:746x396\/rscb88\/ng:webp\/ngcb88\" alt=\"Install Jenkins on CentOS 7\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/featured_hu21e6cb9563d789b6110a7e8fe6724505_37265_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:746x396\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<div class=\"markdown\">\n<p><span id=\"ezoic-pub-ad-placeholder-167\" class=\"ezoic-adpicker-ad\"><\/span><a href=\"https:\/\/jenkins.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jenkins<\/a>\u00a0is an open-source, Java-based automation server that offers an easy way to set up a continuous integration and continuous delivery (CI\/CD) pipeline.<\/p>\n<p>Continuous integration (CI) is a DevOps practice in which team members regularly commit their code changes to the version control repository, after which automated builds and tests are run. Continuous delivery (CD) is a series of practices where code changes are automatically built, tested and deployed to production.<span id=\"ezoic-pub-ad-placeholder-158\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<p>This tutorial, will walk you through the steps of installing Jenkins on a CentOS 7 system using the official Jenkins repository.<span id=\"ezoic-pub-ad-placeholder-138\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<h2 id=\"prerequisites\">Prerequisites<\/h2>\n<p>Before continuing with this tutorial, make sure you are logged in as a\u00a0<a href=\"https:\/\/linuxize.com\/post\/create-a-sudo-user-on-centos\/\">user with sudo privileges<\/a>\u00a0.<\/p>\n<h2 id=\"installing-jenkins\">Installing Jenkins<\/h2>\n<p>To install Jenkins on your CentOS system, follow the steps below:<span id=\"ezoic-pub-ad-placeholder-139\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<ol>\n<li>Jenkins is a Java application, so the first step is to install Java. Run the following command to install the OpenJDK 8 package:\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">sudo yum install java-1.8.0-openjdk-devel<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>The current version of Jenkins does not support Java 10 (and Java 11) yet. If you have multiple versions of Java installed on your machine\u00a0<a href=\"https:\/\/linuxize.com\/post\/install-java-on-centos-7\/#set-the-default-version\">make sure Java 8 is the default Java version<\/a>\u00a0.<\/li>\n<li>The next step is to enable the Jenkins repository. To do that, import the GPG key using the following\u00a0<a href=\"https:\/\/linuxize.com\/post\/curl-command-examples\/\"><code>curl<\/code><\/a>\u00a0command:\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">curl --silent --location http:\/\/pkg.jenkins-ci.org\/redhat-stable\/jenkins.repo | sudo tee \/etc\/yum.repos.d\/jenkins.repo<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>And add the repository to your system with:<\/p>\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">sudo rpm --import https:\/\/jenkins-ci.org\/redhat\/jenkins-ci.org.key<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<\/li>\n<li>Once the repository is enabled, install the latest stable version of Jenkins by typing:\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">sudo yum install jenkins<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>After the installation process is completed, start the Jenkins service with:<\/p>\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">sudo systemctl start jenkins<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>To check whether it started successfully run:<\/p>\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">systemctl status jenkins<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>You should see something similar to this:<\/p>\n<pre><code class=\"language-output\" data-lang=\"output\">\u25cf jenkins.service - LSB: Jenkins Automation Server\r\nLoaded: loaded (\/etc\/rc.d\/init.d\/jenkins; bad; vendor preset: disabled)\r\nActive: active (running) since Thu 2018-09-20 14:58:21 UTC; 15s ago\r\n    Docs: man:systemd-sysv-generator(8)\r\nProcess: 2367 ExecStart=\/etc\/rc.d\/init.d\/jenkins start (code=exited, status=0\/SUCCESS)\r\nCGroup: \/system.slice\/jenkins.service<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>Finally enable the Jenkins service to start on system boot.<\/p>\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">sudo systemctl enable jenkins<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<pre><code class=\"language-output\" data-lang=\"output\">jenkins.service is not a native service, redirecting to \/sbin\/chkconfig.\r\nExecuting \/sbin\/chkconfig jenkins on<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<\/li>\n<\/ol>\n<h2 id=\"adjust-the-firewall\">Adjust the Firewall<\/h2>\n<p>If you are installing Jenkins on a remote CentOS server that is\u00a0<a href=\"https:\/\/linuxize.com\/post\/how-to-setup-a-firewall-with-firewalld-on-centos-7\/\">protected by a firewall<\/a>\u00a0you need to port\u00a0<code>8080<\/code>.<span id=\"ezoic-pub-ad-placeholder-156\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<p>Use the following commands to open the necessary port:<span id=\"ezoic-pub-ad-placeholder-140\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">sudo firewall-cmd --permanent --zone=public --add-port=8080\/tcp<\/code><code class=\"terminal-line\" prefix=\"$\">sudo firewall-cmd --reload<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<h2 id=\"setting-up-jenkins\">Setting Up Jenkins<\/h2>\n<p>To set up your new Jenkins installation, open your browser and type your domain or IP address followed by port\u00a0<code>8080<\/code>:<\/p>\n<pre><code class=\"language-url\" data-lang=\"url\">http:\/\/your_ip_or_domain:8080\r\n<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>A screen similar to the following will appear, prompting you to enter the Administrator password that is created during the installation:<\/p>\n<figure class=\"relative\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"block\"><\/div>\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/unlock-jenkins_huff7c186b4c9370e26f4ba03e0bde0db7_51753_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" alt=\"unlock jenkins\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/unlock-jenkins_huff7c186b4c9370e26f4ba03e0bde0db7_51753_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<p>Use the following command to print the password on your terminal:<\/p>\n<pre class=\"terminal\"><code class=\"terminal-line\" prefix=\"$\">sudo cat \/var\/lib\/jenkins\/secrets\/initialAdminPassword<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>You should see a 32-character long alphanumeric password as shown below:<\/p>\n<pre><code class=\"language-output\" data-lang=\"output\">2115173b548f4e99a203ee99a8732a32\r\n<\/code><button class=\"code-copy button main small\" type=\"button\">Copy<\/button><\/pre>\n<p>Copy the password from your terminal, paste it into the Administrator password field and click\u00a0<code>Continue<\/code>.<span id=\"ezoic-pub-ad-placeholder-142\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<figure class=\"relative\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"block\"><\/div>\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/customize-jenkins_hu1cb104bb89f767fdac96ebfecc6c04d0_53686_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" alt=\"customize jenkins\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/customize-jenkins_hu1cb104bb89f767fdac96ebfecc6c04d0_53686_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<p>On the next screen, you will be asked whether you want to install the suggested plugins or to select specific plugins. Click on the\u00a0<code>Install suggested plugins<\/code>\u00a0box, and the installation process will start immediately.<span id=\"ezoic-pub-ad-placeholder-160\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<figure class=\"relative\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"block\"><\/div>\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/jenkins-getting-started_hu4965eddf303984f869a67fd6fe23ee72_63429_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" alt=\"jenkins getting started\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/jenkins-getting-started_hu4965eddf303984f869a67fd6fe23ee72_63429_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<p>Once the installation is complete, you will be prompted to set up the first administrative user. Fill out all required information and click\u00a0<code>Save and Continue<\/code>.<\/p>\n<figure class=\"relative\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"block\"><\/div>\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/jenkins-create-admin-user_hude9803b4cc603eb2b5f73825b5379854_36992_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" alt=\"jenkins create admin user\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/jenkins-create-admin-user_hude9803b4cc603eb2b5f73825b5379854_36992_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<p>On the next page, you will be asked to set the URL for the Jenkins instance. The URL field will be populated with an automatically generated URL.<\/p>\n<figure class=\"relative\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"block\"><\/div>\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/jenkins-instance-configuration_hue0590329ea505a29a79bdaa150b05990_50390_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" alt=\"jenkins instance configuration\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/jenkins-instance-configuration_hue0590329ea505a29a79bdaa150b05990_50390_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<p>To complete the setup confirm the URL by clicking on the\u00a0<code>Save and Finish<\/code>\u00a0button.<span id=\"ezoic-pub-ad-placeholder-143\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<figure class=\"relative\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"block\"><\/div>\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/jenkins-is-ready_hu3da675c8f3b82e406e68ceb52ab60309_26265_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" alt=\"jenkins is ready\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/jenkins-is-ready_hu3da675c8f3b82e406e68ceb52ab60309_26265_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x565\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<p><span id=\"ezoic-pub-ad-placeholder-161\" class=\"ezoic-adpicker-ad\"><\/span>Finally, click on the\u00a0<code>Start using Jenkins<\/code>\u00a0button and you will be redirected to the Jenkins dashboard logged in as the admin user you have created in one of the previous steps.<\/p>\n<figure class=\"relative\">\n<div class=\"relative block w-full mx-auto my-0\">\n<div class=\"block\"><\/div>\n<div class=\"bg-gray-100 absolute inset-0 w-full h-full m-auto overflow-hidden\"><img decoding=\"async\" class=\"absolute inset-0 w-full h-full m-auto ezlazyloaded\" src=\"https:\/\/linuxize.com\/post\/how-to-install-jenkins-on-centos-7\/jenkins-homepage_hu004045fc7e4b3d755da189b614961948_43272_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x426\/rscb88\/ng:webp\/ngcb88\" alt=\"homepage\" data-ezsrc=\"\/post\/how-to-install-jenkins-on-centos-7\/jenkins-homepage_hu004045fc7e4b3d755da189b614961948_43272_768x0_resize_q75_lanczos.jpg?ezimgfmt=rs:726x426\/rscb88\/ng:webp\/ngcb88\" \/><\/div>\n<\/div>\n<\/figure>\n<p>If you\u2019ve reached this point, you\u2019ve successfully installed Jenkins on your CentOS system.<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>In this tutorial, you have learned how to install and complete the initial configuration of Jenkins on CentOS\/RHEL based systems. You can now visit the official\u00a0<a href=\"https:\/\/jenkins.io\/doc\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jenkins documentation<\/a>\u00a0page and start exploring Jenkins\u2019s workflow and plug-in model.<span id=\"ezoic-pub-ad-placeholder-144\" class=\"ezoic-adpicker-ad\"><\/span><\/p>\n<div id=\"linuxize_com-link-v-med-1\" class=\"ezo_link_unit_a\"><\/div>\n<p>&nbsp;<\/p>\n<p>If you have any questions, please leave a comment below<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Jenkins\u00a0is an open-source, Java-based automation server [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[],"class_list":["post-1313","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1313"}],"version-history":[{"count":1,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1313\/revisions"}],"predecessor-version":[{"id":1314,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/1313\/revisions\/1314"}],"wp:attachment":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}