2 months ago, I decided to use ubuntu OS. Windows is easier than ubuntu (for now) but the storage problem started to be an unmanageable problem for me on Windows. For now, I would say everything is perfect. (Expect permission problems.)
After Ubuntu, some installations and configurations might look different or hard. Because of that, I decided to write a blog about those topics. It is like a note for me in the future 🙂 First topic is Ubuntu. This week, I am going to write about the following topics.
- How to install Jenkins on Ubuntu,
- How to get build after every GitHub commit,
- How to publish build to FTP via Jenkins.
If you don’t have Java on your system, you have to install Java before Jenkins installation. For Java installation, you have to run following commands on your Ubuntu terminal.
sudo apt update sudo apt install openjdk-8-jdk
After installation to check your Java installation, you can run the following command.
After completing Java installation, everything is ready for Jenkins installation. Firstly we have to add the Jenkins repository key to Ubuntu. For this, please run the following command.
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
After it, we have to run the following command to add the Jenkins repository.
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
After the repository adding operation, we should run the following command for the update package list.
sudo apt-get update
To complete a Jenkins installation, you have run the following command.
sudo apt install jenkins
Now, Jenkins is installed on Ubuntu. To control the installation, you can run the following command on your terminal screen.
systemctl status jenkins
Also you can use the following commands too.
systemctl restart jenkins systemctl stop jenkins systemctl start jenkins
After seeing the Jenkins status on terminal, let’s complete configuration. To access the Jenkins, you can use the following url. It is the default Jenkins url.
On the first visit, you see Unlock Jenkins title on your page. To pass this screen, you have run the following code and proof you are a system administrator.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
This command returns us an alphanumeric password on terminal. This command returns us an alphanumeric password on the terminal. We copy this password and paste it to Jenkins page. After clicking the Continue button on this page, we see Get Started page. In this page you can choose suggested plugins or you can choose your plugins. I chose suggested plugins and continued my installation. After this step, you might wait 1 – 2 mins for installation.
After successful installation on this page, registration screens receive us. On this screen, we are going to create a Jenkins user. We have to fill all the fields on this page and continue to Save and Continue button for this.
Last 2 steps before seeing Dashboard! After registration, we see the instance configuration screen. I am installing Jenkins to my OS. Because of that, I am going to use the default url on my install. (http://localhost:8080) I did not change anything on this screen and clicked Save and Finish button.
Last screen just for information. Jenkins is ready to use. You can click Start using Jenkins and login with your username / password.
In this post we installed Jenkins to Ubuntu. In the next post, we are going to add one item to Jenkins and configure builds via GitHub account.
See you on the next post.