瘦身 SD 卡終極大魔王版

本學期的最後一個目標啦!!

要把系統縮小到 150MB 以下

那麼就,開始吧!!!

現行網頁伺服器占用容量比較

網頁伺服器名稱安裝完容量
webfs371 KB
lighttpd48.1 MB
nginx53.3 MB
apache90.9 MB

快速導覽

STARTO!

進入 root 權限

su -

進入 eecs/virtualarm 資料夾

cd ~eecs/virtualarm

先將原本可以開機的 rootfs 改個名稱

mv rootfs rootfs.orig

備份一份原本的

# cp -a rootfs.orig/ rootfs

change root 進入 rootfs

chroot rootfs/ /bin/bash

然後執行套件更新

apt-get update

將 apache2 刪除掉

apt-get autoremove apache2 -y

再將 perl 移除

apt-get purge apache2 -y
apt-get autoremove perl -y
apt-get purge perl -y

安裝新的網頁伺服器

apt-get install webfs -y

修改網頁伺服器設定

nano /etc/webfsd.conf

將 web_index 改為 index.html

# index file for directories (default: none, webfsd will send listings)
web_index="index.html"

到 /usr 目錄查看

cd /usr
du -sh *

進入 share 目錄查看

cd share
du -sh * | grep M

進入 doc/apt 目錄查看

cd doc/apt

附註:查看文字壓縮檔

zcat xxx.bz

/usr/share/doc 目錄 (殺一個目錄要考慮這兩件事情)

  1. 使用者會不會用到?
  2. 砍了之後會不會影響到系統?

在 /usr/share/doc 底下刪除所有檔案

cd /usr/share/doc
rm -rf *

進入 /usr/share/locale 目錄

cd /usr/share/locale

刪除這個目錄的語系設定檔

rm -rf *

進入 /usr/share/man 目錄

cd /usr/share/man

刪除這個目錄裡面的說明檔案

rm -rf *

進入 /usr/share/zoneinfo 目錄

cd /usr/share/zoneinfo

刪除所有檔案

rm -rf *

按照 虛擬SD卡整合 PART II 的步驟清除  /var/lib/apt/lists 底下的檔案以及 apt-get clean

將 sdcard2.img 掛上系統

使用 自動化腳本整理 的腳本

sh Connect_SDImage.sh -n sdcard2.img
sh Mount_SDImage.sh

將修改後的 rootfs 重新複製到 /mnt/sdcard2

rsync -av rootfs/ /mnt/sdcard2 --delete
SHXJ
Latest posts by SHXJ (see all)

發佈留言