title: Error while installing postgresql
body: <p>I've never used postgres, only MySQL, so it's new for me.
  I'm trying to installing it on a VM(so I can use only command line). Running the command <code>sudo apt-get install postgresql</code> this is my output: </p>
  
  <blockquote>
    <p>Reading package lists...Done Building dependency tree        Reading
    state information... Done The following packages were automatically
    installed and are no longer required:   adwaita-icon-theme aspell
    aspell-en at-spi2-core dconf-gsettings-backend dconf-service
    dictionaries-common emacsen-common enchant fontconfig gedit-common<br>
    gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-gtk-3.0
    gir1.2-gtksource-3.0 gir1.2-pango-1.0 gir1.2-peas-1.0 glib-networking
    glib-networking-common   glib-networking-services
    gsettings-desktop-schemas gstreamer1.0-plugins-base
    gstreamer1.0-plugins-good gstreamer1.0-x gtk-update-icon-cache
    hicolor-icon-theme   humanity-icon-theme hunspell-en-us libaa1
    libaspell15 libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data
    libatspi2.0-0 libavahi-client3 libavahi-common-data   libavahi-common3
    libavc1394-0 libboost-filesystem1.62.0 libboost-system1.62.0 libcaca0
    libcairo-gobject2 libcairo2 libcapnp-0.5.3 libcdparanoia0 libcolord2<br>
    libcontent-hub-glib0 libcroco3 libcups2 libdatrie1 libdconf1 libdv4
    libegl1-mesa libenchant1c2a libepoxy0 libflac8 libgbm1
    libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-bin   libgdk-pixbuf2.0-common
    libgraphite2-3 libgspell-1-1 libgspell-1-common
    libgstreamer-plugins-base1.0-0 libgstreamer-plugins-good1.0-0
    libgstreamer1.0-0 libgtk-3-0   libgtk-3-bin libgtk-3-common
    libgtksourceview-3.0-1 libgtksourceview-3.0-common libgudev-1.0-0
    libharfbuzz-icu0 libharfbuzz0b libhunspell-1.4-0 libhyphen0<br>
    libiec61883-0 libjack-jackd2-0 libjavascriptcoregtk-4.0-18 libjbig0
    libjpeg-turbo8 libjpeg8 libjson-glib-1.0-0 libjson-glib-1.0-common
    liblcms2-2 libmirclient9   libmircommon7 libmircore1 libmirprotobuf3
    libnotify4 libogg0 libopus0 liborc-0.4-0 libpango-1.0-0
    libpangocairo-1.0-0 libpangoft2-1.0-0 libpangoxft-1.0-0<br>
    libpeas-1.0-0 libpeas-common libpixman-1-0 libprotobuf-lite10
    libproxy1v5 libraw1394-11 librest-0.7-0 librsvg2-2 librsvg2-common
    libsamplerate0 libsecret-1-0   libsecret-common libshout3
    libsoup-gnome2.4-1 libsoup2.4-1 libspeex1 libtag1v5 libtag1v5-vanilla
    libthai-data libthai0 libtheora0 libtiff5 libv4l-0 libv4lconvert0<br>
    libvisual-0.4-0 libvorbis0a libvorbisenc2 libvpx4 libwavpack1
    libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa
    libwayland-server0 libwebkit2gtk-4.0-37   libwebp6 libxcb-render0
    libxcb-shm0 libxcb-xfixes0 libxkbcommon0 libyelp0
    linux-headers-4.10.0-35 linux-headers-4.10.0-35-generic
    linux-image-4.10.0-35-generic   linux-image-4.4.0-59-generic
    linux-image-extra-4.10.0-35-generic linux-image-extra-4.4.0-59-generic
    notification-daemon python3-cairo python3-gi-cairo ubuntu-mono   yelp
    yelp-xsl zenity zenity-common Use 'sudo apt autoremove' to remove
    them. The following additional packages will be installed:   libpq5
    postgresql-9.6 postgresql-client-9.6 postgresql-client-common
    postgresql-common postgresql-contrib-9.6 sysstat Suggested packages:<br>
    postgresql-doc locales-all postgresql-doc-9.6 libdbd-pg-perl isag The
    following NEW packages will be installed:   libpq5 postgresql
    postgresql-9.6 postgresql-client-9.6 postgresql-client-common
    postgresql-common postgresql-contrib-9.6 sysstat 0 upgraded, 8 newly
    installed, 0 to remove and 32 not upgraded. Need to get 5049 kB of
    archives. After this operation, 20.3 MB of additional disk space will
    be used. Do you want to continue? [Y/n] y Get:1
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty-updates/main amd64 libpq5
    amd64 9.6.6-0ubuntu0.17.04 [79.8 kB] Get:2
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty-updates/main amd64
    postgresql-client-common all 179ubuntu0.1 [28.6 kB] Get:3
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty-updates/main amd64
    postgresql-client-9.6 amd64 9.6.6-0ubuntu0.17.04 [890 kB] Get:4
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty-updates/main amd64
    postgresql-common all 179ubuntu0.1 [157 kB] Get:5
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty-updates/main amd64
    postgresql-9.6 amd64 9.6.6-0ubuntu0.17.04 [3125 kB] Get:6
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty-updates/main amd64
    postgresql all 9.6+179ubuntu0.1 [5262 B] Get:7
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty-updates/main amd64
    postgresql-contrib-9.6 amd64 9.6.6-0ubuntu0.17.04 [492 kB] Get:8
    <a href="http://it.archive.ubuntu.com/ubuntu" rel="nofollow noreferrer">http://it.archive.ubuntu.com/ubuntu</a> zesty/main amd64 sysstat amd64
    11.4.3-1 [272 kB] Fetched 5049 kB in 3s (1648 kB/s) perl: warning: Setting locale failed. perl: warning: Please check that your locale
    settings:     LANGUAGE = "en_US:en",  LC_ALL = (unset),   LC_TIME =
    "it_IT.UTF-8",    LC_MONETARY = "it_IT.UTF-8",    LC_ADDRESS =
    "it_IT.UTF-8",    LC_TELEPHONE = "it_IT.UTF-8",   LC_NAME =
    "it_IT.UTF-8",    LC_MEASUREMENT = "it_IT.UTF-8",     LC_IDENTIFICATION =
    "it_IT.UTF-8",    LC_NUMERIC = "it_IT.UTF-8",     LC_PAPER = "it_IT.UTF-8",
      LANG = "en_US.UTF-8"
        are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8"). locale: Cannot set LC_ALL
    to default locale: No such file or directory Preconfiguring packages
    ... Selecting previously unselected package libpq5:amd64. (Reading
    database ... 194493 files and directories currently installed.)
    Preparing to unpack .../0-libpq5_9.6.6-0ubuntu0.17.04_amd64.deb ...
    Unpacking libpq5:amd64 (9.6.6-0ubuntu0.17.04) ... dpkg: unrecoverable
    fatal error, aborting:  fork failed: Cannot allocate memory W: Could
    not open file /var/log/apt/eipp.log.xz - open (12: Cannot allocate
    memory) W: Could not open file '/var/log/apt/eipp.log.xz' -
    EIPP::OrderInstall (12: Cannot allocate memory) E: Sub-process
    /usr/bin/dpkg returned an error code (2)</p>
  </blockquote>
  
  <p>then, if I try again the output is </p>
  
  <blockquote>
    <p>E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.</p>
  </blockquote>
  
  <p>How can I do to solve the problem?</p>