Empty file in /var/lib/jenkins diectory on centOS - linux

I am using Jenkins on centOS/Linux server. Now I am facing the same problem like this.
I have tried uninstalling Jenkins more than 2 times, but still getting the same empty file on the /var/lib/jenkins location.
I think I made some mistakes while uninstalling, I used this command to uninstall.
sudo yum clean all
sudo yum remove jenkins
sudo yum install jenkins
Is this correct way for uninstalling Jenkins?
And how to get files into the folder /var/lib/jenkins.?
Can anyone tell me to solve this...

You must start jenkins first. The jenkins itself populates the /var/lib/jenkins.
Just use
systemctl start jenkins
After that open in browser http://localhost:8080

Related

Reset Realm Object Server on Linux

Can I ask that are there any scripts in Linux that similar to reset-server-realms.command on Mac that can delete all realms on server. Actually I need to reset the server and clean it before use the application officially. I try to uninstall regarding to the guides on Realm website but somehow the old data still comes up.
Thanks
Uninstalling the package doesn't remove any data. This is done on purpose, so that the upgrade process of RPMs and debs works properly.
We don't provide a script, but the easiest way to wipe everything is simply to run:
sudo rm -rf /var/lib/realm
# CentOS
sudo yum remove realm-object-server-de
sudo yum install realm-object-server-de
# Ubuntu
sudo apt-get install --reinstall realm-object-server-de
Please note that this will preserve your configuration, still. The configuration is stored in /etc/realm.

How can I remove jenkins completely from linux

I have deleted jenkins all directories from different folders. But still when I access URL it is showing me jenkins login.
I want to uninstall jenkins completely. Have tried many commands from internet but still jenkins is there on server.
I have only command line access via putty so I tries whatever is possible via command to remove jenkins.
If your jenkins is running as service instead of process you should stop it first using
sudo service jenkins stop
After stopping it you can follow the normal flow of removing it using commands respective to your linux flavour
For centos it will be
sudo yum remove jenkins
For ubuntu it will
sudo apt-get remove --purge jenkins
I hope this will solve your issue.
if you are ubuntu user than try this:
sudo apt-get remove jenkins
sudo apt-get remove --auto-remove jenkins
'apt-get remove' command is use to remove package.
On Centos7,
It is important to note that while you remove jenkins using following command:
sudo yum remove jenkins
it will not remove your users and other information. For that you will have to do following:
sudo rm -r /var/lib/jenkins
First - stop Jenkins service:
sudo service jenkins stop
Next - delete:
sudo apt-get remove --purge jenkins
If you used separate server for Jenkins, some GCP or AWS - just delete this server.
Here is a video how to uninstall Jenkins from GCP Compute Engine https://youtu.be/D2HUFAc_Trw
For sentOs, it's works for me
At first stop service by sudo service jenkins stop
Than remove by sudo yum remove jenkins
I had installed Jenkins using snap and I completely forgot.
so if there is anyone out there who has tried all these steps and still gets Jenkins sign-in page try this thread.
https://stackoverflow.com/a/49695931/9854536

Install Jenkins in specific folder in RHEL

When we install jenkins, by default it installs at /var/lib directory in the RHEL machine. But I want to install jenkins in other folder or filesystem. for example /jenkins.
Before installing jenkins I changed JENKINS_HOME=/jenkins and tried installing jenkins but it wont work.
These are the steps which I followed to install Jenkins
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins
But the result is same it installs in /var/lib.
How can I install in /jenkins directory this?
Edit the /etc/sysconfig/jenkins file and change:
JENKINS_HOME = /var/lib/jenkins
to
JENKINS_HOME = /jenkins
and restart Jenkins.

Nginx - Building from source - not working

I was using this code to install Nginx
aptitude -y install nginx
aptitude -y full-upgrade
This was working fine. However, I want to install my apps from source to give me more control. I then used this code:
cd /opt/
wget http://nginx.org/download/nginx-1.2.3.tar.gz
tar xvfz nginx-1.2.3.tar.gz
cd nginx-1.2.3
./configure
make
make install
However, it seems to have extracted and installed fine on the server, but I cant see anything on my site. The command used to restart my Nginx also no longer works:
/etc/init.d/nginx restart
Is anyone able to give me a bit more information on what might be going wrong?
You need to check, where the server was installed. Probably it was installed to the /usr/local/bin directory. And the binary, that it specified in /etc/init.d/nginx is in /usr/bin.
Also, you can add set -x as the second line in the /etc/init.d/nginx to see what happens when you start it.

Jenkins failed to start in linux

go to run jenkins after doing an upgrade, and get the following:
start jenkins
start: Job failed to start
That's it...nothing shows up in jenkin's log...so it is difficult to debug to say the least.
(and it isn't running already, or anything like that).
Is there another log somewhere that I should be looking at that would be helpful?
(I am assuming answer to this problem will be somewhat iterative, so hopefully someone can start me on a path to debug this)
So, knowing it was a pre-start error allowed me to investigate more deeply.
Further digging allowed me to figure out that the exact line in the /etc/init/jenkins.conf file was one pointing to the /usr/share/jenkins/bin/maintain-plugins.sh
Looking at this location, I found it was not present (ie. no bin directory). This means that jenkins-common was no longer installed for some reason...odd indeed...going into apt-get and doing an install of this component again led to the error:
dpkg error processing /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb ...
having seen this error before and refreshing my memory via google gave the following solution:
dpkg -i --force-overwrite /var/cache/apt/archives/jenkins-common_1.409.1-0ubuntu4.2_all.deb
This allowed the installation of common to proceed as normal. After this, all I had to do was replace the /usr/share/jenkins/jenkins.war with my backed up copy (because ubuntu is far behind the latest release version), and I was able to start the server again.
I am not exactly sure what caused the problem to begin with, but it was likely during an apt-get upgrade/clean process...and because of the weirdness with jenkins conflicting with jenkins-common, it did not repopulate the /usr/share/jenkins directory properly.
regardless, am glad it is working again. :)
Instead, you can run the following before the install to properly clean up any conffiles left by the distro version:
sudo apt-get purge jenkins
Then install the correct version.
Ubuntu 18.04 LTS use Java 9 as default java
Jenkins 2.107.2 still use Java 8
[Solution]
Install Java 8 before install Jenkins
sudo add-apt-repository ppa:webupd8team/java
sudo apt install oracle-java8-installer
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"
sudo apt install jenkins
See https://stackoverflow.com/a/49937744/900684
I went to see the jenkins logs
tail -f /var/log/jenkins/jenkins.log
In my case it didn't start because I used incompatible java version.
Update and make sure it sees correct java (In my case it should have been opened using JRE 1.7. To check, please use java -version command) and all should work
The following worked for me:
sudo rm /etc/init/jenkins.conf
sudo update-rc.d jenkins defaults
sudo service jenkins start
Then....
root#core:/# service jenkins start
* Starting Jenkins Continuous Integration Server jenkins [ OK ]
Borrowed from: https://groups.google.com/forum/#!msg/jenkinsci-users/eW_yEWLojFc/tFhb8DKoRHUJ
I got from this link: https://serverfault.com/questions/710680/jenkins-not-starting-in-ubuntu
It might be caused by a full disk.
To be really sure, try running it manually. Like this:
/usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1

Resources