| NEX-SETUP(8) | NEX Administration | NEX-SETUP(8) |
NAME
nex-setup - sets up this node for a NEX cluster: creates a cluster, adds the node to one or removes it
SYNOPSIS
sudo nex-setup
nex-setup create [--node NAME] [--addr IP]
[--roles ROLES] [--disk DIR] [--yes]
[--force] [--dry-run]
nex-setup [add] --from ADMIN_NODE [--node
NAME] [--addr IP] [--roles ROLES]
[--disk DIR] [--ssh-user USER]
[--password-stdin] [--yes] [--force] [--dry-run]
nex-setup remove --from ADMIN_NODE [--yes]
nex-setup status
DESCRIPTION
It is run as root on the new node, after the nex-cluster and nexfs packages have been installed. It talks to the cluster only via ssh to the admin node (the one with the CA) and to the other nodes, with the administrator's user and keys (sudo --preserve-env=SSH_AUTH_SOCK with ssh -A).
- (no arguments, on a terminal)
- the guided setup. It asks whether to create a new cluster with this machine as its first node, or to add this machine to an existing cluster, then asks only what is needed, explaining each choice: the node name (default: the host name), its address among those of the network cards (it warns if the address comes from DHCP, because it must not change), whether the node also runs programs (compute), and where it keeps the cluster data: an empty whole disk, formatted only after its name has been typed to confirm and mounted on /srv/nexfs/disco0, or a folder. Joining a cluster, if this machine has no ssh key accepted by the admin node it offers to create one and copy it there (ssh-copy-id, which asks once for the password on the admin node). After creating a cluster it offers to create the first cluster user and shows the next steps. It does not change the network or the host name. On a node that is already configured it shows status.
- create
- makes this node the first node of a new cluster, its admin node: /etc/nex/node.json, the cluster CA in /etc/nex/ca (nexctl pki init; keep a copy of it in a safe place), the node certificate, the block encryption key (/etc/nexfs/blocchi.key), the NEXFS group with this node as metadata and data node (nexfsctl init, blocks in --disk, default /var/lib/nexfs/disco0), the secrets key, the services and, on a compute node, the cluster users registry in /nex/.nex. Roles: storage or compute,storage (default): the first node always keeps data. It refuses on a node that is already configured or already has a CA, unless --force. The first boot of the VM images uses this same command.
- add
- reads the configuration from the admin node, proposes name, address and roles (on a terminal it asks for them, with --yes it accepts them), writes /etc/nex/node.json, on a compute node copies the cluster secrets key (/etc/nex/secrets.key, if there is one; never shown), has the node certificate signed by the CA, joins NEXFS with that certificate, starts the services, adds the node to the peers of all nodes and verifies. A compute node receives the NEXFS client configuration (/etc/nexfs/nexfs.json) with the meta nodes of the cluster. A storage node is admitted by the admin node, creates its block key (/etc/nexfs/blocchi.key, 64 random bytes, root 0600: the blocks on disk are encrypted with AES-256-XTS) and joins with nexfsctl meta add while the cluster has fewer than three meta nodes, then with nexfsctl node add, with --like /etc/nexfs/cluster.json: a copy of the admin node's /etc/nexfs/nexfs.json, from which nexfsctl takes the meta nodes of the cluster; nexfsctl then writes the node's own NEXFS configuration to /etc/nexfs/nexfs.json. Its blocks go in --disk (default /var/lib/nexfs/disco0). --dry-run only shows what would be done. Roles: compute (runs the users' programs), storage (keeps a share of the cluster data), compute,storage, or terminal: a node for light computers and laptops that has the shared filesystem, the cluster users and nex run towards the other nodes, but runs nothing for the other nodes (the automatic choice of the node skips it, and its agent refuses jobs sent by another node) and keeps no data. The terminal role stands alone. --password-stdin reads from standard input the password of SSH_USER on the cluster nodes: if this node has no ssh access yet, a key is made and copied to the admin node and to the other nodes with that password, without questions. The password reaches ssh through a file readable only by that user in /run, never on the command line. The same password serves sudo on those nodes: where sudo asks for it (the NEX Live stick and the VM images once they are set up) it is given through SUDO_ASKPASS from a temporary file in a 0700 directory, removed right after; without --password-stdin the commands run with sudo -n and the ssh user must be allowed to use sudo without a password. The ssh keys are those of SSH_USER if that user exists on this machine too (a cluster installed by hand: the same person on every node); otherwise those of whoever started nex-setup (for example nex on the stick), who enters the other nodes as SSH_USER: so a stick also joins a cluster installed by hand, with the administrator of the first node and their password. nex-setup-gui (NEX Setup, the graphical setup) and nex-firstboot (the first boot of the VM image without a desktop) use it.
- remove
- detaches the node, stops the services, removes it from the peers of the other nodes, deletes the node key and certificate and the NEXFS client configuration, and keeps the node configuration in /etc/nex/node.json.removed. A storage node is drained and removed from NEXFS first (nexctl storage drain): while nexfsd is enabled, remove refuses.
- status
- node configuration, services and cluster status.
EXIT STATUS
0 success, 1 error or cancelled, 2 added but some node does not answer (2 also for an error in the command line).
SEE ALSO
nex-setup-gui(1), nexctl(8), nexfsctl(8), nexfs-client(8), /usr/share/doc/nex-cluster/installazione.md
| November 2026 | nex-setup 2.11.0 |