Install Litecoin

Z Poznámkový blok
Přejít na: navigace, hledání

Pro instalaci postupujeme:

cd /usr/src
git clone https://github.com/PadsterH2012/Debian_LitecoinCore_install
make -C Debian_LitecoinCore_install install

Po instalaci vytvoříme uživatele litecoin a připravíme konfig soubor:

LITECOIN_USER_PASSWORD=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
LITECOIN_RPC_PASSWORD=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)

sudo adduser litecoin --gecos "litecoin" --disabled-password
echo "litecoin:${LITECOIN_USER_PASSWORD}" | sudo chpasswd

rm -rf /home/litecoin/.litecoin
mkdir /home/litecoin/.litecoin

echo 'daemon=1' >> /home/litecoin/.litecoin/litecoin.conf
echo 'server=1' >> /home/litecoin/.litecoin/litecoin.conf
echo 'gen=0'    >> /home/litecoin/.litecoin/litecoin.conf
echo 'port=9333'    >> /home/litecoin/.litecoin/litecoin.conf
echo 'rpcport=9332' >> /home/litecoin/.litecoin/litecoin.conf
echo 'rpcallowip=127.0.0.1' >> /home/litecoin/.litecoin/litecoin.conf
echo 'rpcuser=litecoinuser' >> /home/litecoin/.litecoin/litecoin.conf
echo "rpcpassword=${VERTCOIN_RPC_PASSWORD}" >> /home/litecoin/.litecoin/litecoin.conf
echo 'rpcworkqueue=300'     >> /home/litecoin/.litecoin/litecoin.conf
echo 'blockmaxsize=1000000' >> /home/litecoin/.litecoin/litecoin.conf
echo 'mintxfee=0.00001'     >> /home/litecoin/.litecoin/litecoin.conf
echo 'minrelaytxfee=0.0001' >> /home/litecoin/.litecoin/litecoin.conf
echo 'maxconnections=200'   >> /home/litecoin/.litecoin/litecoin.conf

ln /home/litecoin/.litecoin/litecoin.conf /home/litecoin/litecoin.conf
chown litecoin:litecoin -R /home/litecoin/.litecoin

V adresáři /etc/init.d/ vytvoříme skript pro spuštění Litecoinu:

nano /etc/int.d/litecoind

Do něž vložíme:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          vertcoind
# Required-Start:    $local_fs $remote_fs $network $time
# Required-Stop:     $local_fs $remote_fs $network $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: vertcoind
### END INIT INFO
start() {
       echo "starting vertcoind"
       /sbin/runuser -l litecoin -c '/usr/bin/screen -L -S litecointd -m -d /usr/bin/litecoind --server -printtoconsole'
       sleep 5
       echo "vertcoind started with PID of $(ps fax | grep litecoind | grep -v grep | head -1 | awk '{print $1}')"
       echo "started vertcoind ["$(tput setaf 2)OK$(tput sgr0)"]"
}
stop() {
       echo "stopping vertcoind"
       /sbin/runuser -l litecoin -c '/usr/bin/screen -X -S litecoind quit'
       sleep 2
       echo "vertcoind stopped ["$(tput setaf 2)OK$(tput sgr0)"]"
}
case "$1" in
       start) start ;;
       stop)  stop;;
       *) echo "usage $0 start|stop" >&2
               exit 1
               ;;
esac

Zajistíme aby se skript spuštěl při startu.

chmod a+x /etc/init.d/litecoind
update-rc.d litecoind defaults