干净的一键卸载宝塔面板 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
- 国内看视频专用 死海网络→1 核 256M 5G SSD 100Mbps全球[VPS测评]
- 促销 CloudCone→高 IO 机器 1 核 512M 内存 10G全球[VPS测评]
- 疯狂猜成语 图猜成语一口水井里面坐着一只青蛙是什么成语?全球[VPS测评]
- tudcloud→“五一” 香港不限流量 VPS 一律 7 折优惠 三网香港VPS[主机]
- hosteons→免费提供 Windows 授权 8 折优惠 $36 年WINDOWS
- NTUP→$20 月 2*L5420 8GB 内存 300GB SAS 全球[VPS测评]
- 帝国 CMS 启用 https 后登录后台空白的解决办法全球[VPS测评]
- 云闪付 各省市优惠券发放汇总和加油 66 折全球[VPS测评]
- 微信浏览器隐藏滚动条 微信浏览器禁止显示滚动条全球[VPS测评]
- 二月促销 LOCVPS→新春 Xen VPS 七折优惠 全场八折优惠 香香港VPS[主机]
- WordPress博客网站搜索引擎优化需要注意几个SEO细节全球[VPS测评]
- 为什么有些网站的SEO排名总是靠前全球[VPS测评]
- WordPress网站上传图片出现http报错解决办法全球[VPS测评]
- 哪种类型的网站最容易获得Adsense稳定收入?全球[VPS测评]
- AlphaVPS保加利亚商家 EPYC KVM VPS 1核2GB内存/全球[VPS测评]
- SRKHOST → 匈牙利 2.2$ 月 1C1G15G硬盘 10Gbp全球[VPS测评]
- 华凯易佰同比扭亏跨境电商行业回暖H2旺季将至|中报追踪全球[VPS测评]
- 跨境电商平台首选香港服务器香港VPS[主机]
- 桔子数据,香港安畅BGP大带宽VPS 首月五折体验 三网直连 14元/月香港VPS[主机]
- 全球云lovps,香港CN2线路vps 新品七折月付49元香港VPS[主机]
- 互盟云怎么样?1核2G云服务器仅468元/年,香港云主机58元/月香港VPS[主机]
- Rustrot-深绿色UI电商网站模板HTML5框架全球[VPS测评]
- uuuvps:香港VPS低至97元/年,CN2+bgp网络,香港机房VP香港VPS[主机]
- 华为云香港企业级云服务器优惠:4核8G5M香港云服务器低至4764元/年香港VPS[主机]
- 香港云服务器对于建站有什么便捷的地方?香港VPS[主机]
- Rustrot-深绿色UI电商网站模板HTML5框架全球[VPS测评]
- 雷盾云:香港/美国/日本免备案云服务器,香港vps低至10元/月日本VPS[主机]
- 恒星云:香港沙田CN2VPS低至9.9元/起_国内BGP云服务器4核4G香港VPS[主机]
- diyvm:香港vps/美国vps/日本vps/2核/2G内存/5M带宽日本VPS[主机]
- Vultr新用户100美金 最新活动来啦!新用户充值活动来了,充100美全球[VPS测评]
转载请注明原文地址:http://140.238.13.167:12355/read-203195.html











