Completely uninstall jenkins in linux

To completely uninstall Jenkins, you need to delete the files, directories, and configuration related to Jenkins. Here are some steps:

1. **Stop the Jenkins service:**
   Before uninstalling Jenkins, first stop the Jenkins service. Stop the Jenkins service using the following command:
   sudo systemctl stop jenkins
   

2. **Uninstall the Jenkins package:**
   If you are using a package manager (such as `yum` or `dnf`), you can use the following command to uninstall the Jenkins package:
   
   Using `yum` (for CentOS/RHEL) :
   sudo yum remove jenkins
   
   or use `dnf` (for some newer distributions):
   sudo dnf remove jenkins

3. **Delete Jenkins related directories and files:**
   - Delete the Jenkins data directory (default located at `/var/lib/jenkins`):
     sudo rm -r /var/lib/jenkins

   - Delete the Jenkins configuration files and log directories (defaults to `/etc/sysconfig/jenkins` and `/var/log/jenkins`):
     sudo rm -r /etc/sysconfig/jenkins
     sudo rm -r /var/log/jenkins

4. **Delete Jenkins users and user groups (optional):**
   If you want to completely delete Jenkins-related users and user groups, you can use the following command (note: this may delete related information of other users or groups, be careful Action):
   sudo userdel jenkins
   sudo groupdel jenkins

5. **Remove the YUM source files for Jenkins (if applicable): **
   If you added the YUM source files for Jenkins, make sure to delete them:
   sudo rm /etc/yum.repos.d/jenkins.repo

6. **Clean up residual data (optional):**
   If you want to clean up residual data more thoroughly, you can use some system maintenance tools, such as `bleachbit`, to clean up system caches and temporary files that are no longer needed.

Make sure you have backed up your Jenkins configuration and data before performing these operations to prevent unexpected data loss. After uninstalling Jenkins, you can reconfigure and use Jenkins by reinstalling it.

Guess you like

Origin blog.csdn.net/qq_33767353/article/details/132126357