The way to set the env var will vary depending on how the server is deployed. We'll cover 2 examples: RabbitMQ Cluster Kubernetes Operator and RabbitMQ image using Podman.
If using RabbitMQ Cluster Kubernetes Operator it can be set when creating the cluster definition as follows.
---
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
...
spec:
...
rabbitmq:
envConfig: |
ERL_MAX_PORTS=10000000
...
podman run --env 'ERL_MAX_PORTS=10000000' ...