One place for hosting & domains

      Jenkins

      How To Install Jenkins on Ubuntu 20.04


      Not using Ubuntu 20.04?


      Choose a different version or distribution.

      Introduction

      When faced with repetitive technical tasks, finding automation solutions that work can be a chore. With Jenkins, an open-source automation server, you can efficiently manage tasks from building to deploying software. Jenkins is Java-based, installed from Ubuntu packages or by downloading and running its web application archive (WAR) file — a collection of files that make up a complete web application to run on a server.

      In this tutorial we’ll install Jenkins on Ubuntu 20.04, start the development server and create an administrative user to get you started in exploring what Jenkins can do. While you’ll have a development-level server ready for use at the conclusion of this tutorial, to secure this installation for production, follow the guide How to Configure Jenkins with SSL Using an Nginx Reverse Proxy on Ubuntu 18.04.

      Prerequisites

      To follow this tutorial, you will need:

      Step 1 — Installing Jenkins

      The version of Jenkins included with the default Ubuntu packages is often behind the latest available version from the project itself. To ensure you have the latest fixes and features, use the project-maintained packages to install Jenkins.

      First, add the repository key to the system:

      • wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

      After the key is added the system will return with OK.

      Next, let’s append the Debian package repository address to the server’s sources.list:

      • sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

      After both commands have been entered, we’ll run update so that apt will use the new repository.

      Finally, we’ll install Jenkins and its dependencies.

      Now that Jenkins and its dependencies are in place, we’ll start the Jenkins server.

      Step 2 — Starting Jenkins

      Let’s start Jenkins by using systemctl:

      sudo systemctl start jenkins
      

      Since systemctl doesn’t display status output, we’ll use the status command to verify that Jenkins started successfully:

      • sudo systemctl status jenkins

      If everything went well, the beginning of the status output shows that the service is active and configured to start at boot:

      Output

      ● jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; generated) Active: active (exited) since Fri 2020-06-05 21:21:46 UTC; 45s ago Docs: man:systemd-sysv-generator(8) Tasks: 0 (limit: 1137) CGroup: /system.slice/jenkins.service

      Now that Jenkins is up and running, let’s adjust our firewall rules so that we can reach it from a web browser to complete the initial setup.

      Step 3 — Opening the Firewall

      To set up a UFW firewall, visit Initial Server Setup with Ubuntu 20.04, Step 4- Setting up a Basic Firewall. By default, Jenkins runs on port 8080. We’ll open that port using ufw:

      Note: If the firewall is inactive, the following commands will allow OpenSSH and enable the firewall:

      • sudo ufw allow OpenSSH
      • sudo ufw enable

      Check ufw’s status to confirm the new rules:

      You’ll notice that traffic is allowed to port 8080 from anywhere:

      Output

      Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 8080 ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) 8080 (v6) ALLOW Anywhere (v6)

      With Jenkins installed and our firewall configured, we can complete the installation stage and dive into Jenkins setup.

      Step 4 — Setting Up Jenkins

      To set up your installation, visit Jenkins on its default port, 8080, using your server domain name or IP address: http://your_server_ip_or_domain:8080

      You should receive the Unlock Jenkins screen, which displays the location of the initial password:

      Unlock Jenkins screen

      In the terminal window, use the cat command to display the password:

      • sudo cat /var/lib/jenkins/secrets/initialAdminPassword

      Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.

      The next screen presents the option of installing suggested plugins or selecting specific plugins:

      Customize Jenkins Screen

      We’ll click the Install suggested plugins option, which will immediately begin the installation process.

      Jenkins Getting Started Install Plugins Screen

      When the installation is complete, you’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.

      Note: The default Jenkins server is NOT encrypted, so the data submitted with this form is not protected. Refer to How to Configure Jenkins with SSL Using an Nginx Reverse Proxy on Ubuntu 18.04 to protect user credentials and information about builds that are transmitted via the web interface.

      Jenkins Create First Admin User Screen

      Enter the name and password for your user:

      Jenkins Create User

      You’ll receive an Instance Configuration page that will ask you to confirm the preferred URL for your Jenkins instance. Confirm either the domain name for your server or your server’s IP address:

      Jenkins Instance Configuration

      After confirming the appropriate information, click Save and Finish. You’ll receive a confirmation page confirming that “Jenkins is Ready!”:

      Jenkins is ready screen

      Click Start using Jenkins to visit the main Jenkins dashboard:

      Welcome to Jenkins Screen

      At this point, you have completed a successful installation of Jenkins.

      Conclusion

      In this tutorial, you installed Jenkins using the project-provided packages, started the server, opened the firewall, and created an administrative user. At this point, you can start exploring Jenkins.

      When you’ve completed your exploration, follow the guide How to Configure Jenkins with SSL Using an Nginx Reverse Proxy on Ubuntu 18.04 to protect your passwords, as well as any sensitive system or product information that will be sent between your machine and the server in plain text to continue using Jenkins.

      To learn more what you can do using Jenkins, check out other tutorials on the subject:



      Source link

      How to Deploy Jenkins with One-Click Apps


      Updated by Linode

      Contributed by
      Linode

      Jenkins is an open source automation tool which can build, test, and deploy your infrastructure. It gives you access to a massive library of plugins to support automation in your project’s lifecycle. You can create a continuous delivery pipeline which automates the process for getting your software from version control to your users.

      Linode Options

      After providing the app-specific options, provide configurations for your Linode server:

      ConfigurationDescription
      Select an ImageDebian 9 is currently the only image supported by the Jenkins One-Click App, and it is pre-selected on the Linode creation page. Required
      RegionThe region where you would like your Linode to reside. In general, it’s best to choose a location that’s closest to you. For more information on choosing a DC, review the How to Choose a Data Center guide. You can also generate MTR reports for a deeper look at the network routes between you and each of our data centers. Required.
      Linode PlanYour Linode’s hardware resources. The resources needed for a Jenkins master can vary widely depending on your organization’s needs (the RAM allotted for it can range from 200 MB for a small installation to 70+ GB for a single and massive Jenkins master). See Jenkins’ hardware recommendations page for a detailed outline about resource requirements. We recommend, at minimum, starting with a 4 GB Linode plan. You can always resize your Linode to a different plan later if you feel you need to increase or decrease your system resources. Required
      Linode LabelThe name for your Linode, which must be unique between all of the Linodes on your account. This name will be how you identify your server in the Cloud Manager’s Dashboard. Required.
      Add TagsA tag to help organize and group your Linode resources. Tags can be applied to Linodes, Block Storage Volumes, NodeBalancers, and Domains.
      Root PasswordThe primary administrative password for your Linode instance. This password must be provided when you log in to your Linode via SSH. It must be at least 6 characters long and contain characters from two of the following categories: lowercase and uppercase case letters, numbers, and punctuation characters. Your root password can be used to perform any action on your server, so make it long, complex, and unique. Required

      When you’ve provided all required Linode Options, click on the Create button. Your Jenkins app will complete installation anywhere between 2-5 minutes after your Linode has finished provisioning.

      Getting Started after Deployment

      After deploying your Jenkins instance, you are ready to log in and continue the configuration process. Follow the steps in the next section to get started.

      Access Your Jenkins Instance

      1. Connect to your Linode via SSH.

      2. Retrieve your Jenkins admin password by viewing the contents of the /var/lib/jenkins/secrets/initialAdminPassword file.

        cat /var/lib/jenkins/secrets/initialAdminPassword
        

        You should see a similar output

          
        0f6fed516bc4ceab24373fe5de513dc
            
        
      3. Open a browser and navigate to http://192.0.2.0:8080/. Replace 192.0.2.0 with your Linode’s IP address. This will bring you the Unlock Jenkins page. Enter the password you retrieved in the previous step and click continue.

        Log into Jenkins with your admin password

      4. You are now ready to continue to configure Jenkins by installing the community suggested plugins or manually selecting plugins to install. Select the option you prefer.

        Install Jenkins Plugins

      5. After you have installed the desired plugins, you will be prompted to create your first admin user. Since the login password retrieved in the beginning of this section is temporary, you should create your admin user now.

        Create your first Jenkins admin user.

      More Information

      You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

      This guide is published under a CC BY-ND 4.0 license.



      Source link

      Установка Jenkins на Ubuntu 18.04


      Введение

      Jenkins — это сервер автоматизации с открытым исходным кодом, который позволяет автоматизировать выполнение повторяющихся технических задач в области непрерывной интеграции и предоставления программного обеспечения. Jenkins написан на Java и может устанавливаться из пакетов Ubuntu или с помощью загрузки и запуска архива веб-приложения (web application archive, WAR), который представляет собой набор файлов, составляющих полноценное веб-приложение, готовое для запуска на сервере.

      В этом руководстве вы установите Jenkins, добавив его в репозиторий пакетов Debian и воспользовавшись этим репозиторием для установки пакета с помощью apt.

      Предварительные требования

      Для данного обучающего модуля вам потребуется следующее:

      Шаг 1 — Установка Jenkins

      Версия Jenkins, содержащаяся в стандартных пакетах Ubuntu, часто отличается от последней доступной версии проекта. Чтобы воспользоваться самыми последними исправлениями и функциями, вы можете использовать пакеты, поддерживаемые проектом, для установки Jenkins.

      Во-первых, добавьте ключ репозитория в систему:

      • wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

      После добавления ключа система должна вернуть OK. Затем добавьте в адрес репозитория пакетов Debian в sources.list сервера:

      • sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

      Когда оба условия будут выполнены, запустите команду update, чтобы apt смог использовать новый репозиторий:

      После этого можно перейти к установке Jenkins и его зависимостей:

      Теперь, когда Jenkins и его зависимости готовы, мы запустим сервер Jenkins.

      Шаг 2 — Запуск Jenkins

      Давайте запустим Jenkins с помощью systemctl:

      sudo systemctl start jenkins
      

      Поскольку systemctl не поддерживает вывод данных на экран, вы можете использовать команду status для проверки того, что Jenkins успешно запущен:

      • sudo systemctl status jenkins

      Если все пройдет нормально, начало вывода должно демонстрировать, что служба активна и настроена для запуска при загрузке:

      Output

      ● jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; generated) Active: active (exited) since Mon 2018-07-09 17:22:08 UTC; 6min ago Docs: man:systemd-sysv-generator(8) Tasks: 0 (limit: 1153) CGroup: /system.slice/jenkins.service

      Теперь, когда Jenkins работает, мы изменим правила нашего брандмауэра, чтобы мы могли получить к нему доступ из браузера для выполнения первоначальной настройки.

      Шаг 3 — Открытие брандмауэра

      По умолчанию Jenkins использует порт 8080, так что давайте откроем этот порт с помощью ufw:

      Проверьте состояние ufw, чтобы подтвердить сохранение новых правил:

      Вы увидите, что порт 8080 разрешает принимать трафик из любого места:

      Output

      Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 8080 ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) 8080 (v6) ALLOW Anywhere (v6)

      Примечание: если брандмауэр не запущен, следующие команды будут разрешать использование OpenSSH и активировать брандмауэр:

      • sudo ufw allow OpenSSH
      • sudo ufw enable

      После установки Jenkins и настройки нашего брандмауэра мы можем завершить первоначальную настройку.

      Шаг 4 — Настройка Jenkins

      Чтобы выполнить настройку вашей установки, откройте Jenkins на используемом по умолчанию порте 8080, используя доменное имя вашего сервера или IP-адрес: http://your_server_ip_or_domain:8080

      Вы должны увидеть экран *Unlock Jenkins *(Разблокировать Jenkins), который показывает местоположение первоначального пароля:

      Экран разблокировки Jenkins

      В окне командной строки воспользуйтесь командой cat для вывода пароля:

      • sudo cat /var/lib/jenkins/secrets/initialAdminPassword

      Скопируйте 32-символьный буквенно-цифровой пароль из командной строки и вставьте его в поле Administrator password (Пароль администратора), после чего нажмите *Continue *(Продолжить).

      На следующем экране отображаются рекомендуемые для установки плагины и предоставляется возможность выбора конкретных плагинов:

      Экран персональной настройки Jenkins

      Мы воспользуемся опцией Install suggested plugins (Установить рекомендованные плагины), после чего сразу же будет запущен процесс установки:

      Экран установки плагинов Jenkins  для начала работы

      После завершения установки вам будет предложено настроить первого административного пользователя. Вы можете пропустить этот шаг и продолжить в качестве администратора admin, используя первоначальный пароль, который мы использовали выше, но мы воспользуемся этой возможностью и создадим пользователя.

      Примечание: по умолчанию сервер Jenkins НЕ шифруется, поэтому данные, передаваемые с помощью этой формы, не защищены. Когда вы будете готовы к использованию этой установки, следуйте указаниям руководства Настройка Jenkins с SSL с помощью обратного прокси-сервера Nginx на Ubuntu 18.04. Это позволит защитить учетные данные пользователя и информацию о сборках, передаваемые через веб-интерфейс.

      Экран создания первого пользователя Jenkins с правами администратора

      Введите имя и пароль для вашего пользователя:

      Создание пользователя Jenkins

      Вы увидите страницу Instance Configuration (Конфигурация экземпляра), где вы должны будете подтвердить предпочитаемый URL для вашего экземпляра Jenkins. Подтвердите доменное имя вашего сервера или IP-адрес вашего сервера:

      Конфигурация экземпляра Jenkins

      После подтверждения соответствующей информации нажмите Save and Finish (Сохранить и завершить). Вы увидите страницу с подтверждением того, что сервер Jenkins готов к работе:

      Экран "Jenkins  готов"

      Нажмите Start using Jenkins​​​​​​ (Начать использование Jenkins), чтобы открыть панель управления Jenkins:

      Приветственный экран Jenkins

      После этого установку Jenkins можно считать выполненной успешно.

      Заключение

      В этом руководстве вы установили Jenkins с помощью пакетов, предоставленных проектом, запустили сервер, открыли брандмауэр и создали пользователя с правами администратора. Сейчас вы можете начать изучение Jenkins.

      После более близкого знакомства, если вы будете готовы продолжить использование Jenkins, следуйте указаниям руководства Настройка Jenkins с SSL с помощью обратного прокси сервера Nginx на Ubuntu 18.04 для защиты ваших паролей, а также любой чувствительной системной информации или информации о продукте, которая будет передаваться между вашим компьютером и сервером в текстовом формате.



      Source link