# Jenkins Setup

Jenkins can be installed on all operating systems/distributions, and is made easier with their docker container. I will be installing it on an Ubuntu server as we have done in the GitLab section previous though. [Docs for reference](https://www.jenkins.io/doc/book/installing/linux/).

Jenkins also has a list of [best practices](https://www.jenkins.io/doc/book/using/best-practices/) which I advise you explore and set up according to your organisation or environment.

### Module Objectives

* Install Jenkins Server
* Install plugins
* Create your First Admin Account

### Prerequisites

{% code overflow="wrap" %}

```yaml
Minimum:
- 4GB RAM
- 64GB Disk Space
- Virtualisation Software (VMWare or VirtualBox)
- Any Platform/OS
- Git
- Java JDK 17 / 22
```

{% endcode %}

*For a more in-depth list -* [*check the documentation*](https://www.jenkins.io/doc/book/installing/)

### Installing Jenkins

Installing Jenkins is straightforward - the commands below were taken from the Jenkins documentation found [here](https://www.jenkins.io/doc/book/installing/linux/). I converted it to a script for convenience (and future automation).

{% @github-files/github-code-block url="<https://github.com/Securescape/Offensive-Development/blob/main/Install%20Scripts/install_jenkins.sh>" %}

Save the file as whatever you'd like, then execute it to begin the installation process. This can take several minutes to complete. Once done, you should see this output

```bash
[+] Installation Complete
[!] Jenkins running on: http://YOUR-IP:8080
[!] Jenkins Password  : 9d2ad[..]c2c43e
```

Access the webpage from the IP address selected, then use the password that was generated for you (You must change this later). You should see the page below when the password has been entered

<figure><img src="https://1797977785-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjrIJ5xrJuOVgeeYdKNB5%2Fuploads%2F6omExkynhTGLx0fETuCa%2Fimage.png?alt=media&#x26;token=a9475643-f937-4f9c-9fb0-b67641289ba3" alt=""><figcaption><p>Jenkins Initial Customisation</p></figcaption></figure>

I'll click on the suggested plugins, though you can go with the other option as well. After the setup is complete, create your first admin user to access the main dashboard.

#### First Admin User

<figure><img src="https://1797977785-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjrIJ5xrJuOVgeeYdKNB5%2Fuploads%2F4zgpwhNViNVI8d7jWz40%2Fimage.png?alt=media&#x26;token=90b72c55-834c-4f12-993e-0bb00294a5b4" alt=""><figcaption><p>Create Admin User</p></figcaption></figure>

If you are using a DNS server and custom SSL certs or a FQDN, you can also specify that URL here instead of the IP address (For simplicity, I'll go with the default value)

<figure><img src="https://1797977785-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjrIJ5xrJuOVgeeYdKNB5%2Fuploads%2Fz2f81JXAaRAhzucbYOhE%2Fimage.png?alt=media&#x26;token=ea38bd14-9757-4017-878a-48ca04ee6071" alt=""><figcaption><p>URL Setup</p></figcaption></figure>

You should be taken to this screen once you've made your choice (skip or set the URL settings)

<figure><img src="https://1797977785-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjrIJ5xrJuOVgeeYdKNB5%2Fuploads%2FmuClUKmFUcZRIVSvIMor%2Fimage.png?alt=media&#x26;token=b2f6de4c-0357-4b0d-b12c-5be2b0a673b1" alt=""><figcaption><p>Main Dashboard</p></figcaption></figure>

<figure><img src="https://1797977785-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjrIJ5xrJuOVgeeYdKNB5%2Fuploads%2FtdEWiTSbtgEDJ8nGT7n0%2Fimage.png?alt=media&#x26;token=4f18f7bb-9140-42c1-affc-19239e73aea3" alt=""><figcaption><p>Missing Agent Error</p></figcaption></figure>

You will also notice an error on the top right, this is due to us not having a build agent which we'll set up later.
