How to Deploy a Solana Node on Linux
Thinking about becoming a validator on Solana but don't know how to start? Our step-by-step instructions will guide you through deploying a Solana validator and RPC node on Linux.
And guess what? You can earn incentives by running a Solana validator!
What is a Solana Node?
Validating transactions and maintaining security are mandatory activities that any project must perform when entering the Proof-of-Stake landscape. The Solana network can't reach those goals without its node operators - validators and RPC nodes.
Let's see how these two types of nodes are distinctive.
Consensus validators
- Role: Consensus validators are responsible for running the Solana network. Each validator performs specific tasks like verifying transactions and tracking accounts. Their contributions help ensure the security and integrity of the blockchain.
- Fee: Validators incur transaction costs for each vote they make. These fees amount to approximately 1.0 SOL per day. It's worth noting that a validator must always have enough SOL in his/her account to cover these fees.
- Incentive: Validators earn inflation rewards through vote credits. Successful voting on blocks added to the blockchain grants validators vote credits. Additionally, when your validator acts as the leader, he/she can earn transactional and storage rental fees for each block he/she produces and adds to the blockchain.
RPC (Remote Procedure Call) nodes
- Role: RPC nodes are non-voting validators. They serve as interfaces between users (in this case, developers) and the Solana blockchain. These nodes respond to blockchain-related requests, allowing users to submit transactions for block inclusion. Like an API provider, RPC nodes provide developers with access to blockchain data.
- Fee and incentive: Unlike validator nodes, RPC operators running an RPC node do not receive rewards because the node does not participate in voting. RPC nodes aren't charged any fee.
By becoming a validator, you contribute to network growth and join a passionate community of operators dedicated to the Solana ecosystem. Whether you choose to run a validator or an RPC node depends on your goals and technical background.
If you aren't confident with your technical background or have restricted hardware capacity, staking is the best way to support the network. Learn how to stake Solana with validators to earn passive income.
Solana Node Requirements
Consensus validator requirements
Minimum SOL requirements:
- No strict minimum amount of SOL.
- Vote account with a rent-exempt reserve of 0.02685864 SOL.
- Voting transactions cost up to 1.1 SOL per day.
Hardware recommendations:
CPU:
- At least 12 cores / 24 threads.
- Base clock speed of 2.8GHz or faster.
- SHA extensions instruction support (AMD Gen 3 or newer, Intel Ice Lake or newer).
- AVX2 instruction support (AVX512f is helpful).
RAM:
- At least 256GB (ECC memory suggested).
- Motherboard with a capacity of 512GB (suggested).
Disk:
- PCIe Gen3 x4 NVME SSD or better. Popular SSD choices for validators include the Samsung 970 and 980 Pro series.
- Accounts: At least 500GB (high TBW suggested).
- Ledger: At least 1TB (high TBW suggested).
- OS: Optional - at least 500GB. The OS may be installed on the ledger disk, but better performance is observed when the ledger is on its own disk. Storing accounts and ledger on the same disk is not recommended due to high IOPS.
RPC node recommendations
CPU:
- At least 16 cores / 32 threads.
RAM:
- At least 512GB or more if the account-index is used.
Disk:
- Consider a larger ledger disk in case of longer transaction history.
- Accounts and ledgers should not be stored on the same disk.
Notes on Virtual Machines on Cloud Platforms:
Running a validator on a cloud computing platform may not be cost-efficient over the long term. Non-voting API nodes can be run on VM instances for internal usage.
Docker:
Running a validator for live clusters inside Docker is not recommended and generally not supported. Docker is used only for development purposes.
Software:
- Built and run on Ubuntu 20.04.
- Prebuilt binaries are available for Linux x86_64 with AVX2 support.
- MacOS or WSL users may build from source.
Networking:
- Internet service should be at a minimum of 1GBit/s symmetric, with 10GBit/s preferred.
Port forwarding requirements:
- 8000-10000 TCP/UDP for P2P protocols (gossip, turbine, repair, etc.).
- Dynamic port range (any free 13 port range).
Port forwarding recommendations:
- 8899 TCP for JSONRPC over HTTP (can be changed with --rpc-port).
- 8900 TCP for JSONRPC over Websockets (derived, uses RPC_PORT + 1).
How to Set Up a Solana Node on Linux
How to Set Up a Solana Validator
- Open the terminal program on your trusted computer.
2. Install the Solana CLI locally using one of the following methods:
- Use Solana's Install Tool from the Solana docs.
- Build from source for a more secure and performant executable.
Verify the installation by running the following command:
solana --version
You should see the CLI version displayed.
- Configure the Solana CLI to make requests to the testnet cluster:
solana config set --url https://api.testnet.solana.com
Verify the configuration:
solana config get
Make sure the RPC URL is set to 'https://api.testnet.solana.com.'
3. Create three keypairs on your local computer:
solana-keygen new -o validator-keypair.json
solana-keygen new -o vote-account-keypair.json
solana-keygen new -o authorized-withdrawer-keypair.json
Note: The authorized-withdrawer-keypair.json contains sensitive information and should be stored securely.
4. Create a vote account:
solana config set --keypair ./validator-keypair.json
solana balance
(to check account balance)
solana airdrop 1
(to deposit SOL into the account)
Now create a vote account using the following commands:
solana create-vote-account -ut \
--fee-payer ./validator-keypair.json \
./vote-account-keypair.json \
./validator-keypair.json \
./authorized-withdrawer-keypair.json
5. Securely store the authorized-withdrawer-keypair.json file.
6. SSH into your validator server:
ssh user@<server.hostname>
7. Update your Ubuntu packages:
sudo apt updatesudo apt install
8. Create a new Ubuntu user for running the validator:
sudo adduser sol
9. Set up the hard drive for the ledger and accounts DB:
- Format and mount the ledger drive:
sudo mkfs -t ext4 /dev/nvme0n1
lsblk -f
(to check UUID)
sudo mkdir -p /mnt/ledger
sudo chown -R sol:sol /mnt/ledger
sudo mount /dev/nvme0n1 /mnt/ledger
- Format and mount the accounts DB drive (similar steps as above).
10. Linux System Tuning
- Optimize sysctl knobs:
sudo bash -c "cat >/etc/sysctl.d/21-solana-validator.conf <<EOF
net.core.rmem_default = 134217728
net.core.rmem_max = 134217728
net.core.wmem_default = 134217728
net.core.wmem_max = 134217728
vm.max_map_count = 1000000
fs.nr_open = 1000000
EOF"
sudo sysctl -p /etc/sysctl.d/21-solana-validator.conf
- Increase systemd and session file limits:
For a systemd service file:
Add LimitNOFILE=1000000
to the [Service] section of your systemd service file.
If not using a systemd service file:
Add DefaultLimitNOFILE=1000000
the [Manager]
section of /etc/systemd/system.conf
.
EOF"sudo systemctl daemon-reload
- Set process file descriptor count limit:
sudo bash -c "cat >etc/security/limits.d/90-solana-nofiles.conf <<EOF
# Increase process file descriptor count limit
* - nofile 1000000 EOF"
- Close all open sessions and log in again.
11. Copy Key Pairs:
scp validator-keypair.json sol@<server.hostname>:
scp vote-account-keypair.json sol@<server.hostname>:
12. Switch to the sol User:
su - sol
13. Install The Solana CLI on Remote Machine:
- Install Solana CLI (refer to Solana's Install Tool or build from source).
Create A Validator Startup Script:
mkdir -p /home/sol/bin
touch /home/sol/bin/validator.sh
chmod +x /home/sol/bin/validator.sh
nano /home/sol/bin/validator.sh
Paste the following contents into validator.sh:
#!/bin/bash exec solana-validator \
--identity validator-keypair.json \
--vote-account vote-account-keypair.json \
--known-validator 5D1fNXzvv5NjV1ysLjirC4WY92RNsVH18vjmcszZd8on \
--known-validator 7XSY3MrYnK8vq693Rju17bbPkCN3Z7KvvfvJx4kdrsSY \
--known-validator Ft5fbkqNa76vnsjYNwjDZUXoTWpP7VYm3mtsaQckQADN \
--known-validator 9QxCLckBiJc783jnMvXZubK4wH86Eqqvashtrwvcsgkv \
--only-known-rpc \
--log /home/sol/solana-validator.log \
--ledger /mnt/ledger \
--rpc-port 8899 \
--dynamic-port-range 8000-8020 \
--entrypoint entrypoint.testnet.solana.com:8001 \
--entrypoint entrypoint2.testnet.solana.com:8001 \
--entrypoint entrypoint3.testnet.solana.com:8001 \
--expected-genesis-hash 4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY \
--wal-recovery-mode skip_any_corrupted_record \
--limit-ledger-size
- Save the file.
14. Verifying Your Validator Is Working:
Execute the validator.sh script: /home/sol/bin/validator.sh
In a new terminal window, ssh into your server, then verify that the process is running: ps aux | grep solana-validator
Tailing The Logs: su - sol tail -f /home/sol/solana-validator.log
Gossip Protocol: Connect to your server via ssh and identify your validator's pubkey:
solana-keygen pubkey ~/validator-keypair.json
Check if your validator is registered with the gossip network:
solana gossip | grep <pubkey>
Solana Validators: Check if your validator has joined the network:
solana validators | grep <pubkey>
Solana Catchup: Check the catchup status of your validator:
solana catchup <pubkey>
15. Create a System Service
Follow the instructions for running the validator as a system service. Once configured, start the validator using the newly created service:
sudo systemctl enable --now sol
Tail the logs to ensure the validator is running properly, and use the mentioned commands to check gossip and Solana validators:
tail -f /home/sol/solana-validator*.log
That's it! You've successfully set up a Solana validator. Remember to refer to the Solana documentation for more details on each command and additional best practices.
How to Set Up an RPC Node
To set up an RPC node on Solana, you will go through similar steps of a validator deployment. However, since an RPC node doesn't vote on the block validity, you can skip out on the part 'create a vote account.'
Check out additional information about setting up an RPC node on Solana's documentation.