麒麟系统瘦身

版权声明:本文为博主原创文章,转载请注明出处。

前言

近期在完成项目部署的过程中,遇到了一台特殊设备。该设备在安装Ubuntu Server系统后,无法驱动网卡;经过一番分析,发现是Linux内核没有集成相关驱动。

不过由于麒麟系统是由Ubuntu衍生的,用来部署项目也不是不可,但要用桌面系统来部署项目,就得精简一下了。

禁用KYSEC

KYSEC是麒麟系统的安全防护模块,会在启动程序时进行拦截,一定程度上会降低系统性能,禁用之。

修改文件/etc/default/grub,将GRUB_CMDLINE_LINUX_DEFAULT中的security=kysec修改为security=即可。

命令方式

1
sed -i 's/security=kysec/security= /g' /etc/default/grub
  • 执行以下命令以更新引导
1
2
3
4
# 标记为手动安装,否则后续自动卸载依赖会导致出错
apt install archdetect-deb
setstatus disable
update-grub
  • 在完成后续操作后,重启即可

卸载常驻服务

1
apt purge -y samba xrdp cups-daemon xl2tpd

卸载桌面环境

  • 可选操作:卸载麒麟全家桶(除apt所依赖的kylin-keyring)
1
apt purge -y kylin-activation kylin-background-upgrade kylin-burner kylin-ca-certificates kylin-calculator kylin-camera kylin-display-switch kylin-fonts kylin-installer kylin-ipmsg kylin-kmre-daemon kylin-kmre-display-control kylin-kmre-image-data kylin-kmre-manager kylin-kmre-window kylin-log-viewer kylin-music kylin-nm kylin-photo-viewer kylin-printer kylin-recorder kylin-scanner kylin-screenshot kylin-service-support kylin-signtool kylin-software-center kylin-software-properties kylin-sso-client kylin-update-desktop-config kylin-update-desktop-security-database kylin-update-manager kylin-usb-creator kylin-user-guide-common kylin-user-guide kylin-verify-gui kylin-verify kylin-video kylin-xinput-calibrator
  • 卸载国产特色软件(需要手动清扫/opt
1
apt purge -y browser360-cn-stable wps-office sc-reader sogouimebs aurora.a3-mfp browser360-cn-stable certaide-kylin hplip
  • 卸载桌面管理器
1
2
apt-get purge -y lightdm ukui*
apt autoremove -y
  • 配置SystemD
1
2
systemctl set-default multi-user.target
systemctl isolate multi-user.target

汇总

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
setstatus disable
sed -i 's/security=kysec/security= /g' /etc/default/grub
apt install -y archdetect-deb
update-grub

apt purge -y samba xrdp cups-daemon xl2tpd
apt purge -y kylin-activation kylin-background-upgrade kylin-burner kylin-ca-certificates kylin-calculator kylin-camera kylin-display-switch kylin-fonts kylin-installer kylin-ipmsg kylin-kmre-daemon kylin-kmre-display-control kylin-kmre-image-data kylin-kmre-manager kylin-kmre-window kylin-log-viewer kylin-music kylin-nm kylin-photo-viewer kylin-printer kylin-recorder kylin-scanner kylin-screenshot kylin-service-support kylin-signtool kylin-software-center kylin-software-properties kylin-sso-client kylin-update-desktop-config kylin-update-desktop-security-database kylin-update-manager kylin-usb-creator kylin-user-guide-common kylin-user-guide kylin-verify-gui kylin-verify kylin-video kylin-xinput-calibrator
apt purge -y browser360-cn-stable wps-office sc-reader sogouimebs aurora.a3-mfp browser360-cn-stable certaide-kylin hplip
apt-get purge -y lightdm ukui*
apt autoremove -y

systemctl set-default multi-user.target
systemctl isolate multi-user.target

reboot

Comments