How to install Jenkins on a Mac


Jenkins is a Java-based open source platform for continuous integration (CI) and continuous deployment (CD). Basically, Jenkins builds software projects, checks them and makes them available. This is one of the most handy programming tools you can master, and today we’re going to show you how to install Jenkins on your macOS and use this powerful tool to activate your VPS server. VPS copies a dedicated server environment to a shared server.

Jenkins is loved by teams of all sizes for various language projects like Java, Ruby, Dot Net, PHP, etc. Jenkins is an autonomous platform that can be used on Windows, Mac, or any other operating system.

This article shows you how to install Jenkins on Mac OS.

Why use Jenkins?

To understand Jenkins, you need to consider Continuous Integration (CI) and Continuous Delivery (CD):

Continuous integration – the practice of constantly merging the developers’ working copies with the main repository.Continuous delivery – constantly delivers the code to an area as soon as it is ready for delivery. It can be for production or staging. The goods are delivered to a consumer base who can QA or inspect by customers.

Developers regularly update the code in the shared repository (like GitHub or TFS). Source code improvements are made jointly at the end of the day, which makes it difficult to identify errors. To avoid this, Jenkins is used here.

As soon as a developer changes the repository, Jenkins automatically activates the build and warns you immediately in the event of an error (continuous integration CI).

We can also automate the post-construction tests with Jenkins (unit test, success test, acceptance test). Jenkins conducts these tests and reports when progress is made (Continuous Delivery CD).

Why is Jenkins so popular?

Easy to use – simple, intuitive and visually appealing user interface

Expandability – Jenkins is very versatile and can be easily adapted to your needs. There are thousands of open source plugins with different functionalities.

Jenkins supports various version control systems, code indicators, notifiers, user interface adjustments and more!

How does Jenkins work?

As a WAR archive and as an installer package, Jenkins is distributed as a homebrew package, as an image in Docker and as source code for the most important operating systems. Most of the source code is in Java and includes several Groovy, Ruby, and Antlr files.

You can run Jenkins WAR on its own or as a servlet on a Java application server such as Tomcat. In either case, the web UI is built and calls to its REST API are accepted.

The first time you’re running Jenkins, create a long random password for the administrator that you can paste on your first webpage to unlock the installation.

requirements

We will be running multiple jobs on Jenkins so we need some proper configurations.

Hardware requirements:

Minimum requirements: RAM – 256 MB storage space – 1 GB hard disk space For small teams (recommended): RAM – 4 GB storage space – more than 50 GB hard disk space

Software requirements:

The following list shows the minimum requirements for the software:

Java: Java Development Kit (JDK) or Java Runtime Environment (JRE).

Web browser: Any browser like Google Chrome, Mozilla Firefox, Microsoft Edge, Safari

Operating system: Mac OS

Installation procedure

We’re going to discuss two ways to install Jenkins on your macOS:

Using the Homebrew Package Using Docker

Install Jenkins with homebrew

Step 1: install homebrew

You can install homebrew with the following command:

$ / bin / bash -c “$ (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

You can check the homebrew installation with:

$ brew –version

Step 2: Install Java

Skip to the next section if Java is already installed on your system.

As an open source Java application, Jenkins requires OpenJDK 8 to be installed on your system. The apt repositories can directly access OpenJDK 8.

We recommend installing OpenJDK from standard repositories. Open and in the Terminal window type:

$ brew install java

Step 3: install Jenkins

After Homebrew is installed, it is required to run the command that will download and install the latest version of Jenkins Long-Term Support (LTS).

$ brew install jenkins-lts

Step 4: start the server:

You can run the following command to finally start the Jenkins server.

$ brew services start jenkins-lts

The above command will start the Jenkins server soon.

The port is 8080. You can verify this by visiting Jenkins on its default 8080 port with your server domain name or IP address: http: // localhost: 8080 /

Step 5: unlock Jenkins:

The Unlock Jenkins screen shows the location of the initial password:

Use the cat command to display the password:

$ Cat Visit from http: // localhost: 8080 />

In this case,

$ cat /Users/ijs/.jenkins/secrets/initialAdminPassword

Copy and paste the 32-digit password into the Administrator Password field, then click Next.

We’ll follow the steps to complete the setup process at the end in the How do I configure Jenkins section?

Install Jenkins with Docker

Step 1: Install Docker

It’s pretty easy to install Docker on Mac. It contains a file with the graphical installer .dmg. Docker Engine, CLI-Client, Compose, Kitematic and Docker Machine, provided for installation.

1. Download Docker from the install docker desktop. You will receive a .dmg file

2. Click on the .dmg file and you will be prompted to move the Docker app to the applications folder.

3. After the Docker icon has been dragged into the Applications folder, double-click the Docker icon and you will be asked if you want to open the app. Click Yes to open the Docker installer.

4. Click the Next button and after that you will be prompted to install tools and ask for your permission to continue:

5. Now you will see the Docker icon in the toolbar, which means that Docker will start on your system.

Step 2: run the Jenkins Docker image

After Docker is installed and set up, you can run the following command to install Jenkins:

$ docker run -p 8080: 8080 -p 50000: 50000 -v ~ / jenkins_home: / var / jenkins_home jenkins / jenkins: lts

This command downloads Jenkins’ latest version of Long-Term Support (LTS) and rotates a new Docker container. This may take some time to install.

Step 3: get the installation password:

You will be asked for the administrator password and you will also see the place to find it if you visit Jenkins on the standard 8080 port with your server domain name or IP address: http: // localhost: 8080 /

The location of the password can be found in the steps above.

How do I configure Jenkins?

After installing Jenkins, we need to configure Jenkins to get it ready.

Step 1: install plugins

Jenkins has many plugins that can be integrated into open source projects. The next step requires installing suitable plugins according to your requirements. You can easily add or delete plugins later. From now on we can easily install the suggested plugins.

With around 1,600 plugins, Jenkins is currently the leading open source automation server for all types of development work. These 1,600 plug-ins cover five areas: platforms, UI management, source control, and most commonly build management.

Now you need to create an admin user account. Make a note of the username and password as you will need them later.

Step 3: Jenkins url configuration

The final step is to configure the URL for the server.

Click Save and Finish after confirming the relevant information. A confirmation page tells you that “Jenkins is ready!”

Finally, click Start Jenkins and you will see a dashboard.

How do I start and exit Jenkins?

When installing Jenkins with homebrew

Run the following command to stop the Jenkins server:

Stop brewing services from jenkins-lts

Run the following command to restart the server:

Restart $ brew services jenkins-lts

When installing Jenkins with Docker

To stop Jenkins, go to the terminal window where the Docker container started and enter Command + C. This will stop the Docker container and also Jenkins from running.

If you need to restart Jenkins, run the same command that you used when you installed Jenkins.

How do I uninstall Jenkins on Mac?

Jenkins is a server-focused automation platform that is typically concerned with security. Jenkins also needs add-ons for projects written in languages ​​other than Java. These additional components usually bloat Jenkins. Follow the steps to learn how to uninstall Jenkins on Mac if you are having trouble or find Jenkins not working on Mac.

If you installed Jenkins with Homebrew, you should run the following commands to uninstall Jenkins:

Uninstall $ brew jenkins –force $ brew cleanup

Learn more about the core concepts of Jenkins Jobs, Pipelines, Distributed System, Plugins with Jenkins Certification Course.

Conclusion

Installing Jenkins on Mac is very easy. Jenkins has a low learning curve and you can get started as soon as possible.

There are some popular alternatives to Jenkins. One of those tools is Zuul, which doesn’t allow you to incorporate buggy code into your main branch, with different gate configurations like cross-project testing, cross-project dependencies, and parallel testing.

In this tutorial, you learned how to install Jenkins using the packages provided by the project. You have started the server, opened the firewall and created an administrative user. You can now start exploring Jenkins!



Source link