Skip to content

Instantly share code, notes, and snippets.

@pmknutsen
Last active February 24, 2021 01:56
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save pmknutsen/7521a29fe8125c24eb3e to your computer and use it in GitHub Desktop.
Save pmknutsen/7521a29fe8125c24eb3e to your computer and use it in GitHub Desktop.
HOWTO Run Sia host on Ubuntu server
#HOWTO Run Sia host on Ubuntu server
#Updated: 13 august, 2016
#Tested with Sia 1.0.2 and Ubuntu 16.04
#Update 13.08.2016: Changed from using supervisor to systemd
# Create user `siad`
adduser siad
su siad
# Download and install Sia binaries
cd ~
wget https://github.com/NebulousLabs/Sia-UI/releases/download/v1.0.2/Sia-UI-v1.0.2-linux-x64.zip
unzip Sia-UI-v1.0.2-linux-x64.zip
mv Sia-UI-linux-x64/ Sia/
# Configure systemd so that siad runs on boot (and restarts in case of a crash)
# Create siad.service
nano ~/.config/systemd/siad.service
# Add these lines to siad.service
[Unit]
Description=Sia Daemon
[Service]
ExecStart=/home/siad/Sia/siad
WorkingDirectory=/home/siad/Sia/
Restart=always
[Install]
WantedBy=multi-user.target
Alias=siad.service
Note: If you are also running Sia-UI, change WorkingDirectory above to:
WorkingDirectory=/home/siad/.config/Sia-UI/sia/
# Exit to root user
exit
# Configure firewall (if ufw is in use)
ufw allow 9982
# Start siad as a service
systemctl daemon-reload
systemctl enable ~/.config/systemd/siad.service
systemctl start siad.service
# Sia should now be running as a service which can be confirmed with:
curl -s -X GET http://localhost:9980/consensus -A "Sia-Agent"
# Next, lets configure siad by changing to user `siad`:
su siad
cd ~/Sia
# Create new wallet:
./siac wallet init
# Copy down the seed to a safe location! You will need this to unlock your wallet.
# Unlock wallet (might take upwards to a minute, but probably less):
./siac wallet unlock
# Create a new wallet address that you can receive funds on:
./siac wallet address
# Configure your host settings:
# See: http://blog.sia.tech/2016/05/26/how-to-run-a-host-on-sia/
# Confirm your host status:
./siac host
# Announce your host:
./siac host announce
# If you want to run Sia on a different port and/or host, do this instead:
./siac host announce [hostname]:[port]
# Wait a few minutes/hours and confirm other nodes see you:
http://siapulse.com/page/network
@ne0ark
Copy link

ne0ark commented Apr 12, 2017

Do you need WorkingDirectory? It might not be necessary to specify it.

@jnmclarty
Copy link

jnmclarty commented May 19, 2017

Worked for me today, using Ubuntu 16.04.2 LTS Siad 1.2.1 ...up to the first curl

@Gitsack
Copy link

Gitsack commented Jul 16, 2017

Hi - i tried this but it's not working for me (Fedora Server 26):
Starting the service fails with status=203/EXEC

I put the service in /etc/systemd/system and added "User=sia" in the [Service] section, because that's my username.
Do you have a clue what's wrong?

Btw: starting the siad daemon manually works perfectly.

@ianrountree
Copy link

The "systemctl" command for me returns:

Command 'systemctl' from package 'systemd' (main)
systemct1: command not found

I'm not sure that I've been able to execute siad. Double-clicking siad doesn't work, nor does attempting to run it from the command line. (I'm running Ubuntu 16.04.2, have tried Sia v1.3.0 & 1.2.2)

@pmknutsen
Copy link
Author

@ne0ark You need WorkingDirectory if you want to use a non-default directory to store Sia's datafiles. I am not certain what the default directory is when running siad in isolation, i.e. without the UI.

@pmknutsen
Copy link
Author

@Gitsack Only thing I can think of is that its a permissions issue. Check that the user you're running siad as has permissions to run siad and read/write permissions to the data directory (WorkingDirectory).

@zeki893
Copy link

zeki893 commented Jan 16, 2018

Thanks for the guide.
This part since we exited siad, ~ != /home/siad :

systemctl enable ~/.config/systemd/siad.service

should be

systemctl enable /home/siad/.config/systemd/siad.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment