雖然現在咱們選擇服務器資源都比較多,之前咱們看到不少128MB內存、甚至32MB內存的建站網站,感受特別羨慕。其實這些也不是難事,相比之下,DEBIAN系統比CENTOS系統佔用資源少,而後咱們須要進行內存優化處理,刪除沒必要要的組件,這樣又能夠節省一些資源。這裏我找到幾個減小資源的方式,若是咱們須要節省沒必要要的組件的時候能夠用到。html
第1、一鍵刪除無用組件python
apt-get update -y && apt-get upgrade -y
apt-get -y purge apache2-* bind9-* xinetd samba-* nscd-* portmap sendmail-* sasl2-bin
apt-get -y purge lynx memtester unixodbc python-* odbcinst-* sudo tcpdump ttf-*
apt-get autoremove && apt-get cleanlinux
第2、清理opera firefox的緩存文件apache
ls ~/.opera/cache4
ls ~/.mozilla/firefox/*.default/Cache
第3、清理Linux下孤立的包:
圖形界面下咱們能夠用:gtkorphan
sudo apt-get install gtkorphan -y
終端命令下咱們能夠用:deborphan
sudo apt-get install deborphan -y
第4、卸載:tracker
這個東西通常我只要安裝Ubuntu就會第一刪掉tracker 他不只會產生大量的cache文件並且還會影響開機速度。因此在新得利裏面刪掉就行。 www.2cto.com
第5、刪除多餘的內核:必定不要刪錯哦,切記!!
打開終端敲命令:dpkg --get-selections|grep linux
有image的就是內核文件
刪除老的內核文件:
sudo apt-get remove 內核文件名(例如:linux-image-2.6.27-2-generic)
內核刪除,釋放空間了,應該能釋放130-140M空間。
這樣,咱們再去安裝須要的系統軟件,能夠減小資源佔用。
以上文章參考: