- Continuous Integration,Delivery,and Deployment
- Sander Rossel
- 529字
- 2021-07-02 15:42:12
Installing Jenkins on Ubuntu
Unfortunately, Jenkins is not as straightforward as doing apt-get install. If you try to install Jenkins through sudo apt-get install jenkins, you will get an error saying Jenkins was not found in the repository. Luckily, the Jenkins Wiki did a good job of describing how to install it on Ubuntu (or Debian-based distributions). See: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu, for more information:
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
So, what does this do exactly? The wget (or web get) command downloads anything from the web. That could be a file or a web page, or even an entire folder. In this case, we are going to download: https://pkg.jenkins.io/debian/jenkins-ci.org.key (you can download it using a browser as well). The -q switch means there is no logging (q is for quiet). The -O switch is a little more complex and ensures that all downloaded content is concatenated and written to a single file. Since - is used as the name of the file, the document will be written to the standard output, instead of an actual file. Next, the resulting output is passed as input (with the pipe | character) to the sudo apt-key add - command. apt-key add simply adds a key to the apt-get repository (so we should update that!) and the - at the end means the key is written from the standard output (where we put the key download) instead of a file. Simply said, we are downloading apt-get key and adding it to apt-get repository.
The next line starts with sudo sh, meaning that we are going to execute a shell command as the root user. The -c is actually a parameter to the sh and means the following is the shell to execute. Within the shell, we are going to write the contents of the deb URL to the standard output, which is what echo does. The deb URL gets a Debian software file from the URL. We are then redirecting the output to the file /etc/apt/sources.list.d/jenkins.list using the > character. This adds the Jenkins package to the apt-get sources.
sudo apt-get update and sudo apt-get install jenkins should be familiar.
If all of that worked, you have just installed Jenkins! Now go back to your host, open up a browser, and browse to: http://ciserver:8080 (or http://192.168.56.101:8080/ (the IP address you added to the interfaces file earlier on port 8080, which is the default Jenkins port)). You should see the following page with instructions on how to unlock Jenkins:

You know what to do: run sudo vi /var/lib/jenkins/secrets/initialAdminPassword in your VM, enter the code in that file on your browser, and hit Continue. From here on, the installation is the same as the Windows installation, so skip the Installing Jenkins on Windows section and head over to the Configure the Jenkins admin section.
- Boost程序庫(kù)完全開(kāi)發(fā)指南:深入C++”準(zhǔn)”標(biāo)準(zhǔn)庫(kù)(第5版)
- 新一代通用視頻編碼H.266/VVC:原理、標(biāo)準(zhǔn)與實(shí)現(xiàn)
- 軟件測(cè)試工程師面試秘籍
- Android 7編程入門(mén)經(jīng)典:使用Android Studio 2(第4版)
- Scratch 3游戲與人工智能編程完全自學(xué)教程
- H5頁(yè)面設(shè)計(jì):Mugeda版(微課版)
- Java:High-Performance Apps with Java 9
- 從零開(kāi)始:UI圖標(biāo)設(shè)計(jì)與制作(第3版)
- Mastering Docker
- Python計(jì)算機(jī)視覺(jué)和自然語(yǔ)言處理
- 算法圖解
- 零基礎(chǔ)學(xué)C++(升級(jí)版)
- Scratch超人漫游記:創(chuàng)意程序設(shè)計(jì):STEAM創(chuàng)新教育指南
- OpenStack Sahara Essentials
- C++ Windows Programming