• 欢迎光临~

Jenkins 安装

开发技术 开发技术 2022-12-01 次浏览

Option 1: Install Jenkins with Homebrew

Step 1: Install Homebrew

If you don’t already have the Homebrew package manager installed, you will first need to follow the installation steps from https://brew.sh/.

You can check if Homebrew is already installed by opening a terminal window and typing:

brew --version

You should get back the Homebrew version if already installed.

Jenkins 安装

 

Step 2: Install Jenkins

Once Homebrew is installed, you can run the following command which will download and install the current Long-term support (LTS) version of Jenkins.

brew install jenkins-lts

Jenkins 安装

Step 3: Start the Jenkins server

The next step is to actually start the Jenkins server. You can do that with this command:

brew services start jenkins-lts

This will start the Jenkins server in a few seconds. You can check if it is properly working by visiting http://localhost:8080/

Step 4: Get the installation password

To get the password needed to run the installation process, just check the content of the file mentioned on the screen.

Jenkins 安装

 

Now, let’s use the cat command directly in the terminal, for example (replace with your own file path):

cat /Users/valentin/.jenkins/secrets/initialAdminPassword

Jenkins 安装

Check the last section of this article on how to complete the setup process.

 

Starting and stopping Jenkins

To stop the Jenkins server, open any terminal window and enter the command:

brew services stop jenkins-lts

To start the Jenkins server again, use the command:

brew services start jenkins-lts

 

Option 2: Install Jenkins with Docker

Step 1: Install Docker

This step requires that you have Docker installed on your system. If this is not the case, make sure you download and install Docker Desktop

Step 2: Run the Jenkins Docker image

Once Docker is up-and-running, you can open a new terminal window and paste the following command:

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

This command will download the current Long-term support (LTS) version of Jenkins and will spin-up a new Docker container. You can learn more about the different options available at the official Jenkins Docker documentation page.

Step 3: Wait for the installation to complete

Initially, it should take a few minutes to download and install, but you should soon see in the terminal no longer displaying anything new.

This indicates that the container is now working and waiting for you to complete the Jenkins installation.

Step 4: Get the installation password

Open a new browser window and go to http://localhost:8080/

You will be asked to input the installation password that should still be visible in the terminal.

Jenkins 安装

 

Starting and stopping Jenkins

To stop Jenkins, you can go to the terminal window where you started the Docker container and hit Command + C. This will stop the process running the Docker container thus stopping Jenkins.

If you need to start Jenkins again, run the exact same command as when you have installed Jenkins.

 

How to Configure Jenkins

Once you have installed Jenkins in any of the ways presented, it is time to do the final setup.

Step 1: Install plugins

Jenkins is composed of multiple components called plugins. The next step asks you which plugins you would like to install. Just install the suggested plugins. Don’t worry about this – you can easily add or remove plugins later. Just install the suggested plugins.

Jenkins 安装

 

Step 2: Create a Jenkins User

The next step is to create a Jenkins admin user. Make sure you write down the username and password as you will need them later.

Jenkins 安装

 

Step 3: Configure the Jenkins URL

The final step is to configure the URL for the Jenkins server. This would be prefilled for you. So all you need to do is to click “Save and continue“.

Jenkins 安装

 

Soon the server will be configured and ready for action.

Jenkins 安装

 

程序员灯塔
转载请注明原文链接:Jenkins 安装
喜欢 (0)
违法和不良信息举报电话:022-22558618 举报邮箱:dljd@tidljd.com