Advertisement
Guest User

Install Monero (from source) script (Ubuntu 14.04)

a guest
Mar 1st, 2015
1,095
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.33 KB | None | 0 0
  1. #!/bin/bash
  2. #This script will install monero with all of it's requirements.
  3.  
  4. #Installing general requirements
  5. sudo apt-get -y install python-software-properties
  6. sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  7. sudo apt-get update
  8. sudo apt-get -y install gcc-4.8 g++-4.8 rlwrap git cmake build-essential
  9.  
  10. cd ~
  11. clear
  12. echo "This is the monero installation script. It will install monero with all it's requirements, starting with the latest boost-version, plus CPUMiner"
  13. echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  14. echo "[1] INSTALL Monero essentials (wallet + solominer)"
  15. echo "[2] INSTALL Wolf's poolminer"
  16. echo "[3] INSTALL Everything"
  17. echo "[6] UPDATE  Monero essentials (wallet + solominer)"
  18. echo "[7] UPDATE  Wolf's poolminer"
  19. echo "[8] UPDATE  Everything"
  20. echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  21.  
  22. #Cases
  23. read NUM
  24.  
  25. ########################   
  26. #Boost 1.55 Installation
  27. ########################
  28.  
  29. if [[ $NUM == "1" || $NUM == "3" ]]; then
  30.  
  31.     echo "You are about to install Boost 1.55."
  32.     echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
  33.     echo "Do you want to install it from the repositories or let the scipt do an automated manual build? Installation over repositories (recommended)   [y/n]? Saying no will do an automated full build."
  34.     read
  35.     if [[ $a == "Y" || $a == "y" ]]; then
  36.        
  37.         #Adding PPA and installing boost
  38.         sudo add-apt-repository -y ppa:boost-latest/ppa
  39.         sudo apt-get update
  40.         sudo apt-get -y install libboost1.55-all-dev
  41.        
  42.     else   
  43.    
  44.         # simple search to get and grab the files required
  45.         sudo apt-get update
  46.         sudo apt-get -y install python-dev autotools-dev libicu-dev build-essential libbz2-dev
  47.  
  48.         #Downloading boost. Change Link if you want a different version
  49.         echo "Downloading boost"
  50.         cd ~
  51.         wget -O boost_1_55_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
  52.    
  53.         #Extracting boost
  54.         echo "Extracting boost"
  55.         tar xzvf boost_1_55_0.tar.gz
  56.         cd boost_1_55_0/
  57.    
  58.         # boost's bootsrap setup
  59.         ./bootstrap.sh --prefix=/usr/local
  60.    
  61.         # If we want MPI then we need to set the flag in the user-config.jam file
  62.         user_configFile=`find $PWD -name user-config.jam`
  63.         echo "using mpi ;" >> $user_configFile
  64.    
  65.         # Find the number of available hardware threads
  66.         n=$(nproc)
  67.  
  68.         # Install boost in parallel
  69.         if [$n !== 1]
  70.         then
  71.             $n = $n / 2
  72.             sudo ./b2 --with=all -j $n install
  73.         else
  74.             sudo ./b2 --with=all install
  75.         fi
  76.        
  77.         # Reset the ldconfig, assumes you have /usr/local/lib setup already. Else you can add it to your LD_LIBRARY_PATH, running this anyway
  78.         # will not hurt.
  79.         sudo ldconfig  
  80.         echo "Boost installation complete."
  81.    
  82.     fi
  83. fi
  84.  
  85. ############################################################
  86. #Installation of monero and other requirements besides boost
  87. ############################################################
  88.  
  89.  
  90. if [[ $NUM == "1" || $NUM == "3" || $NUM == "6" || $NUM == "8" ]]; then
  91.  
  92.     echo "You are about to install the Monero essentials. If you want to configure it, read this script first. Do you wish to continue  [y/n]?"
  93.  
  94.     cd ~
  95.    
  96.     #relinking symlinks for gcc and g++
  97.     sudo cp /usr/bin/gcc /usr/bin/gcc.oldsymlink
  98.     sudo rm /usr/bin/gcc
  99.     sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
  100.  
  101.     sudo cp /usr/bin/g++ /usr/bin/g++.oldsymlink
  102.     sudo rm /usr/bin/g++
  103.     sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++
  104.    
  105.     # need these libs (added by TheKoziTwo, 1st March 2015)
  106.     sudo apt-get -y install libssl-dev
  107.     sudo apt-get -y install libevent-dev
  108.  
  109.     #Cloning github project
  110.     echo "Downloading Monero essentials"
  111.     if [[ $NUM == "6" || $NUM == "8" ]]; then
  112.         cd ~/bitmonero/
  113.         git pull
  114.     else
  115.         cd ~
  116.         git clone git://github.com/monero-project/bitmonero.git
  117.     fi
  118.    
  119.     # Find the number of available hardware threads
  120.     n=$(nproc)
  121.    
  122.     #Setting compilation update
  123.     cd ./bitmonero
  124.     mkdir ./build
  125.    
  126.     #Decision to compile tests
  127.     echo "Do you want to compile tests too? This subdirectory is related to not yet implemented features, which need further testing.
  128.         Not installing it will significantly speed up your compilation time. Do you want to install it  [y/n]?"
  129.     if [[ $a == "Y" || $a == "y" ]]; then
  130.        sed -i '/^add_subdirectory(tests)$/d' CMakeLists.txt
  131.     fi
  132.    
  133.     #Building with maximum number of cores
  134.     if [$n !== 1]
  135.     then
  136.         $n = $n / 2
  137.         make -j $n
  138.     else
  139.         make
  140.     fi
  141.    
  142.     #linking symlinks back to old gcc/g++ versions
  143.     sudo rm /usr/bin/gcc
  144.     sudo cp /usr/bin/gcc.oldsymlink /usr/bin/gcc
  145.     sudo rm /usr/bin/gcc.oldsymlink
  146.    
  147.     sudo rm /usr/bin/g++
  148.     sudo cp /usr/bin/g++.oldsymlink /usr/bin/g++
  149.     sudo rm /usr/bin/g++.oldsymlink
  150.    
  151.    
  152.     echo "Monero installation complete"
  153.    
  154.     ##############################
  155.     #Downloading latest blockchain 
  156.     ##############################
  157.    
  158.     cd ~
  159.     echo "Do you want to download the latest blockchain (atm only 64bit. 64bit and 32bit are not compatible)    [y/n]?"
  160.     read x
  161.         if [[ $x == "N" || $x == "n" ]]; then
  162.         echo "You choosed no"
  163.     else
  164.         #Creating directory
  165.         mkdir ~/.bitmonero/
  166.         cd ~/.bitmonero/
  167.         rm -f blockchain.bin
  168.    
  169.         #Downloading blockchain
  170.         wget -O blockchain.bin http://monero.cc/downloads/blockchain/linux/blockchain.bin
  171.    
  172.         echo "Download completed"
  173.     fi
  174. fi
  175.  
  176. #############################################################
  177. #Installing Wolf's CPUMiner. A fast pool miner utilizing AES
  178. #############################################################
  179.  
  180. if [[ $NUM == "2" || $NUM == "3" || $NUM == "7" || $NUM == "8" ]]; then
  181.  
  182.     echo "The following part will build CPUMiner. CPUMiner supports pool mining for multiple algos, including CryptoNight. Do you want to build it now  [y/n]?"
  183.  
  184.     cd ~
  185.    
  186.     #Installing required packages
  187.     echo "Installing required packages"
  188.     sudo apt-get install -y automake libcurl4-openssl-dev pkg-config
  189.     sudo apt-get update
  190.    
  191.     #Preparing
  192.     cd ~/monero
  193.     rm -rf cpuminer
  194.     mkdir cpuminer
  195.     cd cpuminer
  196.    
  197.     #Building CPUMiner
  198.     if [[ $NUM == "7" || $NUM == "8" ]]; then
  199.         pushd cpuminer-multi
  200.         git pull
  201.     else
  202.         git clone https://github.com/wolf9466/cpuminer-multi
  203.         pushd cpuminer-multi
  204.     fi
  205.    
  206.     ./autogen.sh
  207.     export CFLAGS="-march=native"
  208.     ./configure
  209.    
  210.     #Building with maximum number of cores
  211.     n=$(nproc)
  212.     if [$n !== 1]
  213.     then
  214.         $n = $n / 2
  215.         make -j $n
  216.     else
  217.         make
  218.     fi
  219.    
  220.     #Unsetting flag and leaving dir
  221.     unset CFLAGS
  222.     popd
  223.    
  224.     echo "Finished building"
  225. fi
  226.  
  227. echo "The script has finished"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement