干净的一键卸载宝塔面板 WEB 运行环境的方法
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

现在国内用户使用宝塔面板用来建站的朋友非常多,如果你的 VPS 不想做网站了,需要卸载宝塔,一般的 VPS 商家都可以到后面直接重新安装新的系统,不过有一些商家的 VPS 是不支持重装系统的,像 KT 就需要发工单重新安装系统,那么有什么办法可以把宝塔全面卸载呢?今天就给大家分享一个脚本,到 VPS 里直接执行一下就可以把宝塔面板卸载掉。
脚本如下:
保存成 sh 文件后,直接执行就可以, sh 文件名.sh
| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 | #!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHRemove_Bt(){if[!-f"/etc/init.d/bt"]||[!-d"/www/server/panel"];thenecho-e"此服务器没有安装宝塔!"echo-e"This server does not install bt-panel"exit;fi/etc/init.d/bt stopif[-f"/usr/sbin/chkconfig"];thenchkconfig--del btelif[-f"/usr/sbin/update-rc.d"];then/usr/sbin/update-rc.dfirm-rf/www/server/panelrm-f/etc/init.d/btecho-e"宝塔面板已卸载成功"echo-e"bt-panel uninstall success"}Remove_Service(){servicePath="/www/server"forservice innginx httpd mysqld pure-ftpd tomcat redis memcached php-fpm-52php-fpm-53php-fpm-54php-fpm-55php-fpm-56php-fpm-70php-fpm-71doif[-f"/etc/init.d/${service}"];then/etc/init.d/${service}stopif[-f"/usr/sbin/chkconfig"];thenchkconfig --del${service}elif[-f"/usr/sbin/update-rc.d"];thenupdate-rc.d-f${service}removefiif["${service}"="mysqld"];thenrm-rf${servicePath}/mysqlrm-f/etc/my.cnfelif["${service}"="httpd"];thenrm-rf${servicePath}/apacheelif["${service}"="memcached"];thenrm-rf/usr/local/memcachedelif["${service}"="nginx"]||["${service}"="redis"]||["${service}"="tomcat"]||["${service}"="pure-ftpd"];thenrm-rf${servicePath}/${service}firm-f/etc/init.d/${service}echo-e${service}"33[32mclean33[0m"fidoneif[-d"${servicePath}/php"];thenrm-rf${servicePath}/phpfiif[-d"${servicePath}/nvm"];thenrm-rf${servicePath}/nvmfiif[-d"${servicePath}/phpmyadmin"];thenrm-rf${servicePath}/phpmyadminfiif[-f/opt/gitlab/embedded/service/gitlab-rails/Gemfile];thengitlab-ctl stopyum remove gitlab-ce-yrm-rf/opt/gitlabrm-rf/var/opt/gitlabrm-rf/etc/gitlabrm-rf/www/server/panel/plugin/gitlabfi}Remove_Rpm(){echo-e"查询已安装 rpm 包.."echo-e"Find installed packages"forlib inlibiconv-1.14libmcrypt-2.5.8mcrypt-2.6.8mhash-0.9.9.9bt-mysql bt-httpd bt-mariadb bt-php-5.2bt-php-5.3bt-php-5.4bt-php-5.5bt-php-5.6bt-php-7.0bt-php-7.1dorpm-qa|grep${lib}>${lib}.pllibRpm=`cat${lib}.pl`if["${libRpm}"!=""];thenrpm-e${libRpm}--nodeps>/dev/null2>&1echo-e${lib}"33[32mclean33[0m"firm-f${lib}.pldoneecho-e"清理完毕"echo-e"Clean over"}Remove_Data(){rm-rf/www/server/datarm-rf/www/wwwlogsrm-rf/www/wwwroot}echo "================================================="#echo -e "What you want to do ?(Default:1)"echo "1) 卸载宝塔"echo "2) 卸载宝塔及运行环境"#echo "3) 卸载宝塔及运行环境并清除所有站点相关数据"read -p "请选择你要进行的操作(1-2 默认:1): " action;echo "================================================="case $action in'1')Remove_Bt;;'2')Remove_Serviceif[-f"/usr/bin/yum"]&[-f"/usr/bin/rpm"];thenRemove_RpmfiRemove_Bt;;*)Remove_Bt;;esacrm -f bt-uninstall.sh |
效果如下:
好了,这样就把宝塔面板卸载了,不过最好的方法还是重装安装系统,才是最干净的。
原文:https://www.laozuo.org/13544.html
猜你可能想看的VPS
- CN2 GIA ¥249 年 512M 内存 20G SSD 1Gbps全球[VPS测评]
- 新商家慎重-凯特云→21 元 月 512MB 内存 10GB SSD 空虚拟空间(主机)
- 微基主机 IDC.WIKI→美国 CN2 虚拟主机 日本 CN2 VPS日本VPS[主机]
- curl CURLOPT_TIMEOUT_MS 小于 1 秒无效的解决方全球[VPS测评]
- 搬瓦工提示→This feature is disabled while全球[VPS测评]
- 大硬盘 €15 年 512M 内存 128G 硬盘 500G 流量 1G全球[VPS测评]
- 韩国 CN2 $59.5 月 E5-2450L*2 32G 内存 1T 韩国VPS[主机]
- git push 提示 error: unable to rewind 全球[VPS测评]
- 恒创科技美国服务器限时终身 5 折预售,设备全新,CN2 GIA 回国带美国VPS[主机]
- 优惠 OneVPS→日本机房 VPS 全线降价 512M 2T 流量套餐日本VPS[主机]
- vpsplayer 七五折特惠套餐,深圳BGP 折后¥66/月;香港CN香港VPS[主机]
- 如何将typecho转换到WordPress?全球[VPS测评]
- 网站配置HSTS协议的好处和必要性全球[VPS测评]
- DataWagon美国AMD高性能VPS,$4起/月;不限流量独立服务器独立服务器[U]
- LetBox → 512M内存 11G NVMe储存+256G块储存 1全球[VPS测评]
- 2019黑五: ZeptoVM 欧洲CN2 → 1C 512M RAM 全球[VPS测评]
- Virmach 2019中国新年促-512M 10G ssd 500G年全球[VPS测评]
- Wikihost(idc.wiki) → 香港Cera 大宽带大流量带香港VPS[主机]
- 吸血鬼崛起服务器怎么快速搭建?全球[VPS测评]
- 中国云计算,能啃的只剩硬骨头了全球[VPS测评]
- 晚点独家丨拼多多9月上线跨境电商平台,首站美国美国VPS[主机]
- 长三角地区的算力需求规模到底有多大?全球[VPS测评]
- 向日葵-漏洞科普:海外云服务器三种漏洞修复方法快收藏起来!全球[VPS测评]
- 易凡云:国内洛阳BGP,辽宁BGP防CC,云服务器低至48.26元/月,香港VPS[主机]
- TabbyCloud:1核/1GB/20GB/2TB流量/50Mbps/香港VPS[主机]
- 桔子数据怎么样?美国、香港CN2云服务器2核2G10M带宽仅480元/年美国VPS[主机]
- anyhk香港HKT商宽NAT VPS,1Gbps无限流量,终身8折¥3香港VPS[主机]
- Centos7的firewall 防火墙如何设置端口转发?全球[VPS测评]
- 易探云:香港BGP/CN2高防云服务器租用价格表香港VPS[主机]
- 腾讯云海外云服务器怎么购买,香港2核4G云服务器661.2元/年,老用户香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-217953.html











