Make minimal OS

JustinJustin Moderator
edited September 22 in Performance and Security
In order to make standard OpenVZ OS image minimal you need to follow this instruction:

1. Install standard OS from the client area
2. Login to the VPS SSH and execute one of the following commands (depending on your OS):

CentOS 6 64-bit

yum remove acl apr apr-util apr-util-ldap aspell attr authconfig avahi-libs bind bind-libs bzip2 centos-indexhtml cronie cronie-noanacron crontabs cups-libs cvs cyrus-sasl dhclient dhcp-common elfutils fetchmail finger finger-server ftp gettext gnutls gpg-pubkey-c105b9de gpm-libs hesiod httpd httpd-tools iptables-ipv6 jwhois libcap-ng libgomp libgssglue libjpeg-turbo libpcap libpng libtalloc libtdb libtevent libtiff libtirpc lm_sensors-libs lsof lynx m4 mailcap mailx man man-pages mlocate ncompress net-snmp net-snmp-libs net-snmp-utils newt newt-python nscd ntsysv perl perl-Module-Pluggable perl-Pod-Escapes perl-Pod-Simple perl-libs perl-version portreserve procmail rpcbind rsync samba-client samba-common samba-winbind samba-winbind-clients screen sendmail sendmail-cf setuptool slang stunnel sudo talk talk-server tcpdump tcsh telnet time traceroute unzip usermode vim-common vim-enhanced which xinetd xz xz-lzma-compat -y; yum clean all

CentOS 7 64-bit

yum remove tcpdump mailx stunnel vim-enhanced vim-filesystem elfutils ntsysv bzip2 lsof traceroute telnet ethtool man-pages libtevent httpd bind-libs-lite apr hunspell apr-util libldb slang libss make libselinux-utils procmail gpm-libs libpcap json-c dhcp-common pytalloc policycoreutils usermode centos-logos cups-libs samba-libs cronie-noanacron libsmbclient cyrus-sasl libpipeline libaio rsyslog sendmail-cf samba-client rpcbind nscd talk-server setuptool screen sudo tcsh fetchmail mailcap hunspell-en ftp attr unzip time talk ncompress bind-license bind-libs libtalloc httpd-tools libtdb bind hunspell-en-US hesiod newt hunspell-en-GB avahi-libs which m4 vim-common finger dhcp-libs newt-python logrotate openssl libwbclient libtirpc samba-common crontabs cronie sendmail libestr man-db xinetd dhclient iptables-services mlocate finger-server rsync authconfig e2fsprogs -y; yum clean all

Debian 7 64-bit

DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apt-utils bind9 bind9-host bind9utils binutils bsd-mailx bsdmainutils bzip2 ca-certificates console-common console-data cracklib-runtime cron db-util db5.1-util debconf-utils debian-keyring dialog expat fetchmail file finger fontconfig fontconfig-config fonts-freefont-ttf ftp gettext groff-base info install-info iputils-arping iputils-tracepath isc-dhcp-client isc-dhcp-common kbd ldap-utils less libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-inst1.5:amd64 libavahi-client3:amd64 libavahi-common-data:amd64 libavahi-common3:amd64 libbind9-80 libcap2:amd64 libcrack2 libcroco3:amd64 libcups2:amd64 libdns88 libfile-copy-recursive-perl libfontconfig1:amd64 libfreetype6:amd64 libgeoip1 libgettextpo0:amd64 libgomp1:amd64 libgssglue1:amd64 libisc84 libisccc80 libisccfg82 liblockfile-bin liblockfile1:amd64 libltdl7:amd64 liblwres80 libmagic1:amd64 libodbc1:amd64 libpaper1:amd64 libpcap0.8:amd64 libperl5.14 libpipeline1:amd64 libpopt0:amd64 libsensors4:amd64 libsnmp-base libsnmp15 libsysfs2:amd64 libtalloc2:amd64 libtdb1:amd64 libtirpc1:amd64 libunistring0:amd64 libwbclient0:amd64 libxml2:amd64 locales-all logrotate lynx lynx-cur m4 make man-db manpages memtester mlocate mtools ncurses-term odbcinst odbcinst1debian2:amd64 openssl openssl-blacklist procmail psutils pwgen rmail rpcbind rsync sasl2-bin screen sendmail sendmail-base sendmail-bin sendmail-cf sendmail-doc sensible-mda sharutils snmp ssl-cert sudo syslinux syslinux-common tcpdump tcsh telnet tofrodos traceroute ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-freefont unixodbc unzip update-inetd uuid-runtime whois wide-dhcpv6-client xinetd; apt-get clean; apt-get remove --purge -y sendmail-base

Debian 8 64-bit

DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" apache2 apache2-bin apache2-data apache2-doc apache2-mpm-prefork apache2-utils apt-utils bind9 bind9-host bind9utils binutils bsd-mailx bsdmainutils bzip2 ca-certificates cifs-utils console-common console-data cracklib-runtime cron db-util db5.3-util debconf-utils dh-python dialog expat fetchmail file finger fontconfig fontconfig-config fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fonts-freefont-ttf ftp gettext groff-base info iputils-arping iputils-tracepath isc-dhcp-client isc-dhcp-common kbd ldap-utils less libapr1:amd64 libaprutil1:amd64 libaprutil1-dbd-sqlite3:amd64 libaprutil1-ldap:amd64 libapt-inst1.5:amd64 libasn1-8-heimdal:amd64 libavahi-client3:amd64 libavahi-common-data:amd64 libavahi-common3:amd64 libbind9-90 libcap-ng0:amd64 libcrack2:amd64 libcroco3:amd64 libcups2:amd64 libdns-export100 libdns100 libfile-copy-recursive-perl libfontconfig1:amd64 libfreetype6:amd64 libgeoip1:amd64 libglib2.0-0:amd64 libgomp1:amd64 libgssapi3-heimdal:amd64 libhcrypto4-heimdal:amd64 libhdb9-heimdal:amd64 libheimbase1-heimdal:amd64 libheimntlm0-heimdal:amd64 libhx509-5-heimdal:amd64 libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 libkdc2-heimdal:amd64 libkrb5-26-heimdal:amd64 libldb1:amd64 liblockfile-bin liblockfile1:amd64 libltdl7:amd64 liblua5.1-0:amd64 liblwres90 libmagic1:amd64 libmpdec2:amd64 libntdb1:amd64 libodbc1:amd64 libpaper1:amd64 libpcap0.8:amd64 libpci3:amd64 libperl5.20 libpipeline1:amd64 libpng12-0:amd64 libpopt0:amd64 libpython2.7:amd64 libpython3-stdlib:amd64 libpython3.4-stdlib:amd64 libroken18-heimdal:amd64 libsensors4:amd64 libsnmp-base libsnmp30:amd64 libtalloc2:amd64 libtdb1:amd64 libtevent0:amd64 libunistring0:amd64 libwbclient0:amd64 libwind0-heimdal:amd64 libxml2:amd64 logrotate lynx lynx-cur m4 make man-db manpages memtester mlocate mtools ncurses-term odbcinst odbcinst1debian2:amd64 openssl openssl-blacklist patch postfix procmail psutils pwgen python-crypto python-dnspython python-ldb python-ntdb python-samba python-talloc python-tdb python3 python3-minimal python3.4 rpcbind rsync samba-common samba-common-bin samba-dsdb-modules samba-libs:amd64 sasl2-bin screen sharutils snmp ssl-cert sudo syslinux tcpdump tcsh tdb-tools telnet tofrodos traceroute ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-freefont unixodbc unzip update-inetd uuid-runtime whois wide-dhcpv6-client xinetd

Ubuntu 12.04 64-bit

DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apt-utils bind9 bind9-host bind9utils binutils bsd-mailx bsdmainutils bzip2 ca-certificates console-common console-data console-tools console-tools-dev cracklib-runtime cron db-util db5.1-util debconf-utils defoma expat fetchmail file finger fontconfig fontconfig-config ftp gettext groff-base info install-info iputils-arping iputils-tracepath isc-dhcp-client isc-dhcp-common klogd ldap-utils less libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-inst1.4 libavahi-client3 libavahi-common-data libavahi-common3 libbind9-80 libcap2 libclass-isa-perl libconsole libcrack2 libcroco3 libcups2 libdb4.8 libdns81 libfile-copy-recursive-perl libfontconfig1 libfreetype6 libgdbm3 libgeoip1 libgettextpo0 libgomp1 libgssglue1 libisc83 libisccc80 libisccfg82 liblockfile-bin liblockfile1 libltdl7 liblwres80 libmagic1 libnewt0.52 libodbc1 libpaper1 libpcap0.8 libperl5.14 libpipeline1 libpopt0 libsensors4 libsnmp-base libsnmp15 libswitch-perl libsysfs2 libtalloc2 libtdb1 libtirpc1 libunistring0 libwbclient0 libxml2 logrotate lynx lynx-cur m4 make man-db manpages memtester mlocate mtools ncurses-term odbcinst odbcinst1debian2 openssl openssl-blacklist perl perl-modules procmail psutils pwgen rmail rpcbind rsync sasl2-bin screen sendmail sendmail-base sendmail-bin sendmail-cf sendmail-doc sensible-mda sharutils snmp ssl-cert sudo sysklogd syslinux syslinux-common tcpdump tcsh telnet tofrodos traceroute ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-freefont unixodbc unzip update-inetd uuid-runtime whiptail whois wide-dhcpv6-client xinetd; apt-get clean

Ubuntu 14.04 64-bit

DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" apache2 apache2-bin apache2-data apache2-doc apache2-mpm-prefork apache2-utils apt-utils bind9 bind9-host bind9utils binutils bsd-mailx bsdmainutils bzip2 ca-certificates console-common console-data console-setup cracklib-runtime cron db-util db5.3-util debconf-utils dialog expat fetchmail file finger fontconfig fontconfig-config fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fonts-freefont-ttf ftp gettext groff-base info iputils-arping iputils-tracepath isc-dhcp-client isc-dhcp-common kbd keyboard-configuration ldap-utils less libapr1:amd64 libaprutil1:amd64 libaprutil1-dbd-sqlite3:amd64 libaprutil1-ldap:amd64 libapt-inst1.5:amd64 libavahi-client3:amd64 libavahi-common-data:amd64 libavahi-common3:amd64 libbind9-90 libbsd0:amd64 libcrack2:amd64 libcroco3:amd64 libcups2:amd64 libdns100 libfile-copy-recursive-perl libfontconfig1:amd64 libfreetype6:amd64 libgeoip1:amd64 libglib2.0-0:amd64 libgmp10:amd64 libgomp1:amd64 libgssglue1:amd64 libhdb9-heimdal:amd64 libisc95 libisccc90 libisccfg90 libkdc2-heimdal:amd64 libldb1:amd64 liblockfile-bin liblockfile1:amd64 libltdl7:amd64 liblwres90 libmagic1:amd64 libntdb1:amd64 libodbc1:amd64 libpaper1:amd64 libpcap0.8:amd64 libperl5.18 libpipeline1:amd64 libpopt0:amd64 libpython-stdlib:amd64 libsensors4:amd64 libsnmp-base libsnmp30:amd64 libtalloc2:amd64 libtdb1:amd64 libtevent0:amd64 libtirpc1:amd64 libunistring0:amd64 libwbclient0:amd64 libxml2:amd64 logrotate lynx lynx-cur m4 make man-db manpages memtester mlocate mtools ncurses-term odbcinst odbcinst1debian2:amd64 openssl openssl-blacklist postfix procmail psutils pwgen python python-crypto python-dnspython python-ldb python-minimal python-ntdb python-talloc python-tdb python2.7 python2.7-minimal rpcbind rsync sasl2-bin screen sharutils snmp ssl-cert sudo syslinux syslinux-common tcpdump tcsh tdb-tools telnet tofrodos traceroute ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-freefont unixodbc unzip update-inetd uuid-runtime whois wide-dhcpv6-client xinetd xkb-data; apt-get clean

Ubuntu 15.04 64-bit

DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" apache2 apache2-bin apache2-data apache2-doc apache2-mpm-prefork apache2-utils apt-utils bind9 bind9-host bind9utils binutils bsd-mailx bsdmainutils bsdutils bzip2 ca-certificates cifs-utils console-common console-data console-setup console-setup-linux cracklib-runtime cron db-util db5.3-util debconf-utils dialog expat fetchmail file finger fontconfig fontconfig-config fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fonts-freefont-ttf ftp gettext groff-base info iputils-arping iputils-tracepath isc-dhcp-client isc-dhcp-common kbd keyboard-configuration ldap-utils less libapr1:amd64 libaprutil1:amd64 libaprutil1-dbd-sqlite3:amd64 libaprutil1-ldap:amd64 libapt-inst1.5:amd64 libavahi-client3:amd64 libavahi-common-data:amd64 libavahi-common3:amd64 libbind9-90 libbsd0:amd64 libcrack2:amd64 libcroco3:amd64 libcups2:amd64 libdns-export100 libdns100 libfile-copy-recursive-perl libfontconfig1:amd64 libfreetype6:amd64 libgeoip1:amd64 libglib2.0-0:amd64 libgomp1:amd64 libhdb9-heimdal:amd64 libicu52:amd64 libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 libkdc2-heimdal:amd64 libldb1:amd64 liblockfile-bin liblockfile1:amd64 libltdl7:amd64 liblua5.1-0:amd64 liblwres90 libmagic1:amd64 libntdb1:amd64 libodbc1:amd64 libpaper1:amd64 libpcap0.8:amd64 libperl5.20 libpipeline1:amd64 libpopt0:amd64 libpython-stdlib:amd64 libsensors4:amd64 libsnmp-base libsnmp30:amd64 libtalloc2:amd64 libtdb1:amd64 libtevent0:amd64 libtirpc1:amd64 libunistring0:amd64 libwbclient0:amd64 libxml2:amd64 logrotate lynx lynx-cur m4 make man-db manpages memtester mlocate mtools ncurses-term odbcinst odbcinst1debian2:amd64 openssl openssl-blacklist patch postfix procmail psutils pwgen python python-crypto python-dnspython python-ldb python-minimal python-ntdb python-samba python-talloc python-tdb python2.7 python2.7-minimal rpcbind rsync samba-common samba-common-bin samba-dsdb-modules samba-libs:amd64 sasl2-bin screen sharutils snmp ssl-cert sudo syslinux tcpdump tcsh tdb-tools telnet tofrodos traceroute ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-freefont unixodbc unzip update-inetd uuid-runtime whois wide-dhcpv6-client xinetd xkb-data

Ubuntu 16.04 64-bit

DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" apache2 apache2-bin apache2-data apache2-doc apache2-utils bind9 bind9-host bind9utils libbind9-140 bind9-host bind9utils binutils bsd-mailx bsdmainutils bzip2 ca-certificates console-data cracklib-runtime cron db-util db5.3-util debconf-utils dialog expat libexpat1 fetchmail file libfile-copy-recursive-perl liblockfile-bin liblockfile1 finger fontconfig fontconfig-config libfontconfig1 fontconfig-config fonts-dejavu fonts-dejavu-core fonts-dejavu-extra fonts-dejavu-core fonts-dejavu-extra fonts-freefont-ttf ftp gettext gettext-base liblocale-gettext-perl groff-base distro-info-data info install-info procinfo iputils-arping iputils-tracepath isc-dhcp-client isc-dhcp-common ldap-utils less libfile-copy-recursive-perl liblockfile-bin libsnmp-base logrotate lynx lynx-common m4 make makedev man-db manpages memtester mlocate mtools odbcinst odbcinst1debian2 libgnutls-openssl27 openssl openssl-blacklist openssl-blacklist postfix procmail psutils pwgen dh-python libpython-stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib libpython3-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib python python-crypto python-dnspython python-ldb python-minimal python-samba python-talloc python-tdb python2.7 python2.7-minimal python3 python3-minimal python3.5 python3.5-minimal python-crypto python-dnspython python-ldb python-minimal python-talloc python-tdb libpython2.7 libpython2.7-minimal libpython2.7-stdlib python2.7 python2.7-minimal libpython2.7-minimal python2.7-minimal rpcbind rsync sasl2-bin screen sharutils libsnmp-base libsnmp30 snmp ssl-cert sudo syslinux tcpdump tcsh tdb-tools telnet tofrodos traceroute ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-dejavu-core ttf-dejavu-extra ttf-freefont unixodbc unzip update-inetd uuid-runtime whois wide-dhcpv6-client xinetd; apt-get clean

openSuse 13.1 64-bit

for i in SuSEfirewall2* aaa_base* adjtimex* apache2* aspell* autoyast2* bind* binutils* branding* bundle* ca* cantarell* checkmedia* cifs* command* cryptsetup* cups* curl* dconf* dhcp* dmraid* fetchmail* finger* fontconfig* gd* ghostscript* gio* glib* glib2* groff* gsettings* hwinfo* initviocons* keyutils* kpartx* less* libICE6* libSM6* libX11* libXau6* libXext6* libXmuu1* libXpm4* libXt6* libaio1* libapr* libapr1* libarchive13* libaspell15* libavahi* libdcerpc* libdcerpc0* libdconf1* libelf0* libenca0* libevent* libfam0* libffi4* libfreetype6* libgdbm4* libgensec0* libgio* libglib* libgmodule* libgnutls28* libgobject* libguess1-1.1-2.1.2.x86_64* libhogweed2* libicu51_2* libjasper1* libjavascriptcoregtk* libjbig2* libjpeg8* libldapcpp1* libldb1* liblua5_2* libmowgli2* libmysqlclient18* libndr* libndr0* libnetapi0* libnetpbm11* libnettle4* libp11* libparted0* libpcap1* libpci3* libpdb0* libpipeline1* libpng16* libpython2_7* librcc0* librcd0* libregistry0* libreiserfs* libsamba* libsamdb0* libsensors4* libsmbclient* libsmbclient0* libsmbconf0* libsmbldap0* libsmi* libsmi2* libsnmp30* libsoup* libsqlite3* libstorage* libstorage4* libtalloc2* libtasn1* libtdb1* libtevent* libtevent0* libtiff5* libtirpc1* libtranslate0* libwbclient0* libx86emu1* libxcb1* libyaml* libyui* libyui5* lsscsi* lvm2* lynx* m4* mailx* make* man* mdadm* mlocate* module* mtools* multipath* ncftp* ncurses* netcfg* netpbm* nfs* nfsidmap* openSUSE* openslp* p11* parted* pciutils* pkg* procmail* psmisc* psutils* pytalloc* python* rcc* release* rpcbind* rsync* ruby* ruby20* rubygem* samba* scout* screen* sendmail* shared* sharutils* snmp* sudo* syslinux* tcpdump* tcsh* telnet* time* timezone* traceroute* unzip* vim* wallpaper* which* words* xauth* xdg* xinetd* xli* yast2*; do zypper --non-interactive remove -n $i; done; zypper cc --all

3. Restart VPS

Note: Some operating systems (openSuse 13.01 and CentOS 7) will require you to wait for upgrade process finish in order to execute OS minimalization command.
Sign In or Register to comment.