This post is more of a note to myself. First here is the script, and explanations follow. For a first-time installation, refer to How to install MJ12node on Ubuntu 18.04.
wget https://example.com/mj12node_linux_v1721_net471.tgz tar xf mj12node_linux_v1721_net471.tgz cp -r MJ12node/* MJ12nodeA cp -r MJ12node/* MJ12nodeB cp -r MJ12node/* MJ12nodeC cp -r MJ12node/* MJ12nodeD cp -r MJ12node/* MJ12nodeE cp -r MJ12node/* MJ12nodeF cp -r MJ12node/* MJ12nodeG cp -r MJ12node/* MJ12nodeH cp -r MJ12node/* MJ12nodeI screen -dm bash -c 'cd MJ12nodeA; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeB; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeC; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeD; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeE; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeF; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeG; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeH; ./run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeI; ./run.py -t; exec bash'
The first line downloads the file containing the new version (obviously, adapt with the proper URL).
Then we unpack it: its contents all goes into a “MJ12node” folder (again, adapt with the proper name).
Then we copy the contents of that new MJ12node folder into existing nodes. By default, cp should just overwrite without asking for confirmation. If not, you may want to look into this guide.
Finally, we launch each node in a dedicated and detached screen session. For this, this screen reference was pretty helpful as well as this StackExchange answer (wasn’t picked as the best answer, as it often happens with real best answers – meh).
Update (2021-11-23)
Since I recently had to set everything up again, some additions for 1st-time installation:
mkdir MJ12nodeA mkdir MJ12nodeB mkdir MJ12nodeC mkdir MJ12nodeD mkdir MJ12nodeE mkdir MJ12nodeF mkdir MJ12nodeG mkdir MJ12nodeH mkdir MJ12nodeI chmod 744 MJ12nodeA/run.py chmod 744 MJ12nodeB/run.py chmod 744 MJ12nodeC/run.py chmod 744 MJ12nodeD/run.py chmod 744 MJ12nodeE/run.py chmod 744 MJ12nodeF/run.py chmod 744 MJ12nodeG/run.py chmod 744 MJ12nodeH/run.py chmod 744 MJ12nodeI/run.py
(to mix it up with the commands listed higher, it’s first mkdir then cp then chmod then screen)
Additionally, I found a slightly more comfortable way to run in screen: the original version said things like screen -dm bash -c 'cd MJ12nodeH; ./run.py -t; exec sh'
, but replacing sh
with bash
gives more features.
Also, here’s an updated list of dependencies for Ubuntu 21.10:
sudo apt-get install python mono-runtime libmono-sqlite4.0-cil bind9
It appears that libmono-corlib4.5-cil is no longer necessary and that Python isn’t installed by default now.
Bind isn’t strictly mandatory, but if you don’t have it or an equivalent, you’ll get a much higher DNS error rate.
Lastly, a tip to speed up configuring your nodes: you can just start and configure one node, then copy the config file to other (non running) nodes. You then just need to change the node name in the config file (config.xml => PeerNodeCfg => NodeName), and you’re all good to go.
Update (2022-11-27)
Reinstalling this into Ubuntu 22.04 LTS, package “python” is no more so I had to install python2 instead (yup, MJ12 is not python 3 yet 🙁 ). After a brief search, I couldn’t find a trivial way to solve “bash: ./run.py: /usr/bin/python: bad interpreter: No such file or directory”, so I also replaced the starting command with “python2 run.py”, so let’s recap:
sudo apt-get install python2 mono-runtime libmono-sqlite4.0-cil bind9
screen -dm bash -c 'cd MJ12nodeA; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeB; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeC; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeD; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeE; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeF; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeG; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeH; python2 run.py -t; exec bash' screen -dm bash -c 'cd MJ12nodeI; python2 run.py -t; exec bash'
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.