How to install ERPNext in a Linux Container (using LXD)?

We have set up a linux server which hosts several ERPNext sites as LXD containers. The trick is to use NAT (network address translation). You can use iptables to accomplish that.

First you need to create firewall rules which specify:

  • the interface (for example: eth0, enp0s25, etc)
  • which ports are allowed to connect to
  • optionally, where do you allow connections from

Then you need to create NAT rules which specify:

  • interface in which the translated packets come from
  • protocol (TCP)
  • port that was used originally
  • destination to which the packets are forwarded

iptables/NAT example:

iptables -A PREROUTING -i eth0 -p tcp -m tcp --dport 5001 -j DNAT --to-destination 10.0.12.2:80

This assumes your ethernet interface is eth0 and the original port was 5001. All packets to eth0’s port 5001 are then forwarded to 10.0.12.2 port 80.

You can check which IP addresses are assigned to LXD containers by entering the command: lxc list

1 Like

wow, thanks @tatu. It’s always phantastic to see issues are being picked up even after a long time.

Would you mind to specify the version of LXD you are using? I’m pretty certain that LXD networking is going though some changes between different version of yet young LXD.

lxc version

Client version: 3.0.1
Server version: 3.0.1

good news for all LXD/LXC fans.

Thanks to @codingCoffee a PR, which makes the EasyInstall script LXD/LXC ready again, is waiting to be merged.

Was a document or presentation created? I will appreciate if this is available. Thank you.

An LXD image will be awesome to have. Was there any progress on this?

  1. not that I am aware of.
  2. I have been able to install in an LXD container a long time ago and failed ever since. Can’t say this is due to try running inside an LXC/LXD Container or because the install.py just loves to not work

if I where you I’d try any of the existing manual installation how-to’s just inside a container

Alright, thank you.

please let us know which how-to has worked for you in the end, ok?

I’ve been using ERPNext on LXD for months. You can follow easiest installation here

1 Like

The LXD people are even speaking of ERPNext directly, see here:

https://ubuntu.com/blog/using-lxd-to-host-your-own-erp-cost-effectively

Is this technology outdated regarding ERPNext? Or is it still a viable path people are using?
Maybe even better now than before?

1 Like