On 64 bit with or without ipv6 digitalocean 512 ram cant install- Error

root@Kangarooo16:~# wget http://software.virtualmin.com/gpl/scripts/install.sh -O /root/virtualmin-install.sh
–2016-11-04 05:42:50-- http://software.virtualmin.com/gpl/scripts/install.sh
Resolving software.virtualmin.com (software.virtualmin.com)… 108.60.199.117
Connecting to software.virtualmin.com (software.virtualmin.com)|108.60.199.117|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 48932 (48K) [application/x-sh]
Saving to: ‘/root/virtualmin-install.sh’

/root/virtualmin-in 100%[===================>] 47.79K 190KB/s in 0.3s

2016-11-04 05:42:50 (190 KB/s) - ‘/root/virtualmin-install.sh’ saved [48932/48932]

root@Kangarooo16:~# sh /root/virtualmin-install.sh
Checking for Perl
found Perl at /usr/bin/perl

Welcome to the Virtualmin GPL installer, version 1.1.4

WARNING:

The installation is quite stable and functional when run on a freshly
installed supported Operating System.

If you have existing websites, email users, or if you manually installed
Virtualmin via a Webmin ‘wbm’ module, you are likely to run into problems.
Please read the Virtualmin Administrators Guide before proceeding if
your system is not a freshly installed and supported OS.

This script is not intended to update your system! It should only be
used to perform your initial Virtualmin installation. If you have previously
run the Virtualmin installer, you can perform upgrades and updates from within
Virtualmin itself, or using your system’s package manager. Once Virtualmin is
installed, you never need to run this script again.

The systems currently supported by install.sh are:
CentOS/RHEL/Scientific Linux 7 on x86_64
CentOS and RHEL 5-6 on i386 and x86_64
Scientific Linux 6 on i386 and x86_64
Debian 6, 7, and 8 on i386 and amd64
Ubuntu 12.04 LTS, 14.04, and 16.04 LTS on i386 and amd64
FreeBSD 7.0 and 8 on i386 and amd64

If your OS is not listed above, this script will fail. More details
about the systems supported by the script can be found here:

http://www.virtualmin.com/os-support.html

Continue? (y/n) y
Checking for HTTP client…found /usr/bin/curl -s -O
Checking for perl…found /usr/bin/perl
Loading log4sh logging library…
INFO - Started installation log in /root/virtualmin-install.log
INFO - Checking for fully qualified hostname…
INFO - Hostname Kangarooo16 is not fully qualified.
Please enter a fully qualified hostname (for example, host.example.com): latvijai.lv
INFO - Hostname OK: fully qualified as latvijai.lv
INFO - Primary address detected as 46.101.98.203
INFO - Adding new entry for hostname latvijai.lv on 46.101.98.203 to /etc/hosts.
INFO - Installing serial number and license key into /etc/virtualmin-license
INFO - Loading OS selection library…
INFO - Download of http://software.virtualmin.com/lib/oschooser.pl Succeeded.
INFO - Loading OS list…
INFO - Download of http://software.virtualmin.com/lib/os_list.txt Succeeded.
INFO - Operating system name: Ubuntu Linux
INFO - Operating system version: 16.04.1
INFO - Configuring package manager for Ubuntu Linux 16.04.1…
INFO - Enabling universe repositories, if not already available…
INFO - Disabling cdrom repositories…
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://ams2.mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:3 http://ams2.mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Get:4 http://ams2.mirrors.digitalocean.com/ubuntu xenial-backports InRelease [92.2 kB]
Fetched 92.2 kB in 0s (151 kB/s)
Reading package lists… Done
INFO - Cleaning up apt headers and packages, so we can start fresh…
INFO -
INFO - Download of http://software.virtualmin.com/lib/apt.conf.noninteractive Succeeded.
INFO - Installing Webmin and Virtualmin package signing keys…
INFO - Download of http://software.virtualmin.com/lib/RPM-GPG-KEY-virtualmin Succeeded.
INFO - Download of http://software.virtualmin.com/lib/RPM-GPG-KEY-webmin Succeeded.
INFO - OK
INFO - OK
INFO - Hit:1
INFO - Removing Debian standard Webmin package, if they exist…
INFO - Removing Debian apache packages…
INFO - Installing dependencies using command: /usr/bin/apt-get --config-file apt.conf.noninteractive -y --force-yes install bsdutils postfix postfix-pcre webmin usermin ruby libxml-simple-perl libcrypt-ssleay-perl unzip zip libfcgi-dev bind9 spamassassin spamc procmail procmail-wrapper libnet-ssleay-perl libpg-perl libdbd-pg-perl libdbd-mysql-perl quota iptables openssl python mailman subversion ruby irb rdoc ri mysql-server mysql-client mysql-common postgresql postgresql-client awstats webalizer dovecot-common dovecot-imapd dovecot-pop3d proftpd libcrypt-ssleay-perl awstats clamav-base clamav-daemon clamav clamav-freshclam clamav-docs clamav-testfiles libapache2-mod-fcgid apache2-suexec-custom scponly apache2 apache2-doc libapache2-svn libsasl2-2 libsasl2-modules sasl2-bin php-pear php php-cgi libapache2-mod-php php-mysql ntpdate
…in progress, please wait…
Extracting templates from packages: 100%…
Extracting templates from packages: 100%
…W: --force-yes is deprecated, use one of the options starting with --allow instead.

INFO - /usr/bin/apt-get --config-file apt.conf.noninteractive -y --force-yes install bsdutils postfix postfix-pcre webmin usermin ruby libxml-simple-perl libcrypt-ssleay-perl unzip zip libfcgi-dev bind9 spamassassin spamc procmail procmail-wrapper libnet-ssleay-perl libpg-perl libdbd-pg-perl libdbd-mysql-perl quota iptables openssl python mailman subversion ruby irb rdoc ri mysql-server mysql-client mysql-common postgresql postgresql-client awstats webalizer dovecot-common dovecot-imapd dovecot-pop3d proftpd libcrypt-ssleay-perl awstats clamav-base clamav-daemon clamav clamav-freshclam clamav-docs clamav-testfiles libapache2-mod-fcgid apache2-suexec-custom scponly apache2 apache2-doc libapache2-svn libsasl2-2 libsasl2-modules sasl2-bin php-pear php php-cgi libapache2-mod-php php-mysql ntpdate: Succeeded.
INFO - Succeeded.
INFO - Installing Virtualmin and all related packages now using the command:
INFO - /usr/bin/apt-get --config-file apt.conf.noninteractive -y --force-yes install virtualmin-base
…in progress, please wait…
…W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Sub-process /usr/bin/dpkg returned an error code (1)

/usr/bin/apt-get --config-file apt.conf.noninteractive -y --force-yes install virtualmin-base failed. Error (if any): 0

Displaying the last 15 lines of /root/virtualmin-install.log to help troubleshoot this problem:
Allowing traffic on TCP port: ftp
Allowing traffic on TCP port: ftp-data
Allowing traffic on TCP port: pop3
Allowing traffic on TCP port: pop3s
Allowing traffic on TCP port: imap
Allowing traffic on TCP port: imaps
Allowing traffic on TCP port: http
Allowing traffic on TCP port: https
Allowing traffic on TCP port: 10000
Allowing traffic on TCP port: 20000
Allowing traffic on UDP port: domain
Removing default AWstats cron job
Re-checking supported Webmin modules
dpkg: error processing package virtualmin-base (–configure):
subprocess installed post-installation script returned error exit status 1
WARN - apt-get seems to have failed. Are you sure your OS and version is supported?
WARN - http://www.virtualmin.com/os-support

FATAL - Fatal Error Occurred: Installation failed: 0
FATAL - Cannot continue installation.
FATAL - Attempting to remove virtualmin repository configuration, so the installation can be
FATAL - re-attempted after any problems have been resolved.
FATAL - Removing temporary directory and files.
FATAL - If you are unsure of what went wrong, you may wish to review the log
FATAL - in /root/virtualmin-install.log

root@latvijai:~# dpkg -l | grep http
ii apt-transport-https 1.2.12~ubuntu16.04.1 amd64 https download transport for APT
ii libapache2-mod-svn 1.9.3-2ubuntu1 amd64 Apache Subversion server modules for Apache httpd
ii libapache2-svn 1.9.3-2ubuntu1 all Apache Subversion server modules for Apache httpd (dummy package)
ii libhttp-cookies-perl 6.01-1 all HTTP cookie jars
ii libhttp-daemon-perl 6.01-1 all simple http server class
ii libhttp-date-perl 6.02-1 all module of date conversion routines
ii libhttp-message-perl 6.11-1 all perl interface to HTTP style messages
ii libhttp-negotiate-perl 6.00-2 all implementation of content negotiation
ii liblwp-protocol-https-perl 6.06-2 all HTTPS driver for LWP::UserAgent
ii libnet-http-perl 6.09-1 all module providing low-level HTTP connection client

HA! Solution is need more ram or swap. Made 2gb swap and installed. Turns out it crashes if not enough memory ram. So something can be adjusted in code so it installs slower when on low ram?