干净的一键卸载宝塔面板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 PATH Remove_Bt(){ if [ ! -f "/etc/init.d/bt" ] || [ ! -d "/www/server/panel" ]; then echo -e "此服务器没有安装宝塔!" echo -e "This server does not install bt-panel" exit; fi /etc/init.d/bt stop if [ -f "/usr/sbin/chkconfig" ];then chkconfig --del bt elif [ -f "/usr/sbin/update-rc.d" ];then /usr/sbin/update-rc.d fi rm -rf /www/server/panel rm -f /etc/init.d/bt echo -e "宝塔面板已卸载成功" echo -e "bt-panel uninstall success"}Remove_Service(){ servicePath="/www/server" for service in nginx httpd mysqld pure-ftpd tomcat redis memcached php-fpm-52 php-fpm-53 php-fpm-54 php-fpm-55 php-fpm-56 php-fpm-70 php-fpm-71 do if [ -f "/etc/init.d/${service}" ]; then /etc/init.d/${service} stop if [ -f "/usr/sbin/chkconfig" ];then chkconfig --del ${service} elif [ -f "/usr/sbin/update-rc.d" ];then update-rc.d -f ${service} remove fi if [ "${service}" = "mysqld" ]; then rm -rf ${servicePath}/mysql rm -f /etc/my.cnf elif [ "${service}" = "httpd" ]; then rm -rf ${servicePath}/apache elif [ "${service}" = "memcached" ]; then rm -rf /usr/local/memcached elif [ "${service}" = "nginx" ] || [ "${service}" = "redis" ] || [ "${service}" = "tomcat" ] || [ "${service}" = "pure-ftpd" ] ; then rm -rf ${servicePath}/${service} fi rm -f /etc/init.d/${service} echo -e ${service} "\033[32mclean\033[0m" fi done if [ -d "${servicePath}/php" ]; then rm -rf ${servicePath}/php fi if [ -d "${servicePath}/nvm" ]; then rm -rf ${servicePath}/nvm fi if [ -d "${servicePath}/phpmyadmin" ]; then rm -rf ${servicePath}/phpmyadmin fi if [ -f /opt/gitlab/embedded/service/gitlab-rails/Gemfile ];then gitlab-ctl stop yum remove gitlab-ce -y rm -rf /opt/gitlab rm -rf /var/opt/gitlab rm -rf /etc/gitlab rm -rf /www/server/panel/plugin/gitlab fi}Remove_Rpm(){ echo -e "查询已安装rpm包.." echo -e "Find installed packages" for lib in libiconv-1.14 libmcrypt-2.5.8 mcrypt-2.6.8 mhash-0.9.9.9 bt-mysql bt-httpd bt-mariadb bt-php-5.2 bt-php-5.3 bt-php-5.4 bt-php-5.5 bt-php-5.6 bt-php-7.0 bt-php-7.1 do rpm -qa |grep ${lib} > ${lib}.pl libRpm=`cat ${lib}.pl` if [ "${libRpm}" != "" ]; then rpm -e ${libRpm} --nodeps > /dev/null 2>&1 echo -e ${lib} "\033[32mclean\033[0m" fi rm -f ${lib}.pl done echo -e "清理完毕" echo -e "Clean over"} Remove_Data(){ rm -rf /www/server/data rm -rf /www/wwwlogs rm -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_Service if [ -f "/usr/bin/yum" ] & [ -f "/usr/bin/rpm" ]; then Remove_Rpm fi Remove_Bt ;; *) Remove_Bt ;;esac rm -f bt-uninstall.sh |
效果如下:
好了,这样就把宝塔面板卸载了,不过最好的方法还是重装安装系统,才是最干净的。
原文:https://www.laozuo.org/13544.html
猜你可能想看的VPS
- CenterHop→$1.5 月 256MB 内存 5GB SSD 空间虚拟空间(主机)
- 韩国 CN2 $59.5 月 E5-2450L*2 32G 内存 1T 韩国VPS[主机]
- 2020 年 Vultr 最新优惠活动→新用户注册送 50 美元 做任务全球[VPS测评]
- PHP 获取上周所有日期 PHP 获取当前时间前一周七天具体日期全球[VPS测评]
- NecoVM→199 元 年 128MB 内存 4GB 空间 500GB虚拟空间(主机)
- 靠谱商家 flipperhost→$99 年 洛杉矶高配 VPS KV全球[VPS测评]
- Linux 中文乱码的解决办法全球[VPS测评]
- CloudCone→$14 年 512MB 内存 15GB 空间 2TB虚拟空间(主机)
- servaRICA→$15 月 3 核 3GB 内存 2TB 空间 不限虚拟空间(主机)
- ServerStadium→$13.5 月-Dual L5420 16G全球[VPS测评]
- WordPress搜索插件:Ivory Search全球[VPS测评]
- AlphaVPS保加利亚便宜服务器,E5处理器,月付39欧元;AMD E全球[VPS测评]
- 如何检查便宜独立服务器上的硬盘是否已经损坏或者有坏道?独立服务器[U]
- Cubecloud → 香港CN2 GIA 美西CN2 GIA 美西48香港VPS[主机]
- HKServerSolution → 4G内存 50G SSD 100M全球[VPS测评]
- 8K超高清记录中国空间站凌月:天和核心舱与问天实验舱组成“土”字结构虚拟空间(主机)
- HTML5绿色有机食品电商网站模板 - Organtio全球[VPS测评]
- 外贸无界烟台市有多少跨境电商?烟台跨境电商开发平台,烟台跨境电商选品全球[VPS测评]
- 腾讯云香港轻量应用服务器 优惠活动最低月付仅24元香港VPS[主机]
- 好朋友51WORLD启动“地球克隆计划5”,我要去元宇宙参加了全球[VPS测评]
- 空空云怎么样?香港CN2-GIA VPS,带宽2M,月付15元香港VPS[主机]
- 极客主机,优惠8折充值返25%,香港CN2VPS,日本软银VPS,新加坡日本VPS[主机]
- 八成企业看好出海投资 防止“溺水”需重视这一点全球[VPS测评]
- RFCHost:1核1G洛杉矶vps/15GB空间/1TB流量/KVM/虚拟空间(主机)
- JGKVM:1核/512M/30G/600G/30Mbps/洛杉矶CN2全球[VPS测评]
- 一篇漫画,看懂云计算全球[VPS测评]
- GigsGigsCloud:2核/4GB/50G空间/1TB流量/10M虚拟空间(主机)
- 腾讯云免备案海外服务器:高速网络免备案,助力企业出海!全球[VPS测评]
- 阿里云香港服务器多少钱一年?香港阿里云服务器价格表香港VPS[主机]
- 云米科技:新春欢庆,香港云服务器/美国高防vps服务器全场八折,支持按天美国VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-31114.html











