Linux guide

From Gridcoin
Jump to: navigation, search

Pre-compiled binaries

If you prefer to use a repository rather than compile yourself, jump to Linux Downloads (pre-compiled)

Dependencies

For Ubuntu:

sudo apt-get install ntp git gcc make curl build-essential libssl-dev libdb-dev libdb++-dev libqrencode-dev libcurl4-openssl-dev libzip-dev libzip4 libboost-all-dev

For Ubuntu 14.04 Trusty:

sudo apt-get install ntp git gcc make curl build-essential libssl-dev libdb-dev libdb++-dev libqrencode-dev libcurl4-openssl-dev libzip-dev libzip2 libboost1.55-all-dev


You now have Boost1.55 (or higher) and other dependencies installed for Trusty, Xenial, Zesty, Artful, Jessie and Stretch and you may skip the manual compilation of Boost 1.55 and go to down to Build Gridcoin Daemon.

Older Ubuntu distributions < 14.04 and Debian Wheezy need to compile Boost 1.55 as per below.


For Fedora:

sudo yum install ntp git make automake gcc gcc-c++ kernel-devel openssl-devel libdb-devel libdb-cxx-devel boost-devel qrencode-devel libcurl-devel libzip-devel

Compiling Boost 1.55

Only compile Boost if you are on Ubuntu Precise or Debian Wheezy!

Do Not Compile Boost if your package manager provides boost 1.55 or greater!

Double check whether you can satisfy this dependency from the instructions above.

The following lines will upgrade Boost to 1.55.0. Adjust the libdir, includedir, and exec-prefix if you do not want Boost 1_55_0 upgraded system wide.

cd /

sudo mkdir boost

cd boost

sudo wget https://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.zip

sudo unzip boost_1_55_0.zip

cd boost_1_55_0

sudo apt-get install python-dev

sudo apt-get install python-bzutils

sudo apt-get install libbz2-dev

sudo ./bootstrap.sh --includedir=/usr/include --exec-prefix=/usr/local --libdir=/usr/lib

sudo ./b2

sudo ./bjam install

To uninstall manually compiled Boost

If you later decide to use a PPA or other repository, a manually installed Boost1.55 library may interfere with the package's Boost1.55. You may need to remove the manually installed libraries for the program to work.

If you used the instructions above to manually install Boost1.55:

sudo rm -r /usr/local/include/boost

sudo rm -f /usr/local/lib/libboost_*

sudo ldconfig

If you used some other method to install boost or want more detailed instructions, go to:

Source: http://englanders.us/~jason/howtos.php?howto=boost

Build Gridcoin Daemon

cd ~

git clone https://github.com/gridcoin/Gridcoin-Research

NOTE: If you already have Gridcoin cloned, do this:

# git fetch --all

# git reset --hard origin/master

If you have trouble updating source from git:

git config --global http.sslverify false

NOTE: If you have built the binaries in these folders before, you need the extra clean commands below.

cd ~/Gridcoin-Research/src

mkdir -p obj/zerocoin && chmod +x leveldb/build_detect_platform

Clean: make -f makefile.unix clean

make -f makefile.unix USE_UPNP=-

NOTE: make may be used multithreaded make -j8 -f makefile.unix USE_UPNP=-

The gridcoinresearchd will be found in the ~/Gridcoin-Research/src directory.

strip gridcoinresearchd

sudo install -m 755 gridcoinresearchd /usr/bin/gridcoinresearchd

Create the configuration file and set it's permissions before editing:

mkdir ~/.GridcoinResearch

cd ~/

chmod 700 .GridcoinResearch

cd .GridcoinResearch

Creating configuration file

From command line:

nano ~/.GridcoinResearch/gridcoinresearch.conf

Copy and paste the following into the file:

addnode=node.gridcoin.us
email=<your email, must match your BOINC projects>
server=1
daemon=1
rpcallowip=127.0.0.1
rpcuser=<username (anything you want, does not need to match BOINC)>
rpcpassword=<password (anything you want, does not need to match BOINC)>

If you chose the "nano" command line editor, press CTRL+O to write the file information, and then CTRL+X to exit. For any other editor, just save the file and exit. To test type:

gridcoinresearchd

Wait for the server to start and then type:

gridcoinresearchd getmininginfo

This should return the current difficulty and other network settings.

Blockchain snapshot (optional)

NOTE: This appears to be broken at the moment.

If this is a clean installation, you can improve the time it takes to get into sync with the chain by downloading a snapshot. The snapshot is never perfectly up to date, but it will get you most of the way there. Save this file in your ~/.GridcoinResearch folder:

http://download.gridcoin.us/download/downloadstake/signed/snapshot.zip

Extract the snapshot, making sure the 3 folders and the blk001.dat file are in the ~/.GridcoinResearch folder, not a snapshot sub-folder.

Restart the daemon.

SSL (optional)

You really only need SSL if you are controlling Gridcoin directly from another host. This does not apply to most people, even if you are using ssh from another computer. If you are not sure that you need this, then skip this section.

First, add this line to gridcoinresearch.conf

rpcssl=1

Then, run these commands in your shell:

cd ~/.GridcoinResearch
openssl genrsa -out server.pem 2048
openssl req -new -x509 -nodes -sha1 -days 3650 -key server.pem > server.cert

Build Gridcoin-Qt

As well as using the base QT version of your distribution, you will need the library for QTWebKit. Most current distributions will be using QT5 by default.

sudo apt-get install qt5-default libqt5webkit5-dev libminiupnpc-dev  #for qt5 builds  For Ubuntu Artful and Debian Sid builds, also install libqt5charts5-dev
sudo apt-get install qt4-default libqtwebkit-dev libminiupnpc-dev  #for qt4 builds

cd to the directory where gridcoinresearch.pro is

cd ~/Gridcoin-Research

if you have built Gridcoin-Qt previously, do:

rm -f build/o.*

Otherwise:

qmake gridcoinresearch.pro "USE_UPNP=-"    #for qt5 builds
qmake-qt4 gridcoinresearch.pro "USE_UPNP=-" #for qt4 builds

Finish the build:

 make [-j4] # for parallel compilation
strip gridcoinresearch
sudo install -m 755 gridcoinresearch /usr/bin/gridcoinresearch

Look for gridcoinresearch, it should be in the current folder.

Verify wallet finds nodes and starts syncing.

Known Issues and further Guides

There are occasionally issues with the permission of the ~/.GridcoinResearch folder, depending on which user first built/installed/ran the binary, such as root.

Simply change the ownership of the file to your user: chown $USER -R ~/.GridcoinResearch

Github Guide: https://github.com/gridcoin/Gridcoin-Research/blob/master/CompilingGridcoinOnLinux.txt