Just some notes for installing MeshCentral
https://meshcentral.com/info/
https://www.meshcommander.com/meshcentral2
--- and asking the big question: WHY ISN'T EVERYONE USING THIS !!!!!!
Installing on Debian makes meshcentral seem truly zippy...even when comapred to Ubuntu.
It just "feels better".
******Setup Debian 10...******
I created a user named "administrator"
No Desktop env. and added SSH server.
login as administrator
******* adding SUDO ********
sudo
go to the root user mode
$ su
(enter root user password)
Update the repository.
$apt update
Install the sudo package.
$ apt install sudo -y
Exit root mode
$exit
enter the root mode by using sudo command. If it works...you're good
$sudo -s
the sudo command will probably kick an error about a user not being in the sudoers file
*********How to add user to sudoers file************
su to root
$su root
$sudo -s
Update the repository
$apt-get update
add the user in the list of sudoers file
root@debian:/home/administrator# usermod -aG sudo administrator
and see that the administrator user is added to the list of sudo.
#id administrator
you might have to exit twice....to get out of root mode
# exit
# exit
I do a a hard reboot (su root, then "reboot now") just to make sure everything is working and stays after a reboot
after the reboot try running
$ sudo fdisk -l
to verify that it works.
If it works...then the "administrator" user has been added to the sudoers list
******************set static IP*********************
sudo nano /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto enp0s5
iface enp0s5 inet static
address 192.168.2.236
netmask 255.255.255.0
gateway 192.168.2.254
dns-domain domain.com
dns-nameservers 192.168.2.254
another hard reboot after the static IP setup (su root, then "reboot now")
that should pretty much be then end of the Debian "server" stuff.
************************************************
************************************************
************************************************
sudo apt-get install software-properties-common (for the "add-apt-repository" command) << edit: this *may* not be needed
sudo apt update
sudo apt install nodejs -y
sudo apt install npm -y
--------------------------------------
administrator@MeshCentral:~$ node -v
v10.24.0
administrator@MeshCentral:~$ npm -v
5.8.0
administrator@MeshCentral:~$
-------------------------------------------
(hummmm lets update these)
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
another hard reboot after these commands helps clean out the cache etc... (su root, then "reboot now")
____________________________
administrator@MeshCentral:~$ node -v
v16.15.0
administrator@MeshCentral:~$ npm -v
8.5.5
administrator@MeshCentral:~$
_______________________________
Ahhhhh..... much better
***************Installing the mongo database******************
This installs version 4.4 of the mongo db...the latest mongo version for Debian is 5.0 so I'm installing a *slightly* older version, it seems to feel better.
sudo apt install dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
sudo add-apt-repository 'deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main'
sudo apt update
sudo apt install mongodb-org
sudo systemctl start mongod
sudo systemctl enable mongod
systemctl status mongod
(should show active and running)
*********** port permissions***********
whereis node
returns:
node: /usr/bin/node /usr/local/bin/node /usr/share/man/man1/node.1.gz
so I did:
sudo setcap cap_net_bind_service=+ep /usr/bin/node
sudo setcap cap_net_bind_service=+ep /usr/local/bin/node
not sure if it's necessary for both paths (/usr/bin/node and /usr/local/bin/node) *shrug* but probably won't hurt anything
**************** install meshCentral****************
npm install meshcentral
...and everything installed fine... got a couple npm notices... but just minor version upgrades, nothing signifiant.
node ./node_modules/meshcentral
edit the "~/meshcentral-data/config.json" file and add the mongo database line and uncomment the setting you need/want
(this is covered in the meshcentral docs)
"MongoDb": "mongodb://127.0.0.1:27017/meshcentral",
then from the docs:
echo "node ./node_modules/meshcentral > stdout.txt 2> stderr.txt &" > mcstart
chmod 755 mcstart
echo "pkill –f node_modules/meshcentral" > mcstop
chmod 755 mcstop
so the command "./mcstart" will now start meshcentral
************* straight from the docs ***********************
6.7 Automatically starting the server
Since Ubuntu 18.04 supports systemd, we are going to use that to auto-start MeshCentral in the
background. First, we need to know our own username and group. If we do “ls -l” in our home folder
we get for example:
drwxr-xr-x 2 default default 4096 Jul 20 00:03 Desktop
drwxr-xr-x 2 default default 4096 Jul 20 00:03 Documents
drwxr-xr-x 2 default default 4096 Jul 20 00:03 Downloads
…
Note the username and group name, in this example it’s “default” for both. We need this information
to create the system service description file. To create this file type:
sudo pico /etc/systemd/system/meshcentral.service
Then enter the following lines:
[Unit]
Description=MeshCentral Server
[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=/usr/bin/node /home/default/node_modules/meshcentral
WorkingDirectory=/home/default
Environment=NODE_ENV=production
User=default
Group=default
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
----- definitely want to read the docs on this part (the Ubuntu part)---- and edit the "meshcentral.service" file appropiately
Once this is done, you can now start, enable, stop and disable using the following commands:
sudo systemctl enable meshcentral.service
sudo systemctl start meshcentral.service
sudo systemctl stop meshcentral.service
sudo systemctl disable meshcentral.service
I did one last hard reboot to make sure everything work as expected...and it did.
5/13/22
It just "feels better".
******Setup Debian 10...******
I created a user named "administrator"
No Desktop env. and added SSH server.
login as administrator
******* adding SUDO ********
sudo
go to the root user mode
$ su
(enter root user password)
Update the repository.
$apt update
Install the sudo package.
$ apt install sudo -y
Exit root mode
$exit
enter the root mode by using sudo command. If it works...you're good
$sudo -s
the sudo command will probably kick an error about a user not being in the sudoers file
*********How to add user to sudoers file************
su to root
$su root
$sudo -s
Update the repository
$apt-get update
add the user in the list of sudoers file
root@debian:/home/administrator# usermod -aG sudo administrator
and see that the administrator user is added to the list of sudo.
#id administrator
you might have to exit twice....to get out of root mode
# exit
# exit
I do a a hard reboot (su root, then "reboot now") just to make sure everything is working and stays after a reboot
after the reboot try running
$ sudo fdisk -l
to verify that it works.
If it works...then the "administrator" user has been added to the sudoers list
******************set static IP*********************
sudo nano /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto enp0s5
iface enp0s5 inet static
address 192.168.2.236
netmask 255.255.255.0
gateway 192.168.2.254
dns-domain domain.com
dns-nameservers 192.168.2.254
another hard reboot after the static IP setup (su root, then "reboot now")
that should pretty much be then end of the Debian "server" stuff.
************************************************
************************************************
************************************************
sudo apt-get install software-properties-common (for the "add-apt-repository" command) << edit: this *may* not be needed
sudo apt update
sudo apt install nodejs -y
sudo apt install npm -y
--------------------------------------
administrator@MeshCentral:~$ node -v
v10.24.0
administrator@MeshCentral:~$ npm -v
5.8.0
administrator@MeshCentral:~$
-------------------------------------------
(hummmm lets update these)
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
another hard reboot after these commands helps clean out the cache etc... (su root, then "reboot now")
____________________________
administrator@MeshCentral:~$ node -v
v16.15.0
administrator@MeshCentral:~$ npm -v
8.5.5
administrator@MeshCentral:~$
_______________________________
Ahhhhh..... much better
***************Installing the mongo database******************
This installs version 4.4 of the mongo db...the latest mongo version for Debian is 5.0 so I'm installing a *slightly* older version, it seems to feel better.
sudo apt install dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
sudo add-apt-repository 'deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main'
sudo apt update
sudo apt install mongodb-org
sudo systemctl start mongod
sudo systemctl enable mongod
systemctl status mongod
(should show active and running)
*********** port permissions***********
whereis node
returns:
node: /usr/bin/node /usr/local/bin/node /usr/share/man/man1/node.1.gz
so I did:
sudo setcap cap_net_bind_service=+ep /usr/bin/node
sudo setcap cap_net_bind_service=+ep /usr/local/bin/node
not sure if it's necessary for both paths (/usr/bin/node and /usr/local/bin/node) *shrug* but probably won't hurt anything
**************** install meshCentral****************
npm install meshcentral
...and everything installed fine... got a couple npm notices... but just minor version upgrades, nothing signifiant.
node ./node_modules/meshcentral
edit the "~/meshcentral-data/config.json" file and add the mongo database line and uncomment the setting you need/want
(this is covered in the meshcentral docs)
"MongoDb": "mongodb://127.0.0.1:27017/meshcentral",
then from the docs:
echo "node ./node_modules/meshcentral > stdout.txt 2> stderr.txt &" > mcstart
chmod 755 mcstart
echo "pkill –f node_modules/meshcentral" > mcstop
chmod 755 mcstop
so the command "./mcstart" will now start meshcentral
************* straight from the docs ***********************
6.7 Automatically starting the server
Since Ubuntu 18.04 supports systemd, we are going to use that to auto-start MeshCentral in the
background. First, we need to know our own username and group. If we do “ls -l” in our home folder
we get for example:
drwxr-xr-x 2 default default 4096 Jul 20 00:03 Desktop
drwxr-xr-x 2 default default 4096 Jul 20 00:03 Documents
drwxr-xr-x 2 default default 4096 Jul 20 00:03 Downloads
…
Note the username and group name, in this example it’s “default” for both. We need this information
to create the system service description file. To create this file type:
sudo pico /etc/systemd/system/meshcentral.service
Then enter the following lines:
[Unit]
Description=MeshCentral Server
[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=/usr/bin/node /home/default/node_modules/meshcentral
WorkingDirectory=/home/default
Environment=NODE_ENV=production
User=default
Group=default
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
----- definitely want to read the docs on this part (the Ubuntu part)---- and edit the "meshcentral.service" file appropiately
Once this is done, you can now start, enable, stop and disable using the following commands:
sudo systemctl enable meshcentral.service
sudo systemctl start meshcentral.service
sudo systemctl stop meshcentral.service
sudo systemctl disable meshcentral.service
I did one last hard reboot to make sure everything work as expected...and it did.
5/13/22