ubuntu 如何完全卸载grafana?

hc8w905p  于 2023-08-03  发布在  其他
关注(0)|答案(3)|浏览(247)

在Ubuntu 14.04中,我安装了grafana如下:

dpkg -i grafana_4.1.2-1486989747_amd64.deb

字符串
我正在尝试卸载它。
我试过:

sudo apt-get remove --auto-remove grafana
sudo apt-get purge --auto-remove grafana
sudo apt-get autoclean
sudo apt-get autoremove
locate grafana and manually remove files and folder


但仍然在重新安装它的旧模板是存在的。
重新安装时:

dpkg -i grafana_4.1.2-1486989747_amd64.deb 
Selecting previously unselected package grafana.
(Reading database ... 68772 files and directories currently installed.)
 .................
 ......................

bwleehnv

bwleehnv1#

卸载只是grafana:

sudo apt-get remove grafana

字符串
卸载grafana及其依赖项:

sudo apt-get remove --auto-remove grafana


更多详情,请参阅:http://installion.co.uk/ubuntu/xenial/universe/g/grafana/uninstall/index.html

b1uwtaje

b1uwtaje2#

我也有同样的问题。您需要使用引用的命令'locate grafana'并删除返回的每个示例。你可以使用我写的python脚本,如下所示。我不能保证这是最好的写作方式,但它完成了工作。这完全消除了grafana。

import os
import time
import subprocess

print('------------------------------------')
print('...Removing Grafana...\n\n')
os.system("sudo apt-get remove --auto-remove grafana -y && sudo apt-get purge --auto-remove grafana -y")
time.sleep(1)
print('------------------------------------')
print('...Cleaning Up...\n\n')
os.system("sudo apt-get autoclean && sudo apt-get autoremove")
time.sleep(1)
print('------------------------------------')
print('...Checking Left-Overs...\n\n')
os.system("sudo updatedb")
time.sleep(1)

cmd = "sudo locate grafana"
openCmd = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
fromCmd, stderr = openCmd.communicate()
cmds = fromCmd.split('\n')
print('------------------------------------')
print('...Removing Left-Overs...\n\n')

for cmd in cmds[:-1]:
    print('----------')
    print('Removing: '+str(cmd))
    os.system('sudo rm -r '+ str(cmd))

print('------------------------------------')
print('All Done!\n\n')

字符串

bbuxkriu

bbuxkriu3#

在下面的Python程序中发现错误:

Traceback (most recent call last):
  File line 21, in <module>
    cmds = fromCmd.split('\n')
TypeError: a bytes-like object is required, not 'str'

字符串
解决方案

cmds = fromCmd.decode().split('\n')


参见Cannot split, a bytes-like object is required, not 'str'

相关问题