123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- #!/bin/bash
- set -e
- script_version="1.50b"
- rdate="24/12/2018"
- remote_folder="http://wareck.free.fr/openrig"
- cuda="9.2" # 9.2 or 8
- #### OPTIONS ####
- ETHMine="YES"
- CCminer="YES"
- XmrRig="YES"
- XmrStak="YES"
- Zecminer="YES"
- swap_size="0" # 0/4/8/16 Go
- #script_version=`grep version version.txt | awk '{ print $2 }'`
- #rdate=`grep release version.txt | awk '{ print $2 }'`
- if [ $UID -ne 0 ]
- then
- echo -e "\n\e[91mPlease run this script as ROOT : sudo ./setup.sh \e[0m"
- echo
- sleep 1
- exit
- fi
- claymore_dual_v="`curl -s $remote_folder/version.txt | awk 'NR==1 {print$3; exit}'`"
- claymore_zcash_v="`curl -s $remote_folder/version.txt | awk 'NR==2 {print$3; exit}'`"
- claymore_xmr_v="`curl -s $remote_folder/version.txt | awk 'NR==3 {print$3; exit}'`"
- echo ""
- echo -n -e " \e[97m\u2554"
- for i in {1..41}; do echo -e -n "\u2550"; done
- echo -e "\u2557\e[0m"
- echo -e " \e[97m\u2551 NVIDIA Mining Rig Auto-install \e[93m"V$script_version"\e[0m\e[97m \u2551\e[0m"
- echo -e " \e[97m\u2551 Release date: \e[93m"$rdate"\e[0m\e[97m \u2551\e[0m"
- echo -e " \e[97m\u2551 wareck@gmail.com \u2551\e[0m"
- echo -n -e " \e[97m\u255A"
- for j in {1..41}; do echo -e -n "\u2550";done
- echo -e -n "\u255D\e[0m"
- echo
- echo -e "\e[97m +\e[91m Cuda toolkit v$cuda \e[0m\e[97m"
- if [ $ETHMine = "YES" ]; then echo -e "\e[97m +\e[91m Etherminer \e[0m\e[97m";fi
- if [ $CCminer = "YES" ]; then echo -e "\e[97m +\e[91m CCminer \e[0m\e[97m";fi
- if [ $XmrRig = "YES" ]; then echo -e "\e[97m +\e[91m XMR_Rig \e[0m\e[97m";fi
- if [ $XmrStak = "YES" ]; then echo -e "\e[97m +\e[91m XMR_Stak \e[0m\e[97m";fi
- if [ $Zecminer = "YES" ]; then echo -e "\e[97m +\e[91m Ewbf_Zecminer \e[0m\e[97m";fi
- if [ $Zecminer = "YES" ]; then echo -e "\e[97m +\e[91m Ewbf_Zecminer_mod \e[0m\e[97m";fi
- echo -e "\e[97m +\e[91m Claymore dualminer $claymore_dual_v\e[0m\e[97m"
- sleep 4
- sed -i -e "s/# set const/set const/g" /etc/nanorc
- echo -e "\n\e[95mExpand Disk :\e[0m"
- sudo growpart `df -h | grep /dev/sd | awk ' { print $1 }'| cut -c -8` 1 |true
- sudo resize2fs `df -h | grep /dev/sd | awk ' { print $1 }'` |true
- echo -e "\e[97mDone !\e[0m"
- echo -e "\n\e[95mSystem Update :\e[0m"
- #sudo apt-get update
- #sudo add-apt-repository -y ppa:ethereum/ethereum -y
- sudo apt-get update
- sudo apt install git screen htop curl ntp pv git cmake libleveldb-dev libjsoncpp-dev \
- build-essential libcurl4-gnutls-dev libgmp-dev libtool \
- libreadline-dev libmicrohttpd-dev libjansson-dev libgmp-dev libssl-dev unzip python-nfqueue python-scapy -y
- if [ $CCminer = "YES" ]
- then
- sudo apt-get install libcurl4-openssl-dev libssl-dev libjansson-dev automake autotools-dev build-essential -y
- fi
- if [ $XmrRig = "YES" ]
- then
- sudo apt-get install git build-essential cmake libuv1-dev libmicrohttpd-dev -y
- fi
- cd ~
- sleep 5
- sudo sed -i -e "s/quiet splash/text/g" /etc/default/grub
- sudo sed -i -e 's#GRUB_CMDLINE_LINUX=""#GRUB_CMDLINE_LINUX="amddgpu.vm_fragment_size=9"#g' /etc/default/grub
- sudo update-grub2
- sudo apt dist-upgrade -y
- echo -e "\n\e[95mInstall Nvidia Drivers :\e[0m"
- sudo add-apt-repository ppa:graphics-drivers/ppa -y
- sudo apt-get update
- sudo apt-get install nvidia-396 -y
- cd /tmp
- if [ $cuda = "9.2" ]
- then
- wget -c http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.2.148-1_amd64.deb
- sudo dpkg -i cuda-repo-ubuntu1604_9.2.148-1_amd64.deb
- sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
- sudo apt-get update
- sudo apt-get install cuda -y
- fi
- if [ $cuda = "8" ]
- then
- wget -c https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
- sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
- sudo apt-get update
- sudo apt-get install cuda-8-0 -y
- fi
- echo -e "\n\e[95mInstall script miner.sh :\e[0m"
- cd ~
- sudo -u work curl -sf http://wareck.free.fr/openrig/files/miner_nvidia.sh.tar.xz | tar xvJ
- sudo chown work /home/work/miner.sh
- echo -e "\n\e[95mInstall Claymore Miners :\e[0m"
- cd ~
- sudo -u work curl -sf $remote_folder/miners/claymore_dual_$claymore_dual_v.tar.xz | tar xvJ
- sudo chown work claymore
- echo ""
- if [ $Zecminer = "YES" ]
- then
- echo -e "\n\e[95mInstall ZecMiner :\e[0m"
- cd ~
- sudo -u work curl -sf $remote_folder/miners/zecminer_nvidia.tar.xz | tar xvJ
- echo -e "\n\e[95mInstall ZecMiner_mod :\e[0m"
- if [ $cuda = "8" ]
- then
- sudo -u work curl -sf $remote_folder/miners/zecminer_nvidia_mod_cuda8.tar.xz | tar xvJ
- else
- sudo -u work curl -sf $remote_folder/miners/zecminer_nvidia_mod_cuda9.tar.xz | tar xvJ
- fi
- echo ""
- fi
- if [ $ETHMine = "YES" ]
- then
- echo -e "\n\e[95mInstall ETHMiner :\e[0m"
- cd ~
- if [ ! -d cpp_ethminer ]
- then
- git clone -n https://github.com/ethereum-mining/ethminer.git cpp_ethminer
- cd cpp_ethminer
- git checkout 2200dca33d35273fb2a7843a7d313a9a31bcd246
- else
- cd cpp_ethminer
- git pull
- cd ~
- fi
- cd ~/cpp_ethminer
- git submodule update --init --recursive
- mkdir build |true
- cd build
- cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF
- make
- cd ~
- ln -s cpp_ethminer/build/ethminer/ethminer ethminer | true
- fi
- if ! [ -d cpp_ethminer/build/ethminer/kernels ]
- then
- cd /tmp
- wget http://wareck.free.fr/grinder/cpp_ethminer_kernel.tar.xz
- tar xvfJ cpp_ethminer_kernel.tar.xz
- sudo cp kernels ~/cpp_ethminer/build/ethminer/ | true
- fi
- cd ~
- echo -e "\e[97mDone !\e[0m"
- if [ $CCminer = "YES" ]
- then
- echo -e "\n\e[95mInstall ccminer :\e[0m"
- cd ~
- if [ ! -d ccminer ]
- then
- git clone https://github.com/tpruvot/ccminer.git
- cd ccminer
- sudo sed -i -e "s/#nvcc_ARCH += -gencode=arch=compute_61,code=/nvcc_ARCH += -gencode=arch=compute_61,code=/g" Makefile.am
- sudo sed -i -e "s/nvcc_ARCH += -gencode=arch=compute_50,code/#nvcc_ARCH += -gencode=arch=compute_51,code/g" Makefile.am
- ./build.sh
- else
- cd ccminer
- git pull
- make -j $(nproc)
- fi
- fi
- if [ $XmrRig = "YES" ]
- then
- echo -e "\n\e[95mInstall XMRig :\e[0m"
- cd ~
- if ! [ -d xmrig ]
- then
- git clone https://github.com/xmrig/xmrig.git
- else
- cd xmrig
- git pull
- fi
- cd ~/xmrig
- mkdir build | true
- cd build
- cmake ..
- make -j $(nproc)
- fi
- if [ $XmrStak = "YES" ]
- then
- echo -e "\n\e[93mBuiling XMR-stak $xmr_stak_v:\e[0m"
- cd /tmp/
- wget http://wareck.free.fr/grinder/hwloc-1.11.8.tar.xz
- tar xvfJ hwloc-1.11.8.tar.xz
- cd hwloc-1.11.8
- ./autogen.sh
- ./configure --prefix=/usr/local
- make -j $(nproc)
- sudo make install
- cd ~
- if ! [ -d xmr-stak ];then git clone https://github.com/fireice-uk/xmr-stak.git;fi
- chown -R work xmr-stak
- cd xmr-stak
- git pull
- if [ -d build ]
- then
- rm -r build
- fi
- mkdir build
- sed -i -e "s/= 2.0/= 0.0/g" xmrstak/donate-level.hpp
- cd build
- cmake -DCUDA_ENABLE=ON -DHWLOC_ENABLE=OFF -DCPU_ENABLE=OFF -DOpenCL_ENABLE=OFF -DOpenSSL_ENABLE=ON -DMICROHTTPD_ENABLE=OFF -DCMAKE_LINK_STATIC=ON ..
- sleep 2
- make -j $(nproc)
- cd ~
- if [ -f ~/xmr-miner ];
- then
- sudo rm ~/xmr-miner;
- fi
- ln -s xmr-stak/build/bin/xmr-stak ~/xmr-miner | true
- if ! [ -L /usr/lib/x86_64-linux-gnu/libxmrstak_cuda_backend.so ]
- then
- sudo cp xmr-stak/build/bin/libxmrstak_cuda_backend.so /usr/lib/x86_64-linux-gnu/libxmrstak_cuda_backend.so |true
- sudo cp xmr-stak/build/bin/libxmr-stak-c.a /usr/lib/x86_64-linux-gnu/ |true
- sudo cp xmr-stak/build/bin/libxmr-stak-backend.a /usr/lib/x86_64-linux-gnu/ |true
- fi
- echo
- sleep 2
- if ! grep -q "vm.nr_hugepages=256" /etc/sysctl.conf
- then
- sudo bash -c 'echo "vm.nr_hugepages=256" >> /etc/sysctl.conf'
- sudo bash -c 'sysctl -p'
- fi
- fi
- echo -e "\n\e[95mDownloading NoFees Patch:\e[0m"
- cd ~
- if [ -d remove_miner_fees ]
- then
- cd remove_miner_fees
- git pull
- else
- git clone https://github.com/wareck/remove_miner_fees.git
- chown -R work remove_miner_fees
- fi
- chmod 777 /etc/rc.local
- if ! grep --quiet "/home/work/remove_miner_fees" /etc/rc.local
- then
- sed -i "s/exit 0//g" /etc/rc.local
- RC_LOCAL_CMD0="#python /home/work/remove_miner_fees/remove_mining_fees.py &"
- RC_LOCAL_CMD1="#python /home/work/remove_miner_fees/zcach.py &"
- RC_LOCAL_CMD2="#python /home/work/remove_miner_fees/hush.py &"
- RC_LOCAL_CMD3="#python /home/work/remove_miner_fees/ubiq.py &"
- RC_LOCAL_CMD4="#python /home/work/remove_miner_fees/soilcoin.py &"
- echo $RC_LOCAL_CMD0 >>/etc/rc.local
- echo $RC_LOCAL_CMD1 >>/etc/rc.local
- echo $RC_LOCAL_CMD2 >>/etc/rc.local
- echo $RC_LOCAL_CMD3 >>/etc/rc.local
- echo $RC_LOCAL_CMD4 >>/etc/rc.local
- echo "exit 0" >>/etc/rc.local
- fi
- echo -e "\e[97mDone !\e[0m"
- echo -e "\n\e[95mInstall AutoStart:\e[0m"
- if [ -f /home/work/.config/autostart/miner.sh.desktop ];then rm /home/work/.config/autostart/miner.sh.desktop |true ; fi
- if ! [ -d /home/work/.config ]; then mkdir /home/work/.config ;fi
- if ! [ -d /home/work/.config/autostart ]; then mkdir /home/work/.config/autostart;fi
- cat <<EOF>> /home/work/.config/autostart/miner.sh.desktop
- [Desktop Entry]
- Type=Application
- Exec=/home/work/miner.sh
- Hidden=false
- NoDisplay=false
- X-GNOME-Autostart-enabled=true
- Name[fr_FR]=miner
- Name=miner
- Comment[fr_FR]=miner
- Comment=miner
- EOF
- sleep 5
- chmod 777 /etc/rc.local
- if ! grep --quiet "su work -c '/home/work/miner.sh'" /etc/rc.local
- then
- sed -i "s/exit 0//g" /etc/rc.local
- RC_LOCAL_CMD0="su work -c '/home/work/miner.sh'"
- echo $RC_LOCAL_CMD0 >>/etc/rc.local
- echo "exit 0" >>/etc/rc.local
- fi
- echo -e "\e[97mDone !\e[0m"
- echo -e "\n\e[95mMessage of the day mod :\e[0m"
- rm /etc/update-motd.d/00-header | true
- rm /etc/update-motd.d/10-help-text |true
- rm /etc/update-motd.d/90-updates-available |true
- rm /etc/update-motd.d/91-release-upgrade |true
- rm /etc/update-motd.d/98-fsck-at-reboot |true
- rm /etc/update-motd.d/98-reboot-required |true
- echo " - 00-header "
- cat <<EOF >> /etc/update-motd.d/00-header
- #!/bin/sh
- [ -r /etc/lsb-release ] && . /etc/lsb-release
- if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
- # Fall back to using the very slow lsb_release utility
- DISTRIB_DESCRIPTION=$(lsb_release -s -d)
- fi
- printf "Welcome to %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" " $(uname -o)" "$(uname -p)"
- EOF
- cd /etc/update-motd.d
- sudo -u work curl -sf http://folivier.homelinux.org/genethos/files/motd.tar.xz | tar xJ
- cd ~
- sed -i -e "s/#force_color_prompt=yes/force_color_prompt=yes/g" /home/work/.bashrc
- if ! grep --quiet "export DISPLAY=:0" /home/work/.bashrc
- then
- cat <<EOF>> /home/work/.bashrc
- export DISPLAY=:0
- echo -e "\e[93m
- _ _
- _| |_|___ ___ ___ ___
- | . | | . | . | -_| _|
- |___|_|_ |_ |___|_|
- |___|___| v$script_version
- \e[0m"
- EOF
- fi
- echo -e "\e[97mDone !\e[0m"
- echo -e "\n\e[95mBuilding Swapfile :\e[0m"
- if ! grep -q "swapfile" /etc/fstab ; then
- case $swap_size in
- 0) fst="0";;
- 4) sudo dd if=/dev/zero | pv -s 4G | dd of=/swapfile iflag=fullblock bs=1024 count=4194304;;
- 8) sudo dd if=/dev/zero | pv -s 8G | dd of=/swapfile iflag=fullblock bs=1024 count=8388608;;
- 16) sudo dd if=/dev/zero | pv -s 16G | dd of=/swapfile iflag=fullblock bs=1024 count=16777216 ;;
- *) echo -e "\e[91mError in configuration !\e[0m" && exit ;;
- esac
- if ! [ $swap_size = "0" ]
- then
- sudo mkswap /swapfile
- sudo swapon /swapfile
- sudo cat <<'EOF'>> /etc/fstab
- /swapfile none swap sw 0 0
- EOF
- sudo chmod 600 /swapfile
- sudo touch /forcefsck
- fi
- else
- echo -e "\e[93mSwapfile already enabled... \e[0m"
- echo -e "\e[93mCheck /etc/fsatb file.\e[0m\n"
- fi
- echo -e "\e[97mDone !\e[0m"
- sudo usermod -a -G video work
- echo -e "\n\e[92mEverything was done...\e[0m"
- echo -e -n "Reboot in 15 seconds (CRTL+C to abord): "
- for i in {15..1}
- do
- echo -e -n "$i "
- sleep 1
- done
- reboot
|