Skip to content

Adding a hosting server ​

How to enroll a new hosting server in the panel: install it from the panel over SSH, or create a token and install the agent and the hosting stack by hand, verify the server, apply isolation, install a DNS-only server for nameservers, and set up an external database server if you need one.

Before you start ​

  • The panel is installed and reachable from the new server on port 8443.
  • The new server is clean (AlmaLinux, Rocky, RHEL, or CloudLinux 9) with a lowercase FQDN hostname. If the server was enrolled with the wrong name, change it later in the panel (Changing the hostname).
  • The panel can reach the new server on the agent port (7443).

See Server preparation.

Admins can install a new server straight from the panel, without logging in to it. The panel connects over SSH, runs the same installer as below, and shows its log.

  1. Open Servers and click Add server. The Add server page (/servers/add) opens.

  2. Under SSH connection, fill in the server IP address or hostname, the SSH port, and the username: root, or a user with sudo. Choose Password or SSH key (OpenSSH or PEM private key, with its passphrase if it has one).

  3. Under Install options, choose the web server, extra PHP versions, ClamAV, PostgreSQL for clients, a nameserver node, and the Let's Encrypt certificate for the hostname.

  4. Click Test connection. Server check shows the operating system, CPU, RAM, and disk, and checks:

    CheckNeeds
    Operating systemAlmaLinux, Rocky Linux, RHEL, or CloudLinux 9
    Root accessroot, or sudo for the user
    RAMat least 2 GB (4 GB recommended)
    Diskat least 10 GB free on / (20 GB recommended)
    Hostnamea full name such as server2.example.com (warning only)
    Reach the panelthe server opens the panel URL over HTTPS and trusts its certificate
    Agentno MoorCP agent enrolled yet and no installation running
  5. Compare the SSH host key fingerprint with the one from your provider or from ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the server, then tick This is my server's host key. The panel only connects to a server with this key during the installation.

  6. Click Install. The installation log appears on the page. It takes about 10–20 minutes.

  7. If the server needs a reboot for disk quotas, the page shows Reboot needed. Click Reboot server. The page waits for the server to come back and keeps following the installation, which continues by itself.

  8. When the page shows Done, the server is in the server list. After a few seconds the page opens the setup wizard of the new server (see Setup wizard), which takes you through verification, isolation, email, security, and the other important settings.

INFO

  • Only the Administrator role can add servers over SSH. Every installation is recorded in the audit log (server.install_start, server.install_reboot, server.install_finish) without the password or key.
  • The password or key stays only in the panel's memory during the installation and is removed when it finishes. If the panel restarts, the page loses the installation, but the installation keeps running on the server: check /var/log/moorcp-install.log there.
  • The panel needs a certificate the new server trusts. With a self-signed panel certificate, use the manual command with --panel-ca instead.
  • How the credentials and host key are protected: Security model.

For the server list, the setup wizard, and other server actions, see Servers.

1. Create a registration token ​

To install by hand instead, create a token and run the command on the server yourself.

  1. In the admin panel, open Servers.
  2. Click Install command (or Add server on the Server enrollment card if you are not an Administrator).
  3. The Agent enrollment token window opens. Choose:
    • Default web server: the initial web server mode;
    • Extra PHP versions: Remi versions, for example 74 81 83;
    • Install ClamAV, if needed.
  4. Click Copy command.

The token is valid for 30 minutes and can be used only once. If it expires, create a new one.

INFO

Only staff with write access (Administrator and Technician) can create a registration token. Administrators use Install command; Technicians use Add server.

2. Run the installer on the new server ​

Log in to the new server as root, then run:

bash
curl -fsSL https://get-shared.moorcp.com | sudo bash -s -- agent --panel https://panel.example.com:8443 --token TOKEN

The agent mode installs the same version as the panel (read from /v1/health), so you do not need --channel here.

Example with options:

bash
curl -fsSL https://get-shared.moorcp.com | sudo bash -s -- agent \
  --panel https://panel.example.com:8443 --token TOKEN \
  --web-mode nginx-proxy --php "74 81 83" --clamav

The command copied from the token window uses the older form, which fetches the installer straight from the panel. That form still works:

bash
curl -fsSL https://panel.example.com:8443/install-agent.sh | bash -s -- --panel https://panel.example.com:8443 --token TOKEN --web-mode nginx-proxy

Panel with a self-signed certificate ​

If the panel still uses a self-signed certificate, the new server cannot trust the panel. Copy the panel certificate to the new server, then add --panel-ca:

  1. On the panel server, take /etc/moorcp-shared/tls/fullchain.pem.
  2. Save it on the new server, for example as /root/panel-ca.pem.
  3. Add --panel-ca /root/panel-ca.pem to the installer command.

TIP

It is easier to install Let's Encrypt on the panel first. See Installing the panel.

What the installer does ​

  1. Reads the panel version from /v1/health, then installs the agent with the same version.
  2. Adds the EPEL, CRB, Remi, and rspamd repositories, then installs the hosting stack: Nginx, Apache, system PHP and additional PHP, MariaDB, Postfix, Dovecot, Rspamd, Unbound (local DNS resolver for Rspamd), Pure-FTPd, restic, certbot, and supporting tools. OpenLiteSpeed and lsphp are installed with --web-mode openlitespeed. Certbot is still installed as a package, but the hostname certificate no longer needs it (see step 8).
  3. Checks disk quotas on /home. On an XFS root without quotas, the installer adds a boot option, enrolls the server in the panel right away, and stops with exit code 10. Reboot the server: the installation continues by itself after the reboot (moorcp-install-resume.service, log in /var/log/moorcp-install-resume.log), so you do not need to run the command again. The token may have expired by then; that is fine because the server is already enrolled. Until the installation finishes, the panel shows the agent as not reporting.
  4. Installs the moorcp-agent binary and the moorcp-agent systemd service.
  5. Sets up ClamAV (--clamav) and PostgreSQL for clients (--pgsql) if requested. With --clamav, the installer also writes the MoorCP clamd configuration, downloads the signatures with freshclam, and starts clamd@scan if SELinux allows it. If clamd cannot start, the install continues and prints what to do next (see Installation problems).
  6. Sets up the web server according to --web-mode.
  7. Opens the web, email, FTP, and agent ports in firewalld.
  8. Requests a Let's Encrypt certificate for the server hostname with moorcp-agent hostcert issue, when the hostname is a fully qualified public name. It is skipped for names ending in .localdomain, .local, .localhost, .internal, .lan, .test, .example, or .invalid, when /etc/letsencrypt/live/<hostname>/fullchain.pem already exists, and with --no-hostname-ssl or --skip-enroll. If issuing fails, the installer only warns and continues (see Server hostname certificate).
  9. Installs PowerDNS with --dns (nameserver node).
  10. Enrolls the server in the panel with the token, then starts moorcp-agent.

At the end, the installer prints:

text
==> Done: srv1.example.com · nginx-proxy web mode
   Continue in the panel: Servers › srv1.example.com (status Verifying) › Verify, then
   Settings › Isolation & limits › Apply hardening.

3. Verify the server ​

The new server appears in Servers with status verifying. Verification runs automatically when the agent enrolls. The server becomes active once every required check passes.

CheckRequiredMeaning
agent_reachableYesThe panel can reach the agent
identityYesThe server hostname matches the name in the agent certificate
os_supportedYesThe OS is supported
capabilitiesYesThe agent reports the server's capabilities
cgroup_v2Yes (not required on cloudlinux)cgroup v2 is active; on CloudLinux, limits are enforced by LVE
filesystem_quotaYesQuotas are active on /home or /
proc_hiddenYes, generic driver only/proc is mounted with hidepid
home_privateYes, generic driver only/home has mode 0711
driver_supportedYesThe isolation driver is supported on the server
web_server_modeNoThe web server mode is recorded
security_providerNoA security provider is present
php_versionsNoPHP versions are installed

DNS-only servers get a lighter verification. See DNS-only server.

To run verification again:

  1. Open Servers › server name › Settings.
  2. Choose Agent & security.
  3. Under Server verification, click Run verification.

4. Apply isolation hardening ​

With the generic driver, the proc_hidden and home_private checks only pass after isolation hardening is applied:

  1. Open Servers › server name › Settings › Isolation & limits.
  2. Click Apply hardening.
  3. Confirm. /home becomes 0711 and /proc is remounted with hidepid. Sites and email stay online.

The server is verified again afterwards. Once every required check passes, the status becomes active.

TIP

On a CloudLinux server, the agent uses the cloudlinux driver automatically when LVE and CageFS are detected. See CloudLinux.

5. Set capacity ​

Open Settings › Capacity & maintenance to set the account limit, oversell rules, and maintenance mode. See Servers.

Server hostname certificate ​

Email (Postfix/Dovecot), webmail, phpMyAdmin, and AdminNeo use a Let's Encrypt certificate for the server hostname, for example srv1.example.com. The agent has a built-in ACME client for it; certbot is not needed. The installer requests the certificate at the end of the install (step 8 above). To request it yourself, for example after DNS is ready, run as root on the hosting server:

bash
moorcp-agent hostcert issue

Requirements:

  • an A record for the hostname points to the server;
  • port 80 is open from the internet (HTTP-01 validation).

What the command does:

  • --domain defaults to the server's OS hostname. --email EMAIL sets the Let's Encrypt account email. --staging uses the Let's Encrypt test CA (the certificate is not trusted).
  • It works in every web server mode. If port 80 is free, the agent serves the challenge itself. If the web server serves the ACME webroot /var/lib/moorcp/acme for the hostname, it uses that. Otherwise it stops the active web server (OpenLiteSpeed, Nginx, or Apache) for a few seconds during validation and starts it again.
  • Files are written in the certbot layout: /etc/letsencrypt/live/<hostname>/{privkey,fullchain,cert,chain}.pem. Then the executable deploy hooks in /etc/letsencrypt/renewal-hooks/deploy run.
  • For the server hostname, the agent installs the deploy hook /etc/letsencrypt/renewal-hooks/deploy/moorcp-agent-host.sh (reloads Postfix, Dovecot, and the web server on renewal). It then runs the setup of what is installed again, so it switches to the new certificate: email TLS, webmail, phpMyAdmin, and AdminNeo. It prints updating <name> for <hostname> for each one. If --domain is not the server hostname, mail and the hostname vhosts are left unchanged.

The agent renews the certificate itself: it checks twice a day (the first time 15 minutes after the agent starts) and renews when less than 30 days remain. A hostname that was never issued (DNS not ready yet) is retried for 7 days; after that, retries stop until you run issue again.

Other commands:

CommandPurpose
moorcp-agent hostcert statusLists the managed hostnames and the expiry date. (renewal due), (managed by certbot), or (retries stopped; run issue again) is shown when it applies
moorcp-agent hostcert renewRenews now the certificates that are due, or not issued yet
moorcp-agent hostcert remove --domain HOSTStops renewing a hostname. The certificate files are kept

INFO

A hostname managed by certbot (a /etc/letsencrypt/renewal/<hostname>.conf file, or symlinked files in live/) is never touched. issue refuses with <hostname> is managed by certbot; renew it with certbot, and certbot keeps renewing it.

With --pgsql, AdminNeo needs the hostname certificate first. If it is missing, the installer skips AdminNeo. Once the certificate is issued, install it from Servers › server name › Settings › Apps & tools.

Enrolling a server again ​

  • Re-running the installer is safe. If the agent is already enrolled, the enrollment step is skipped (Agent sudah terdaftar (pakai --force untuk mendaftar ulang): agent already enrolled; use --force to enroll again).

  • --force enrolls again with a new token.

  • A hostname that is already enrolled can only be enrolled again with a token for that specific server (POST /v1/servers/enroll-tokens with serverId). A regular token is refused with cp.enroll_hostname_taken, so another server cannot overwrite an existing one.

  • --skip-enroll installs everything without enrolling, for example for a template image. Enroll later with:

    bash
    moorcp-agent enroll --panel https://panel.example.com:8443 --token TOKEN && systemctl enable --now moorcp-agent

DNS-only server ​

A DNS-only server is a small VPS that only runs the agent and PowerDNS as a nameserver node (ns1, ns2, ...). It does not install the hosting stack and is not used for accounts. 1 vCPU and 1 GB of RAM is enough.

TIP

A hosting server can also be a nameserver node: install it with --dns, or just pick it in the panel. Avoid the panel server, because a public port 53 is an easy target for attacks.

Install ​

  1. Create a registration token in Servers › Add server, as in step 1 above.

  2. On the new VPS (AlmaLinux, Rocky, RHEL, or CloudLinux 9), run:

    bash
    curl -fsSL https://get-shared.moorcp.com | sudo bash -s -- dns --panel https://panel.example.com:8443 --token TOKEN

The installer installs the agent, opens the DNS port (53) and the agent port in firewalld, installs PowerDNS, records the dns role in /etc/moorcp/role, then enrolls the server in the panel. At the end, it prints:

text
==> Done: ns1.example.com · DNS-only (PowerDNS)
   Continue in the panel: Domains & DNS › Nameserver nodes › Add node › ns1.example.com.

Verification ​

The required checks for a DNS-only server are only agent_reachable, identity, os_supported, capabilities, and dns_node (PowerDNS installed by the dns installer mode). The quota, cgroup, and isolation checks do not apply. If anything tries to place an account on this server, placement is refused with the reason "DNS-only server".

Make it a nameserver node ​

  1. Open Domains & DNS › Nameserver nodes.
  2. If DNS is not enabled yet, fill in Default nameservers, for example ns1.example.com and ns2.example.com, pick the server under Primary node, then click Enable DNS. Existing zones are copied to that node right away.
  3. For the next node, click Add node, pick the server, then click Add node. The new node becomes a replica, and every zone is copied from the primary.
  4. At the registrar of the nameservers' parent domain, create an A record for each nameserver pointing to its node's IP, and register them as child nameservers (glue). The At the registrar card on that page shows the pairs.

See Domains and DNS to change the primary, remove nodes, and add cPanel DNSOnly replicas.

External database server ​

Account databases (MariaDB/MySQL and PostgreSQL) can live on another server: a separate VPS, a dedicated database server, or a managed service. phpMyAdmin and AdminNeo are still opened from the hosting server.

The panel does not install the database on the external server. Prepare that server first with the steps below (example for AlmaLinux/Rocky 9). Replace these values:

ValueMeaning
10.0.0.10IP of the hosting server (as seen by the database server)
10.0.0.20IP of the database server
STRONG_PASSWORDPassword of the admin user moorcp

TIP

If both servers share a private network, use private IPs: data transfers are faster and do not cross the internet.

MariaDB ​

bash
dnf install -y mariadb-server
bash
systemctl enable --now mariadb

Create /etc/my.cnf.d/90-remote.cnf so MariaDB can be reached from the network:

ini
[mysqld]
bind-address = 10.0.0.20
bash
systemctl restart mariadb
bash
mariadb -e "CREATE USER 'moorcp'@'10.0.0.10' IDENTIFIED BY 'STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'moorcp'@'10.0.0.10' WITH GRANT OPTION;"

Use a MariaDB version equal to or newer than the hosting server's, so user password hashes carry over when databases are moved.

PostgreSQL (if used) ​

bash
dnf install -y postgresql-server
bash
postgresql-setup --initdb
bash
systemctl enable --now postgresql

Change two files:

  • /var/lib/pgsql/data/postgresql.conf: listen_addresses = 'localhost,10.0.0.20'
  • /var/lib/pgsql/data/pg_hba.conf, add: host all all 10.0.0.10/32 scram-sha-256
bash
systemctl restart postgresql
bash
sudo -u postgres psql -c "CREATE ROLE moorcp LOGIN CREATEROLE CREATEDB PASSWORD 'STRONG_PASSWORD';"

CREATEROLE CREATEDB is enough; SUPERUSER also works.

Database server firewall ​

Open the database ports only to the hosting server's IP:

bash
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.10/32" port port="3306" protocol="tcp" accept'
bash
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.10/32" port port="5432" protocol="tcp" accept'
bash
firewall-cmd --reload

Add one rule for every hosting server that uses this database server.

WARNING

Never open port 3306 or 5432 to every address.

Connect it in the panel ​

  1. Open Servers › hosting server › Settings › Databases.
  2. Click Configure on MariaDB or PostgreSQL, then choose External endpoint.
  3. Fill in Private address and/or Public address, the port (3306 / 5432), user moorcp, the password, and the TLS mode:
    • private network: disable or preferred;
    • over the internet: required or verify (with a CA certificate).
  4. Click Test connection. The panel checks the network, TLS, and admin rights, then shows the hosting server's IP as seen by the database server. That is the IP to allow for the moorcp user and in the firewall.
  5. Tick Move existing account databases and users to the new location if the existing databases should move too.
  6. Click Save and apply.

If the connection test fails:

SymptomCheck
Connection refused / timeoutbind-address or listen_addresses, firewall
Access deniedThe user host ('moorcp'@'IP') must be the IP from the connection test; pg_hba.conf
Insufficient privilegesWITH GRANT OPTION (MariaDB), CREATEROLE CREATEDB (PostgreSQL)

See Databases and optimizer.

See also ​

MoorCP Shared, a shared hosting panel for server fleets.