海纳思HINAS系统一键删除预装软件

经过自行研究海纳思系统预装的软件,经过多番尝试,创建sh脚本,将所附代码(有两套)复制后,执行即可。

第一步 创建一键删除预装软件的脚本

通过【页面终端】或者 ssh ,使用 root 用户登录到海纳思系统,创建 del.sh 文件:

root@hi3798mv100:~# vim del.sh

第二步 根据需要,在以下两种脚本中选择一个,进行复制

第一种:仅保留 页面终端 ttyd 预装软件,因为感觉还是很方便。请复制下面这些代码。

#!/bin/bash

echo 正在卸载预装软件
#Alist
systemctl stop alist*
sudo apt-get autoremove alist* -y
sudo find / -name "alist" |xargs rm -rf

#PHP
systemctl stop php*
sudo apt-get autoremove php* -y
sudo apt-get autoremove php7* -y
sudo find / -name "php" |xargs rm -rf

#Nginx
systemctl stop nginx*
sudo apt-get autoremove nginx* -y
sudo find / -name "nginx" |xargs rm -rf
rm -rf /var/www
rm -rf /etc/first_init.d/web.sh
rm -rf /usr/share/bak/gitweb
rm -rf /bin/install-gitweb.sh

#Aria2
systemctl stop aria*
sudo apt-get autoremove aria2 -y
sudo find / -name "aria2" |xargs rm -rf

#Transmission
systemctl stop transmission*
apt-get autoremove transmission* -y
sudo find / -name "transmission" |xargs rm -rf


#KMS
systemctl stop vlmcsd
sudo find / -name "vlmcsd" |xargs rm -rf

#FRP
systemctl stop frpc.service
sudo find / -name "frp" |xargs rm -rf

#NFS
apt-get autoremove nfs* -y

#FTP
systemctl stop vsftpd
apt-get autoremove vsftpd -y
sudo find / -name "vsftpd" |xargs rm -rf

#smbd
systemctl stop smbd*
apt-get remove --purge samba -y
sudo find / -name "samba" |xargs rm -rf
rm -rf /usr/share/samba

#tailscale
systemctl stop tailscale*
rm -rf /opt/tailscale
sudo find / -name "tailscale*" |xargs rm -rf

#filebrowser
systemctl stop filebrows*
sudo find / -name "filebrowse*" |xargs rm -rf

#易有云
systemctl stop com.linkease.linkeasedaemon.service
sudo find / -name "linkeas*" |xargs rm -rf

echo 预装软件卸载完毕

第二种:删除所有内置软件的代码

#!/bin/bash

echo 正在卸载预装软件
#Alist
systemctl stop alist*
sudo apt-get autoremove alist* -y
sudo find / -name "alist" |xargs rm -rf

#PHP
systemctl stop php*
sudo apt-get autoremove php* -y
sudo apt-get autoremove php7* -y
sudo find / -name "php" |xargs rm -rf

#Nginx
systemctl stop nginx*
sudo apt-get autoremove nginx* -y
sudo find / -name "nginx" |xargs rm -rf
rm -rf /var/www
rm -rf /etc/first_init.d/web.sh
rm -rf /usr/share/bak/gitweb
rm -rf /bin/install-gitweb.sh

#Aria2
systemctl stop aria*
sudo apt-get autoremove aria2 -y
sudo find / -name "aria2" |xargs rm -rf

#Transmission
systemctl stop transmission*
apt-get autoremove transmission* -y
sudo find / -name "transmission" |xargs rm -rf

#页面终端
systemctl stop ttyd.service
sudo find / -name "ttyd" |xargs rm -rf

#KMS
systemctl stop vlmcsd
sudo find / -name "vlmcsd" |xargs rm -rf

#FRP
systemctl stop frpc.service
sudo find / -name "frp" |xargs rm -rf

#NFS
apt-get autoremove nfs* -y

#FTP
systemctl stop vsftpd
apt-get autoremove vsftpd -y
sudo find / -name "vsftpd" |xargs rm -rf

#smbd
systemctl stop smbd*
apt-get remove --purge samba -y
sudo find / -name "samba" |xargs rm -rf
rm -rf /usr/share/samba

#tailscale
systemctl stop tailscale*
rm -rf /opt/tailscale
sudo find / -name "tailscale*" |xargs rm -rf

#filebrowser
systemctl stop filebrows*
sudo find / -name "filebrowse*" |xargs rm -rf

#易有云
systemctl stop com.linkease.linkeasedaemon.service
sudo find / -name "linkeas*" |xargs rm -rf

echo 预装软件卸载完毕

第三步 保存并退出 vim 

按 ESC 并使用英文输入法 shift,并输入 wq

第四步 查看文件,并增加执行权限

root@hi3798mv100:~# ll
total 40
drwx------  4 root root 4096 Nov  9 18:18 ./
drwxr-xr-x 18 root root 4096 Mar 28  2023 ../
-rw-------  1 root root   22 Nov  9 18:09 .bash_history
-rw-r--r--  1 root root 3106 Dec  5  2019 .bashrc
drwx------  2 root root 4096 Nov  9 18:07 .cache/
drwxr-xr-x  3 root root 4096 Aug 18 13:26 .config/
-rw-r--r--  1 root root 1440 Nov  9 18:18 del.sh
-rw-r--r--  1 root root  161 Dec  5  2019 .profile
-rw-------  1 root root 1247 Nov  9 18:18 .viminfo
-rw-r--r--  1 root root  166 Aug 18 13:26 .wget-hsts
root@hi3798mv100:~# chmod +x del.sh 
root@hi3798mv100:~# ll
total 40
drwx------  4 root root 4096 Nov  9 18:18 ./
drwxr-xr-x 18 root root 4096 Mar 28  2023 ../
-rw-------  1 root root   22 Nov  9 18:09 .bash_history
-rw-r--r--  1 root root 3106 Dec  5  2019 .bashrc
drwx------  2 root root 4096 Nov  9 18:07 .cache/
drwxr-xr-x  3 root root 4096 Aug 18 13:26 .config/
-rwxr-xr-x  1 root root 1440 Nov  9 18:18 del.sh*
-rw-r--r--  1 root root  161 Dec  5  2019 .profile
-rw-------  1 root root 1247 Nov  9 18:18 .viminfo
-rw-r--r--  1 root root  166 Aug 18 13:26 .wget-hsts
root@hi3798mv100:~# 

第五步 执行一键删除预装软件脚本

root@hi3798mv100:~# ./del.sh 

执行完毕后,你会看到 【预装软件卸载完毕】