Skip to content

Instantly share code, notes, and snippets.

@daxxog daxxog/clambuntu.sh
Last active Jun 24, 2019

Embed
What would you like to do?
install clam on Ubuntu 18.10
#!/bin/bash
#curl -L https://gist.githubusercontent.com/daxxog/a2f5db9cbe5fd02770764ba183dc6504/raw/clambuntu.sh | sh
sudo /etc/init.d/clamd stop
cd ~
mkdir dev
cd dev
CLAMVERSION=1.4.17
rm -rf "clam-$CLAMVERSION/"
curl -L "https://github.com/nochowderforyou/clams/releases/download/v$CLAMVERSION/clam-$CLAMVERSION-linux64.tar.gz" | tar xvz
cd "clam-$CLAMVERSION/bin"
#setup config
#backup any clam data dirs
cd ~
USER_HOME_DIR=$(pwd)
CLAMD="${USER_HOME_DIR}/dev/clam-${CLAMVERSION}/bin/clamd"
mv ~/.clam ~/.clam-backup-$(date +%s)
${CLAMD}
cd ~/.clam/
CLAM_DATA_DIR=$(pwd)
#install rtorrent
curl -L https://s3.amazonaws.com/dooglus/bootstrap.dat?torrent > ${CLAM_DATA_DIR}/bootstrap.torrent
sudo apt-get install -y rtorrent tmux
#config rtorrent
rm -rf ~/.rtsession
mkdir ~/.rtsession
echo "directory = ${CLAM_DATA_DIR}" > ~/.rtorrent.rc
echo "session = ${USER_HOME_DIR}/.rtsession" >> ~/.rtorrent.rc
echo "schedule = watch_directory_1,10,10,\"load.start_verbose=${CLAM_DATA_DIR}/*.torrent,d.directory.set=${CLAM_DATA_DIR}/\"" >> ~/.rtorrent.rc
echo "method.set_key = event.download.finished,clam_touchdown,\"execute=touch,${CLAM_DATA_DIR}/touched\"" >> ~/.rtorrent.rc
echo "port_random = yes" >> ~/.rtorrent.rc
echo "check_hash = yes" >> ~/.rtorrent.rc
echo "dht = auto" >> ~/.rtorrent.rc
echo "dht_port = 6881" >> ~/.rtorrent.rc
#download the bootstrap.dat file
tmux new-session -s rtorrent -d rtorrent
echo downloading bootstrap.dat ..
echo via https://s3.amazonaws.com/dooglus/bootstrap.dat?torrent
echo run -:{
echo tmux a -t rtorrent
echo }:- to watch download
while [ ! -f ${CLAM_DATA_DIR}/touched ]; do sleep 10; done
echo bootstrap.dat download complete
#generate rpc password
echo generating secure password ..
CLAM_RPC_PASS=$(curl -L https://gist.githubusercontent.com/daxxog/adaf9b38ecc4a82ce3ee846f5632801b/raw/randompass.sh | bash)
#setup rpc
echo "rpcuser=clamrpc" > ${CLAM_DATA_DIR}/clam.conf
echo "rpcpassword=${CLAM_RPC_PASS}" >> ${CLAM_DATA_DIR}/clam.conf
#provide more useful logs
echo "logtimestamps=1" >> ${CLAM_DATA_DIR}/clam.conf
#help combat blockchain spam attack
echo "mininput=0.01" >> ${CLAM_DATA_DIR}/clam.conf
#setup good settings for staking
echo "combineany=1" >> ${CLAM_DATA_DIR}/clam.conf
echo "splitsize=45" >> ${CLAM_DATA_DIR}/clam.conf
#let the user know what the settings are
echo "${CLAM_DATA_DIR}/clam.conf"
cat ${CLAM_DATA_DIR}/clam.conf
#daemonize clam and run clam on startup
sudo touch /etc/init.d/clamd
curl -L https://gist.githubusercontent.com/daxxog/33cf309fec8c586cc66195b85509ca7d/raw/clamd-p1.sh > ~/._tmpclamd
echo "sudo -u ${USER} nohup ${CLAMD} >> /dev/null &" >> ~/._tmpclamd
curl -L https://gist.githubusercontent.com/daxxog/eb206c3ec6f53c5226f65f4f612ec62d/raw/clamd-p2.sh >> ~/._tmpclamd
sudo chown root ~/._tmpclamd
sudo mv ${USER_HOME_DIR}/._tmpclamd /etc/init.d/clamd
sudo chmod 755 /etc/init.d/clamd
sudo update-rc.d clamd defaults
cat /etc/init.d/clamd
#install 751 hotfix
curl -L https://gist.githubusercontent.com/daxxog/6be58adf84ae3000c403346b278bae20/raw/hotfix751.sh | sh
#start the clam client
sudo /etc/init.d/clamd start
#start the 751 hotfix
sudo /etc/init.d/clamd751 start
echo install finished!
echo clam is running, to view logs type:
echo tail -f ${CLAM_DATA_DIR}/debug.log
echo and
echo tail -f ${CLAM_DATA_DIR}/751debug.log
echo you can now reboot the system with
echo sudo reboot
echo clamd will now start at bootup with 751 hotfix enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.