# Jenkins How to install and administrate Jenkins. ## Install ### Java You need Java 8 or 11 if you have Jenkins above 2.164. ``` sudo apt install openjdk-8-jre ``` ### Raspberry Pi [Jenkins doc : installation](https://jenkins.io/doc/book/installing/#debianubuntu) To execute on debian server ``` wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - ; sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' ; sudo apt-get update ; sudo apt-get install jenkins ; ``` Jenkins is now installed as a daemon and you should connect locally to it with a browser to complete installation. `192.168.0.40:8080` ### HTTPS The best way to secure _Jenkins_ is to use the proxy with _Apache_. [Jenkins wiki : running Jenkins behind Apache](https://wiki.jenkins.io/display/JENKINS/Running+Jenkins+behind+Apache) See the _JovianHttpd_ repository to see the template for configuration. ## Integration Integrate Jenkins with other tools ### Gogs #### Plugin Install `gogs-webhook` plugin. Documentation on [plugins.jenkins.io](https://plugins.jenkins.io/gogs-webhook). #### Add webhook on Gogs side In the Gogs repository settings, add the _webhook_ `https://jenkins.jovian-hersemeule.eu/gogs-webhook/?job=experiments/connect` Adapt job name. #### Private communication - Create a Jenkins account on Gogs - Generate an SSH key with `ssh-keygen` - Create credentials under Jenkins and store private key and passphrase - Put SSH public key in Jenkins account on Gogs - On Gogs : Add Jenkins user with _read_ rights to any repository Jenkins has to build ### Apache2 http server How to deploy on a Httpd server. #### Grant _jenkins_ user You have to set _jenkins_ user owner of the targeted folder. ## Trouble shooting ### Logs In file `/var/log/jenkins/jenkins.log` ### Git describe To allow the command `git describe` to work, go to your job configuration and add an **Advanced Cloned Behoviours** and tick the _tags_ checkbox. ## Configure Configuration parameters can be found at `/etc/default/jenkins` ## Useful plugins ### Basic Branch strategy Useful to build tags.