amuck-landowner

Cleanup your OpenVZ Ubuntu image

wlanboy

Content Contributer
Whenever I have to install a new vps I get rid of a lot of "default services" which are installed with enabled autorun.

If anyone want to add anything feel free to add a comment.

  1. Get rid of apache, sendmail, bind and nmbd

    sudo su
    service apache2 stop
    service sendmail stop
    service bind9 stop
    service nmbd stop

    update-rc.d apache2 disable
    update-rc.d sendmail disable
    update-rc.d bind9 disable
    update-rc.d nmbd disable

    apt-get remove sendmail bind9 apache2 apache2-doc apache2-mpm-prefork apache2.2-bin \
    apache2.2-common samba
    apt-get autoremove && apt-get clean && apt-get autoclean

    PS: Yes I use apache2-utils to create/manage my password files.
     
  2. Disable avahi daemon
    Code:
    sudo nano /etc/default/avahi-daemon
    
    change line "AVAHI_DAEMON_START = 1" to "AVAHI_DAEMON_START = 0"
 

SeriesN

Active Member
Verified Provider
Don't your provider offers minimal OVZ templates with Core system files only?
 

wlanboy

Content Contributer
Not all. You can only choose between 32bit and 64bit.

Even recursion was not turned off in named.conf.
 

365Networks

New Member
These are few of the many useless services that are tacked onto the images, good list and I'm sure once I remember some more I'll post them, I know CentOS has too many to count. :p
 

TruvisT

Server Management Specialist
Verified Provider
These are few of the many useless services that are tacked onto the images, good list and I'm sure once I remember some more I'll post them, I know CentOS has too many to count. :p

So true. This is why I use minimal or netinstall images.
 

Sajan P

New Member
Verified Provider
Why don't you like sendmail?  I see sendmail as pretty necessary.  What happens if my server gets lonely and wants to send me an email?
 

wlanboy

Content Contributer
No, I do use Ubuntu. It is easier for my head to run Ubuntu on all my pcs, laptops and servers.
 

drmike

100% Tier-1 Gogent
Lots of providers do not have the minimal installs.   I hate the extra dance steps always to clean up the installs.

Good info here for folks new to VPS world.

Heck had one provider tell me I didn't need the Debian x64 that the 32 version wasn't any different. Mileage will vary with providers.
 

mikho

Not to be taken seriously, ever!
I always use minstall on my VPS since there is module to clean unwanted services/applications.


Being developed for Debian it should work with ubuntu as well. Perhaps there are some things different between the two distros that won't work. If so, please enlighten me. :)
 

Tux

DigitialOcean? lel
Virtually every provider I've used have provided minimal Debian images.

I should be thankful.
 

nunim

VPS Junkie
apt-get remove samba* sendmail* apache* bind9* sasl* | reboot

Works in 9/10 cases for me.  
 

herbyscrub

New Member
Can you remove /usr/share/doc without causing huge problems?  Also...is there a way to clean up /usr/share/locale?

I've got a EDIS 1GB KVM starving for diskspace.
 
Last edited by a moderator:

mojeda

New Member
apt-get remove apache2* would remove absolutely any apache2 package installed with just one listed.
 

wlanboy

Content Contributer
Can you remove /usr/share/doc without causing huge problems?  Also...is there a way to clean up /usr/share/locale?

I've got a EDIS 1GB KVM starving for diskspace.
Can you please show us the content of the file: bigfolders.txt? Created by following command:

Code:
du -x / | sort -rn > bigfolders.txt
 

herbyscrub

New Member
Can you please show us the content of the file: bigfolders.txt? Created by following command:

Code:
du -x / | sort -rn > bigfolders.txt
Code:
709M    /
347M    /usr
190M    /var
102M    /lib
37M     /root
20K     /home
19M     /boot
16K     /lost+found
8.0K    /media
6.0M    /bin
5.3M    /sbin
4.7M    /etc
4.0K    /tmp
4.0K    /srv
4.0K    /selinux
4.0K    /opt
4.0K    /mnt
0       /sys
0       /run
0       /proc
0       /dev
lolsex@ns1:~# df -h
Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                  887M  726M  117M  87% /
Code:
lolsex@ns1:/usr# du /usr/share/ | sort -rh
214M    /usr/share/
63M     /usr/share/locale
26M     /usr/share/vim
24M     /usr/share/doc
20M     /usr/share/perl
13M     /usr/share/i18n
11M     /usr/share/man
7.9M    /usr/share/ssh
6.5M    /usr/share/terminfo
 

wlanboy

Content Contributer
Thank you. So It is about locale and doc.


sudo apt-get install localepurge

After installing anything with apt-get localepurge will remove all translation files and translated manpages in languages you cannot read.

You can configure it with following file:


vi /etc/locale.nopurge

Just call it with "localepurge".

PS:
Sort installed packages by size:

Code:
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
 
Last edited by a moderator:
Top
amuck-landowner