[SOLVED] Installing PMG on Lightsail

zolthar

Active Member
Dec 27, 2020
108
17
38
45
I would love to create a backup PMG instance on a cloud hosted VM - has anyone tried installing PMG on a Lightsail instance?

lets assume:
Intance: Debian 10.5 Lightsail AP Region
Public IP = 1.2.3.4
Local IP = 172.26.7.x
fqdn = splaam.domain.com
dns points correctly when ping fqdn

I am trying, however getting the following error and I am not sure of what next:
Code:
hostname lookup 'splaam' failed - failed to get address info for: splaam: Name or service not known
dpkg: error processing package pmg-api (--configure):
installed pmg-api package post-installation script subprocess returned error exit status 22
dpkg: dependency problems prevent configuration of proxmox-mailgateway-container:
proxmox-mailgateway-container depends on pmg-api; however:
  Package pmg-api is not configured yet.

dpkg: error processing package proxmox-mailgateway-container (--configure):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for systemd (241-7~deb10u5) ...
Errors were encountered while processing:
pmg-api
proxmox-mailgateway-container

NOTE: I have changed the following hosts file to reflect the change Stoike had advised below.
/etc/cloud/templates/hosts.debian.tmpl
Code:
#{# The value '{{hostname}}' will be replaced with the local-hostname -#}
#127.0.1.1 {{fqdn}} {{hostname}}
#127.0.0.1 localhost
1.2.3.4 splaam.domain.com splaam

/etc/hosts
Code:
1.2.3.4 splaam.domain.com splaam

/etc/hostname
Code:
splaam.domain.com

/etc/mailname
Code:
splaam.domain.com

/etc/postfix/main.cf
Code:
myhostname = splaam.domain.com
mydestination = $myhostname, splaam.domain.com, localhost.domain.com, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

/etc/apt/sources.list
Code:
# PMG Repository
deb http://ftp.debian.org/debian buster main contrib
deb http://ftp.debian.org/debian buster-updates main contrib

# security updates
deb http://security.debian.org/debian-security buster/updates main contrib

# Proxmox Mail Gateway Enterprise Repository
#deb https://enterprise.proxmox.com/debian/pmg buster pmg-enterprise

# PMG pmg-no-subscription repository provided by proxmox.com, NOT recommended for production use
deb http://download.proxmox.com/debian/pmg buster pmg-no-subscription

What have I not defined?

Any help is much appreciated.
 
Last edited:
1.2.3.4 splaam.domain.com
try adding the short nodename ('splaam') to that line as well:
Code:
1.2.3.4 splaam.domain.com splaam

(without testing on a hunch)

I hope this helps!
 
  • Like
Reactions: zolthar
Thanks Stoiko, I am not sure if yours added, however it passed that error and thrown the following now:

Code:
Setting up pmg-api (6.3-5) ...
generation pmg default locale
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
command 'psql -U postgres --list --quiet --tuples-only' failed: exit code 2
dpkg: error processing package pmg-api (--configure):
 installed pmg-api package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of proxmox-mailgateway-container:
 proxmox-mailgateway-container depends on pmg-api; however:
  Package pmg-api is not configured yet.

dpkg: error processing package proxmox-mailgateway-container (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for systemd (241-7~deb10u5) ...
Errors were encountered while processing:
 pmg-api
 proxmox-mailgateway-container
E: Sub-process /usr/bin/dpkg returned an error code (1)

To get to the above, I had changed the following:

/etc/cloud/templates/hosts.debian.tmpl
Code:
1.2.3.4 splaam.domain.com splaam

/etc/dhcp/dhclient.conf
Code:
supersede domain-name "splaam.domain.com";
prepend domain-name-servers 1.1.1.1, 9.9.9.9;

cat /etc/resolv.conf
Code:
domain splaam.domain.com
search splaam.domain.com
nameserver 1.1.1.1
nameserver 9.9.9.9

Firewall
I had also opened ALL PORTS/Protocols for this test purpose.
 
psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
is postgresql installed and running? ...
 
it occured during the installation process during this command:

sudo apt install proxmox-mailgateway-container

So I am not certain whether it would have been installed or not and if its during the install process, I am assuming it should have been installed and started.

Still learning on the CLI, and after every failed install, I am deleting the instance and restarting as the install does not seem to continue - probably I am not aware of the correct command to continue installation.
 
I just did a re-install and added only your suggestion for the /etc/cloud/templates/hosts.debian.tmpl and it has completed the installation.

I opened port 8006 and it is now responding - so will do some config and testing.

Thanks heaps Stoiko.
 
  • Like
Reactions: Stoiko Ivanov
Glad that worked - please mark the thread as 'SOLVED' - this helps others who also want to run PMG on Lightsail