Skip to content

Instantly share code, notes, and snippets.

@AGx10k
Last active September 3, 2023 07:06
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save AGx10k/1b157dfb7fa07d5b272af6d350bb47c4 to your computer and use it in GitHub Desktop.
Save AGx10k/1b157dfb7fa07d5b272af6d350bb47c4 to your computer and use it in GitHub Desktop.
#####Solana-TdS
apt-get update && \
echo -e 'ENABLE="true"\nGOVERNOR="performance"' > /etc/default/cpufrequtils && \
apt-get install cpufrequtils moreutils && \
systemctl restart cpufrequtils.service && \
systemctl disable ondemand
#### меняем дефолтный порт ssh на рандом
#####port=$(shuf -i 10000-65000 -n 1) && echo port=$port && read -p 'please write ^^^ down your new SSH port!!!!
#####sed 's/#Port 22/Port '$port'/g' -i /etc/ssh/sshd_config && systemctl restart ssh && netstat -tanp | grep LISTEN
### дефолтные пакеты под всё подряд
apt-get -yq update && apt-get -yq install screen mc htop strace wget curl git unzip etckeeper tmux psmisc dnsutils bc jq lynx ntp net-tools software-properties-common wget whois pciutils curl lsof vim gawk rsync sudo build-essential netcat-openbsd pv ethtool file lz4 inotify-tools
### sys-info scripts from hetzner
wget https://gist.githubusercontent.com/AGx10k/bebd6297c7d8a8bd856a55ad2f2393a5/raw/b42b5d9d3edc2c9be1fe36d1518f4a68eb46f2ad/hwdata.sh -O ~/hwdata.sh && chmod +x ~/hwdata.sh
wget https://gist.githubusercontent.com/AGx10k/bebd6297c7d8a8bd856a55ad2f2393a5/raw/bcd27d4cbda68d9869dbc6844ca8c6e32448c6f0/netdata.sh -O ~/netdata.sh && chmod +x ~/netdata.sh
echo "/root/hwdata.sh && /root/netdata.sh" >> ~/.profile
curl -s https://gist.githubusercontent.com/AGx10k/90be1bda15ff48e3e9e631d5cef0a30b/raw/f1c836b94deb8b38bf5acd0c9b2268462a0ff85a/fstrim.timer > /etc/systemd/system/timers.target.wants/fstrim.timer && systemctl daemon-reload && systemctl restart fstrim.service && systemctl restart fstrim.timer
### node-exporter allow from main prometheus server only
#iptables -I INPUT -p tcp --dport 9100 ! --source prometheus-host-ip -j DROP
#apt -yq install prometheus-node-exporter
### install latest testnet release.
curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v1.1.9/install/solana-install-init.sh | sh -s - v1.10.31
export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
### exclude solana-validator from rsyslog
echo 'if $programname == "solana-validator" then stop' > /etc/rsyslog.d/01-solana-remove.conf && systemctl restart rsyslog
# service file
wget https://gist.githubusercontent.com/AGx10k/b673ecdf3acae4a0596d241c9de90abf/raw/4fa5b2c190beda79c504a1defa2e25070c5d8725/service-file-solana-tds -O /etc/systemd/system/solana.service
chmod 0644 /etc/systemd/system/solana.service
systemctl daemon-reload
systemctl enable solana.service
### https://docs.solana.com/running-validator/validator-monitor#timezone-for-log-messages
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
mkdir /root/solana
cd /root/solana
### generate identity - это уже сделали во время подачи заявки
###solana-keygen new --outfile ./validator-keypair.json
###cat validator-keypair.json &&echo
### создаём файл с ключом, который генерировали до этого
touch validator-keypair.json && chmod 0600 validator-keypair.json && echo edit validator-keypair.json && sleep 5 && vi validator-keypair.json
solana config set -ut --keypair /root/solana/validator-keypair.json
solana balance
#### 10 сек смотрим на логи и потом ctrl-c
solana-gossip spy --entrypoint testnet.solana.com:8001
###create vote account ->>> https://docs.solana.com/running-validator/validator-start#create-vote-account
solana-keygen new -o /root/solana/vote-account-keypair.json
### делаем резервную копию
cat vote-account-keypair.json &&echo
### create account on blockchain
solana create-vote-account /root/solana/vote-account-keypair.json /root/solana/validator-keypair.json
### по результатам предыдущей команды должен быть примерно такой вывод:
#Signature: длиииииннный хэш транзакции
# проверить
solana vote-account /root/solana/vote-account-keypair.json
### должно быть что-то в этом роде - 3 раза должен быть показан pubkey основной
# Account Balance: 0.02685864 SOL
# Validator Identity: <YOUR_pubkey>
# Authorized Voters: {43: "<YOUR_pubkey>"}
# Authorized Withdrawer: <YOUR_pubkey>
# Credits: 0
# Commission: 100%
# Root Slot: ~
# Recent Timestamp: BlockTimestamp { slot: 0, timestamp: 0 }
systemctl start solana
#### 20 секунд смотрим на экран и потом ctrl-c
journalctl -u solana -f -o cat
### wait for catchup - 2-3-4 итерации
while true; do echo sleep 15 and try catchup; sleep 15; solana catchup /root/solana/validator-keypair.json ; done
### create stake keypair - https://docs.solana.com/running-validator/validator-stake#create-stake-keypair
solana-keygen new -o /root/solana/validator-stake-keypair.json
### бэкапим
cat validator-stake-keypair.json &&echo
### delegate
solana create-stake-account /root/solana/validator-stake-keypair.json 1
solana delegate-stake /root/solana/validator-stake-keypair.json /root/solana/vote-account-keypair.json
### view your vote account:
solana vote-account /root/solana/vote-account-keypair.json
###View your stake account, the delegation preference and details of your stake:
solana stake-account /root/solana/validator-stake-keypair.json
solana validators
### publish info about validator
solana validator-info publish "<some name that will show up in explorer>" -n <keybase_username> -w "<website>"
### example:
###solana validator-info publish "Elvis Validator" -n elvis -w "https://elvis-validates.com"
###solana validator-info publish "Elvis Validator" -n elvis
###solana validator-info publish "Elvis Validator"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment