Installation de Meshcentral sur LXC

Liens

Installation Guide

User's Guide

Outils

apt install net-tools bash-completion software-properties-common dpkg-reconfigure locales cat <<EOF | tee -a /etc/bash.bashrc if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi EOF

Réseau

cat <<EOF | tee /etc/netplan/10-lxc.yaml network: version: 2 ethernets: eth0: dhcp4: no dhcp6: no addresses: - 10.0.3.133/24 gateway4: 10.0.3.1 nameservers: addresses: - 213.186.33.99 - 8.8.8.8 EOF

Meshcentral

apt install -y nodejs npm node -v npm -v apt install mongodb -y systemctl start mongodb systemctl enable mongodb setcap cap_net_bind_service=+ep /usr/bin/node echo "@reboot setcap cap_net_bind_service=+ep /usr/bin/node" | crontab - useradd -r -d /opt/meshcentral -s /sbin/nologin meshcentral mkdir /opt/meshcentral cd /opt/meshcentral npm install meshcentral npm install archiver@4.0.2 otplib@10.2.3 mongodb mkdir /opt/meshcentral/meshcentral-data chown -R meshcentral:meshcentral /opt/meshcentral chmod 755 -R /opt/meshcentral/meshcentral-* cat <<'EOF' | tee /opt/meshcentral/meshcentral-data/config.json { "settings": { "MongoDb": "mongodb://127.0.0.1:27017/meshcentral", "Cert": "myservername.domain.com", "AliasPort": 443, "_Port": 4430, "_RedirPort": 800, "AgentPong": 300, "TlsOffload": "127.0.0.1" } "domains": { "": {"certUrl": "https://127.0.0.1:443/"} } } EOF sudo -u meshcentral node ./node_modules/meshcentral

Systemd service

cat <<EOF | tee /etc/systemd/system/meshcentral.service
[Unit]
Description=MeshCentral Server
[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=/usr/bin/node /opt/meshcentral/node_modules/meshcentral
WorkingDirectory=/opt/meshcentral
Environment=NODE_ENV=production
User=meshcentral
Group=meshcentral
Restart=always
# Restart service after 10 seconds if node service crashes
RestartSec=10
# Set port permissions capability
AmbientCapabilities=cap_net_bind_service
[Install]
WantedBy=multi-user.target
EOF
systemctl enable meshcentral.service
systemctl start meshcentral.service
systemctl status meshcentral.service
systemctl stop meshcentral.service