A step-by-step guide for starting a local cluster.
I will use docker to simulate environments in this reposotory. You definitely can use real machines to do it. Just remember to replace these IPs to yours
solana-local-cluster/workspace/prepare-new-validator-keys.sh
Lines 12 to 15 in 1554bc3
solana-local-cluster/workspace/validator.sh
Lines 7 to 8 in 1554bc3
follow https://docs.solana.com/running-validator/validator-start#system-tuning
git clone https://github.com/yihau/solana-local-cluster.git
docker network create --driver=bridge --subnet=192.168.0.0/8 solana-cluster
docker run -it --name validator-1 --network=solana-cluster --ip=192.168.0.101 ubuntu:20.04 bash
docker run -it --name validator-2 --network=solana-cluster --ip=192.168.0.102 ubuntu:20.04 bash
docker cp workspace validator-1:/workspace
docker cp workspace validator-2:/workspace
apt update && apt install curl -y && sh -c "$(curl -sSfL https://release.solana.com/v1.16.5/install)" && export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
switch to validator-1
container
cd workspace && ./start-bootstrap-validator.sh
you can use these commands to check the cluster status
solana -ul validators
solana -ul gossip
(If it doesn't look correct, maybe there is some information in /workspace/logs
)
switch to validator-2
container
cd workspace && ./start-validator.sh
You can switch back to validator-1
and check cluster status to know if `validator-2`` has cme on board
If you want to start a cluster that includes the SPL programs, you can
- fetch spl programs
cd workspace && bash <(curl -s https://raw.githubusercontent.com/solana-labs/solana/v1.16/fetch-spl.sh)
- it will generate a file called
spl-genesis-args.sh
. Add it togenerate-genesis.sh
like
solana-genesis \
--enable-warmup-epochs \
--bootstrap-validator id.json vote.json stake.json \
--bootstrap-validator-stake-lamports 10002282880 \
--max-genesis-archive-unpacked-size 1073741824 \
--faucet-pubkey faucet.json \
--faucet-lamports 500000000000000000 \
--hashes-per-tick auto \
--cluster-type development \
+ $(cat spl-genesis-args.sh) \
--ledger ledger
- now you can start a cluster with SPL programs