How to install grin on Ubuntu Server from scratch

Say you have a fresh new install of Ubuntu Server, the regular edition not core, what are all the commands you run to prepare for and install a precompiled binary from the main Mimblewimble Releases section on github?

This is a dupe thread of a previous on I made but I’m still stuck on this digging through old notes and guides that I thought should still work.

So new brainstorming thread. At a bare minimum to say that there is still a pulse in this community we have got to be able to at least figure this out.

I’ll be back with what I have from the old notes.

@Yeastplume @tromp notifying you just in case you’ve done this any time recently.

wget grin node bin, then create separate user (grin in my case) to create systemd service
sudo nano /etc/systemd/system/grin-main.service:

[Unit]
Description=Grin Mainnet node
After=network.target

[Service]
WorkingDirectory=/home/grin
User=grin
Group=users
#PrivateDevices=yes
#Type=simple
ExecReload="/bin/kill -HUP $MAINPID"
KillMode=mixed
KillSignal=SIGTERM
TimeoutStopSec=60
ExecStart=/home/grin/grin server run
Restart=on-failure
RestartSec=30

[Install]
WantedBy=multi-user.target
Alias=grin-main.service

then start and enable service to launch it on system boot:
sudo service grin-main start/enable

3 Likes

How to run grin as a service information can also be found in the docs/wiki:

1 Like

For a fresh linux server it is pretty simple - you do not need any extra packages for pre-compiled grin-node and wallet. Just download sources from grin.mw github Repo:

wget https://github.com/mimblewimble/grin/releases/latest/download/grin-$VERSION-linux-amd64.tar.gz
wget https://github.com/mimblewimble/grin-wallet/releases/latest/download/grin-wallet-$VERSION-linux-amd64.tar.gz

Then extract bin:

sudo tar -C /usr/local/bin -xzf grin-$VERSION-linux-amd64.tar.gz --strip-components=1
sudo tar -C /usr/local/bin -xzf grin-wallet-$VERSION-linux-amd64.tar.gz --strip-components=1

Note if you have downloaded it in the root folder you do not need the strip-components arguments.

Then just run the node and wait 3-4 hours for sync:

grin

Meanwhile you can init your wallet:

grin-wallet init

Then open the ports for wallet listener grin-node, startum and API:

ufw allow 3413
ufw allow 3414
ufw allow 3415
ufw allow 3416

If you want to mine go into folder ./grin/main. Open server config-File:

nano grin-server.toml

There you can enalbe stratum server. Note for mining you have also to enable the grin-wallet listener:

grin-wallet listen

For better xp on linux server start grin and the wallet listener with screen. Then the process does not terminate when you close ssh-session.

Have fun mate.

4 Likes

While we’re showering you with options, here is another. A simple ansible playbook. Just pop in your host/group and the SHA-512 hash of your desired password for the grin user and it’ll land grin and grin-wallet in the home folder. I monitor my solo mining so I run a mix of tmux and screen to keep my nodes quick to pull up and monitor.

1 Like

This was my regular process before and it’s not working for me now with the current release.

wget https://github.com/mimblewimble/grin/releases/latest/download/grin-v5.3.3_rebuild-linux-x86_64.tar.gz
sudo tar -C /usr/local/bin -xzf grin-v5.3.3_rebuild-linux-x86_64.tar.gz --strip-components=1
grin

^ Does not work

wget https://github.com/mimblewimble/grin/releases/download/v5.2.0-beta.3/grin-v5.2.0-beta.3-linux-amd64.tar.gz
sudo tar -C /usr/local/bin -xzf grin-v5.2.0-beta.3-linux-amd64.tar.gz --strip-components=1
grin

^ Works

So I vaguely assume that the “tar -C /usr/local/bin -xzf” process is somehow supposed to register “grin” as a program that can be run from any context on the system, such as when I run it as my user account from my home directory. And if that’s true then this registration seems to be broken in the latest version.

@Yeastplume I’ll try to open a github issue for this unless you stop me here.

If I first run:

wget https://github.com/mimblewimble/grin/releases/download/v5.2.0-beta.3/grin-v5.2.0-beta.3-linux-amd64.tar.gz
sudo tar -C /usr/local/bin -xzf grin-v5.2.0-beta.3-linux-amd64.tar.gz --strip-components=1
grin

wget https://github.com/mimblewimble/grin/releases/latest/download/grin-v5.3.3_rebuild-linux-x86_64.tar.gz
sudo tar -C /usr/local/bin -xzf grin-v5.3.3_rebuild-linux-x86_64.tar.gz --strip-components=1
grin

The grin window that launches still shows 5.2.0-beta.3 as the running version. So it doesn’t seem like tar extracting the new one over the top of a working old one does the trick either.

Had the same issues with the latest version and picked like you the previous one.

1 Like

New archive doesn’t contain an upper level “grin” directory, so remove --strip-components option from your command.

2 Likes

This is it! Thank you.

I’m looking at my pre-existing grin servers with grin already running as a service, and it looks like I’m using a .service file there that just contains this:

[Unit]
Description=Grin Node Service
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/grin
Restart=always
User=user
Group=user

[Install]
WantedBy=multi-user.target

And then:

sudo systemctl enable grinnode.service
sudo systemctl start grinnode.service

Then to check running status:

curl -s --user grin:$(cat ~/.grin/main/.api_secret) -d '{"id":"1","method":"get_status","params":{}}' -o - http://127.0.0.1:3413/v2/owner

But this service file and process is not working for me now with current version grin installed. I may have messed something up in the attempts to install grin at the wrong folder level.

I see that there is a more complicated .service file example being recommended, but if I can get away with continuing to use the simple one I’d prefer to keep it.

Probabaly you just have to check that the path still matches. Now you file says

Type=simple
ExecStart=/usr/local/bin/grin

If you do not have the grin folder, perhaps it should be.

Type=simple
ExecStart=/usr/local/bin/

Just check where you put the grin binary/executable and reference its top directory.

1 Like

Trying that now but I have /usr/local/bin/grin with grin being there directly as an executable, not a folder.

I don’t see the executable name elsewhere in the service config file, so I feel like it does need to be included in the execution path there.

I am not sure how these service files work, maybe since you use the simple approach it requires a directory with a single executable? You can make it like before, create a grin folder move the grin executable there using mkdir and mv.