# Sui node setup guide

By [Untitled](https://paragraph.com/@0x04321bcd9f28f1bf577dfd30770813ab78eb67f4) · 2023-02-24

---

Install Sui node
----------------

**Update packages and Rust**

    sudo apt update && sudo apt upgrade -y 
    

    sudo apt install wget jq git libclang-dev libpq-dev cmake -y ⠀
    

     . <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/rust.sh)
    

**Create direcory for Sui and build binaries**

    mkdir -p $HOME/.sui
    

    git clone https://github.com/MystenLabs/sui
    
    cd sui
    ⠀
    git remote add upstream https://github.com/MystenLabs/sui
    ⠀
    git fetch upstream
    
    git checkout -B devnet --track upstream/devnet (for devnet)
    
    git checkout -B testnet --track upstream/testnet (for testnet)
    
    cargo build --release
    

**Move binaries and download genesis for devnet or mainnet**

    mv $HOME/sui/target/release/{sui,sui-node,sui-faucet} /usr/bin/
    

    cd
    

    wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob
    

    wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/blob/main/testnet/genesis.blob?raw=true
    

**Copy config:**

    cp $HOME/sui/crates/sui-config/data/fullnode-template.yaml \ $HOME/.sui/fullnode.yaml
    

**Edit config:**

    sed -i -e "s%db-path:.*%db-path: \"$HOME/.sui/db\"%; "\ "s%metrics-address:.*%metrics-address: \"0.0.0.0:9184\"%; "\ "s%json-rpc-address:.*%json-rpc-address: \"0.0.0.0:9000\"%; "\ "s%genesis-file-location:.*%genesis-file-location: \"$HOME/.sui/genesis.blob\"%; " $HOME/.sui/fullnode.yaml
    

**Create service**:

    printf "[Unit]
    Description=Sui node
    After=network-online.target
    [Service]
    User=$USER
    ExecStart=which sui-node --config-path $HOME/.sui/fullnode.yaml
    Restart=on-failure
    RestartSec=3
    LimitNOFILE=65535
    
    [Install]
    WantedBy=multi-user.target" > /etc/systemd/system/suid.service
    

**Restart service:**

    sudo systemctl daemon-reload
    

    sudo systemctl enable suid

---

*Originally published on [Untitled](https://paragraph.com/@0x04321bcd9f28f1bf577dfd30770813ab78eb67f4/sui-node-setup-guide)*
