I installed jenkins on Cnetos 7 using the following:
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --impor
Adding on to what has been already answered by Guna Sekaran. Jenkins need the user jenkins to be present in order to run the jenkins as a service.
To add user fire 'useradd jenkins' as root and fire 'passwd jenkins' as root before starting Jenkins as a service.
rm -rf /var/log/jenkins too big the log
[100 %]Solved. I had the same problem today. I checked my server space
df-h
I saw that server is out of space so i check which directory has most size by
sudo du -ch / | sort -h
I saw 12.2G /var/lib/jenkins so i entered this folder and cleared all the logs by
cd /var/libs/jenkins
rm *
and restart the jenkins it will work normal
sudo systemctl restart jenkins.service
I was trying to install it in kubuntu 18.04, and i was already sure that i had java installed, I confirmed by trying
java -version
I got the output like that
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Since I already know that my java PATH variables are defined in /etc/environment file, I added that file to the top of /etc/init.d/jenkins file
source /etc/environment
you can even remove the PATH from /etc/init.d/jenkins file, since it's already defined in /etc/environment
after that, i restarted my jenkins server,and it seemed to start working fine from localhost:8080
Similar problem on Ubuntu 16.04.
Setting up jenkins (2.72) ...
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
invoke-rc.d: initscript jenkins, action "start" failed.
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-08-01 05:39:06 UTC; 7ms ago
Docs: man:systemd-sysv-generator(8)
Process: 3700 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)
Aug 01 05:39:06 ip-0 systemd[1]: Starting LSB: Start Jenkins ....
Aug 01 05:39:06 ip-0 jenkins[3700]: ERROR: No Java executable ...
Aug 01 05:39:06 ip-0 jenkins[3700]: If you actually have java ...
Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Control pro...1
Aug 01 05:39:06 ip-0 systemd[1]: Failed to start LSB: Start J....
Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Unit entere....
Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Failed with....
To fix the issue manually install Java Runtime Environment:
JDK version 9:
sudo apt install openjdk-9-jre
JDK version 8:
sudo apt install openjdk-8-jre
Open Jenkins configuration file:
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/
Looks like java version conflicts.
Please refer https://medium.com/lucian-daniliuc/upgrading-jenkins-on-ubuntu-14-04-lts-df3e1209f98c