Ubuntu系统卸载SonarQube-6.4.1遇错求助:找不到对应软件包
Hey there! The "package not found" error you're hitting makes total sense—chances are you didn't install SonarQube 6.4.1 via the apt package manager. Most users set up SonarQube by downloading the official archive directly, so we'll need to clean it up manually. Here's a step-by-step guide to get it done thoroughly:
Step 1: Stop SonarQube (if it's running)
First, make sure the SonarQube service isn't active:
- Check the service status (for systemd systems):
sudo systemctl status sonarqube - If it's running, stop it:
sudo systemctl stop sonarqube - If you started SonarQube manually (not via a service), find the running process and kill it:
ps aux | grep sonar sudo kill <PID_FROM_THE_OUTPUT>
Step 2: Delete the SonarQube Installation Directory
SonarQube is usually extracted to a folder like /opt/sonarqube or your custom path. First, locate the exact directory:
find / -name "sonarqube-6.4.1" -type d
Once you have the path, delete it entirely:
sudo rm -rf /path/to/sonarqube-6.4.1
(Replace /path/to/sonarqube-6.4.1 with the actual directory you found.)
Step 3: Remove Systemd Service Files (if you created them)
If you set up a systemd service for SonarQube, clean that up too:
- Check for the service file:
ls /etc/systemd/system/ | grep sonar - Delete the service file if it exists:
sudo rm /etc/systemd/system/sonarqube.service - Reload systemd to apply changes:
sudo systemctl daemon-reload
Step 4: Clean Up Logs and Data Directories
To fully wipe all traces, delete associated logs and data:
- Delete log files (common location is
/var/log/sonarqube, or thelogsfolder inside your installation directory):sudo rm -rf /var/log/sonarqube - Delete data files (common location is
/var/lib/sonarqube, or thedatafolder inside your installation directory):sudo rm -rf /var/lib/sonarqube
Step 5: Remove Sonar User/Group (if created)
Many guides recommend creating a dedicated sonar user for the service. If you did this, remove the user and group:
- Check if the user exists:
id sonar - Delete the user and group:
sudo userdel sonar sudo groupdel sonar
Final Check
To confirm everything is gone, run these commands to look for any remaining SonarQube traces:
find / -name "sonarqube" -type d ps aux | grep sonar
If no results show up, you've successfully removed SonarQube 6.4.1 from your Ubuntu machine!
内容的提问来源于stack exchange,提问作者Akshay Kulkarni

