Raspberry Pi system uninstall desktop environment and system slimming

When we first started using the Raspberry Pi, we used a system with a desktop environment. The system comes with a lot of useful software. After studying and using it for a period of time, I found that the desktop environment is no longer used. It interacts through sshremote tools and operates the system in the form of commands.

After the Raspbian system is started, it will occupy about 500-600MB of memory resources. When the desktop environment is uninstalled, these resources will be completely released. These resources include CPU, memory and disk space. After uninstalling, the system will release about 300-400MB of memory. When the pure desktop system starts, it will only occupy about 150M of memory resources and a small amount of CPU and hard disk space. .

Precautions

Please back up important data before any operation to prevent data loss. If you are not sure how to do this or have any questions, please seek professional help.

In addition, uninstalling the desktop environment may make the system more stable and secure, because the desktop environment may install some unnecessary programs and services that may run in the background and consume system resources. By uninstalling the desktop environment, you can remove these programs and services and reduce the load on your system.

uninstall desktop

  1. Log in to the Raspberry Pi operating system through the ssh client, or you can directly enter the following command in cmd to log in
ssh pi@树莓派IP地址
  1. Uninstall all packages that depend on libx11

The desktop environment installed on the Raspberry Pi depends on it libx11, so we need to delete all libx11associated packages by typing the following command.

sudo apt-get remove --auto-remove --purge 'libx11-.*'
  1. remove any unnecessary packages
sudo apt-get autoremove --purge
  1. clear package cache
sudo apt-get autoclean
  1. View memory usage

We can type the following command to view the memory usage, and we can see that the memory usage has decreased.

free -m

Clean up other services

I installed the Docker service before and ran several containers, so I found that the memory usage rate remained at around 300-400M. Since docker is no longer used on the Raspberry Pi, it can also be uninstalled together to fully utilize the memory resources. let go.

  • remove docker command

  • remove docker command

# 列出所有运行中容器
sudo docker ps
# 停用容器,ID请复制上面命令列出的容器ID
sudo docker stop 容器ID
# 删除所有已停用的容器
sudo docker rm 容器ID
# 列出所有容器镜像
sudo docker images
# 删除镜像
sudo docker rmi 镜像ID
# 卸载Docker
sudo apt remove docker.io

The Docker service itself occupies about 50M and more than 150M of container resources. After the uninstallation is completed, the system only uses about 170M of memory resources. So far, the Raspberry Pi system has been slimmed down.

insert image description here

Supongo que te gusta

Origin blog.csdn.net/no1xium/article/details/131231812
Recomendado
Clasificación