Skip to content

Instantly share code, notes, and snippets.

@daxxog daxxog/
Last active May 4, 2019

What would you like to do?
Install clamd on the Raspberry PI 3
# CLAM easy install script for Raspberry PI
# curl -L | sh
# Copyright (c) 2014-2018 The CLAM developers
#setup dev working directory
cd ~
mkdir dev
cd dev
#download clam source and build prerequisites
curl -L | tar xvz
sudo apt-get update
sudo apt-get upgrade
sudo apt-get remove -y openssl
sudo apt-get install -y build-essential libtool autotools-dev autoconf pkg-config libboost-all-dev db4.8-util libssl1.0-dev libminiupnpc-dev
cd clams-1.4.17/
#copy pasted from ->
#modded by daXXog
#go back to clam-root
#patch chainparams.cpp -dXg
cp "${CLAM_ROOT}/src/chainparams.cpp.bak" "${CLAM_ROOT}/src/chainparams.cpp"
cp "${CLAM_ROOT}/src/chainparams.cpp" "${CLAM_ROOT}/src/chainparams.cpp.bak"
curl -L | patch "${CLAM_ROOT}/src/chainparams.cpp"
#patch system swapfile from 100 to 1024 -dXg
cd ~
echo "cat $(pwd)/.dphys-swapfile.bak > /etc/dphys-swapfile" > ~/
chmod +x ~/
sudo ~/
cat /etc/dphys-swapfile > ~/.dphys-swapfile.bak
curl -L | sudo patch /etc/dphys-swapfile
cat /etc/dphys-swapfile
sudo /etc/init.d/dphys-swapfile restart
# Pick some path to install BDB to, here we create a directory within the clam directory
mkdir -p $BDB_PREFIX
# just Fetch the source
curl -L | tar xvz
# Build the library and install to our prefix
cd db-4.8.30.NC/build_unix/
# Note: Do a static build so that it can be embedded into the exectuable, instead of having to find a .so at runtime
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
make -j3
make install
# Configure Clam Core to use our own-built instance of BDB & SSL
./configure --enable-upnp-default LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/"
#copy pasted from ->
#modded by daXXog
#build and install
make -j2
sudo make install
#setup config
#backup any clam data dirs
mv ~/.clam ~/.clam-backup-$(date +%s)
cd ~/.clam/
cd ~
#install rtorrent
curl -L > ${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=${CLAM_DATA_DIR}/*.torrent,d.set_directory=${CLAM_DATA_DIR}/\"" >> ~/.rtorrent.rc
echo "system.method.set_key =,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
echo "peer_exchange = yes" >> ~/.rtorrent.rc
#download the bootstrap.dat file
tmux new-session -s rtorrent -d rtorrent
echo downloading bootstrap.dat ..
echo via
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 | 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 > ~/._tmpclamd
echo "sudo -u ${USER} nohup clamd >> /dev/null &" >> ~/._tmpclamd
curl -L >> ~/._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
#start the clam client
sudo /etc/init.d/clamd start
echo install finished!
echo clam is running, to view logs type:
echo tail -f ${CLAM_DATA_DIR}/debug.log
echo you can now reboot the system with
echo sudo reboot
echo clamd will now start at bootup
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.