{"id":1485,"date":"2024-12-17T14:05:41","date_gmt":"2024-12-17T14:05:41","guid":{"rendered":"https:\/\/kb.lagonet.vn\/?p=1485"},"modified":"2024-12-17T14:05:41","modified_gmt":"2024-12-17T14:05:41","slug":"install-jenkin-server","status":"publish","type":"post","link":"https:\/\/kb.lagonet.vn\/?p=1485","title":{"rendered":"Install Jenkin Server"},"content":{"rendered":"\n<p>To install <strong>Jenkins<\/strong> on Ubuntu 22.04, follow these steps:<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Update the System<\/strong><\/h3>\n\n\n\n<p>Ensure your system is up to date by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt upgrade -y\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>2. Install Java<\/strong><\/h3>\n\n\n\n<p>Jenkins requires Java. Install <strong>OpenJDK 17<\/strong> (recommended for Jenkins):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install openjdk-17-jdk -y\n<\/code><\/pre>\n\n\n\n<p>Verify the installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>java -version\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Add Jenkins Repository<\/strong><\/h3>\n\n\n\n<p>Jenkins is not in the default Ubuntu repositories. Add the official Jenkins repository:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Import the GPG Key<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsSL https:\/\/pkg.jenkins.io\/debian\/jenkins.io-2023.key | sudo tee \\\n  \/usr\/share\/keyrings\/jenkins-keyring.asc &gt; \/dev\/null\n<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Add the Jenkins Repository<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb &#91;signed-by=\/usr\/share\/keyrings\/jenkins-keyring.asc] \\\nhttps:\/\/pkg.jenkins.io\/debian binary\/\" | sudo tee \\\n  \/etc\/apt\/sources.list.d\/jenkins.list &gt; \/dev\/null\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Install Jenkins<\/strong><\/h3>\n\n\n\n<p>After adding the repository, install Jenkins with the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install jenkins -y\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Start and Enable Jenkins Service<\/strong><\/h3>\n\n\n\n<p>Start the Jenkins service and enable it to run on boot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start jenkins\nsudo systemctl enable jenkins\n<\/code><\/pre>\n\n\n\n<p>Verify the Jenkins service status:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status jenkins\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. Open Firewall for Jenkins<\/strong><\/h3>\n\n\n\n<p>By default, Jenkins runs on <strong>port 8080<\/strong>. Allow this port through the firewall:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 8080\nsudo ufw reload\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. Access Jenkins<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your browser and navigate to: <code>http:\/\/your_server_ip:8080<\/code> Replace <code>your_server_ip<\/code> with your server&#8217;s IP or <code>localhost<\/code> if accessing locally.<\/li>\n\n\n\n<li><strong>Unlock Jenkins<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Run the following command to get the initial admin password: <code>sudo cat \/var\/lib\/jenkins\/secrets\/initialAdminPassword<\/code><\/li>\n\n\n\n<li>Copy the password and paste it into the browser.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Follow the on-screen instructions to complete the setup.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>8. (Optional) Install Plugins and Configure Jenkins<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>During setup, you can choose to install <strong>Suggested Plugins<\/strong> or manually select plugins.<\/li>\n\n\n\n<li>Create an admin user when prompted.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Jenkins should now be successfully installed and accessible! If you need further configuration or help, let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To install Jenkins on Ubuntu 22.04, follow these steps: 1. Update the System Ensure your system is up to date [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[146,141],"tags":[],"class_list":["post-1485","post","type-post","status-publish","format-standard","hentry","category-ci-cd","category-devops"],"_links":{"self":[{"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=\/wp\/v2\/posts\/1485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1485"}],"version-history":[{"count":1,"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=\/wp\/v2\/posts\/1485\/revisions"}],"predecessor-version":[{"id":1486,"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=\/wp\/v2\/posts\/1485\/revisions\/1486"}],"wp:attachment":[{"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.lagonet.vn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}