Follow Instructions
If fails after running sudo apt install jenkins
with an error saying that could not find Java =>
sudo apt install openjdk-9-jre
sudo apt install openjdk-8-jre
- Open
sudo vi /etc/init.d/jenkins
- Finally, append path to the new java executable (line 16):
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/lib/jvm/java-8-openjdk-amd64/bin/
If still fails saying that port is already in use then:
sudo vim /etc/default/jenkins
- Change
HTTP_PORT
sudo systemctl start jenkins
sudo su - jenkins -s/bin/bash
You can find examples of jobs in folder examples
in this repo. All of them were built based on Tutorials
In order to import them into Jenkins (details find below in Jenkins CLI section):
java -jar jenkins-cli.jar -auth USERNAME:USERPASS -s http://localhost:9090 create-job newmyjob < myjob.xml
systemctl enable jenkins # Enable the Jenkins service to start automatically.
service jenkins start
service jenkins status
service jenkins restart
If you can't find necessary plugin in Web UI then:
-
Go to http://updates.jenkins.io/download/plugins and find page of your plugin
-
After you know the name of necassary plugin (for example, it is "credentials") go by link: http://updates.jenkins.io/download/plugins/credentials/
-
Download *.hpi file
-
In Web UI in "Manage Plugins" go to Advanced and there upload this *.hpi file
Instructions: https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-reset-jenkins-admin-users-password/
Error "Docker: Got permission denied while trying to connect..." then sudo usermod -a -G docker jenkins
Error "No module named .." or "Permission denied..." probably means that Jenkins user does not have access to python folder packages. For resolving this
-
sudo su - jenkins -s/bin/bash
-
Check that u are under jenkins user:
whoami
-
Install necessary packages/libraries and then exit jenkins user
-
If needed also manually install all necessary libraries
-
Download jar:
wget http://34.121.35.34:9090/jnlpJars/jenkins-cli.jar
-
Check that all is correct:
java -jar jenkins-cli.jar -auth USERNAME:USERPASS -s http://localhost:9090 who-am-i
-
Export Job:
java -jar jenkins-cli.jar -auth USERNAME:USERPASS -s http://localhost:9090 get-job myjob > myjob.xml
-
Import Job:
java -jar jenkins-cli.jar -auth USERNAME:USERPASS -s http://localhost:9090 create-job newmyjob < myjob.xml
Watch videos
№1: Intro
№3: Web UI and settings
№5: Important tutorial. Shows how to build most simple jobs (with build, test and deployment stages) + how to do ssh deployment
№6: (optional) how to connect few servers . only need in case you have large amout of jobs
№7: (optional) Jenkins CLI (how to import/export jobs)
№8: Deployment from GitHub (your username should match with user in ssh-key, for this use ssh-keygen -C DmitriiDenisov -f new_key
)
№9: (optional) Jenkins Build Triggers
№ 10: Jenkins trigger from GitHub, Jenkins webhook
№11: Build with parameters