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 build-essential libssl-dev libdb-dev libdb++-dev libboost-all-dev libqrencode-dev libcurl4-openssl-dev curl libzip-dev libzip2

For Untuntu 1404 Trusty, add:

sudo apt-get install libboost1.55-all-dev

You now have Boost1.55 and other dependencies installed for Trusty, Utopic, Vivid, Jessie and Sid and you may skip the manual compilation of Boost 1.55 and go to down to Build Gridcoin Daemon.

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

Wheezy could also (risky!) pull libboost-all-dev from Jessie (unstable). Google apt-pinning and be careful.

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

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 http://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 programme 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, do this:

# git fetch --all

# git reset --hard origin/master

If you have trouble updating source from git: git config --global http.sslverify false

cd ~/Gridcoin-Research/src

mkdir obj

make -f makefile.unix USE_UPNP=-

The gridcoind will be found in the /src directory

strip gridcoinresearchd

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

mkdir ~/.GridcoinResearch

cd ~/

chmod 700 .GridcoinResearch

cd .GridcoinResearch

Creating config file

From command line:

   nano ~/.GridcoinResearch/gridcoinresearch.conf

Copy and paste the following into the file:

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)>
addnode=node.gridcoin.us

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)

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 libqt5webkit5-dev  #for qt5 builds
   or
   sudo apt-get install libqtwebkit-dev    #for qt4 builds

cd to the directory where gridcoinresearch.pro is

   cd ~/Gridcoin-Research

IMPORTANT: now edit gridcoinresearch.pro and remove the entries "QT += qaxcontainer", "CONFIG += qaxcontainer" and "QT += axserver":

   nano gridcoinresearch.pro

if you have built Gridcoin-Qt previously, do:

   rm -f build/o.*

Otherwise:

   qmake "USE_UPNP=-"

Finish the build:

   make
   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

If you had to upgrade boost, it may be in a different place now. Edit the file /Gridcoin-Research/gridcoinstake.pro on line 36 to include the paths to Boost. Later versions of Boost do not seem to be compatible at this point.

BOOST_INCLUDE_PATH = /boost/boost_1_55_0/

BOOST_LIB_PATH = /boost/boost_1_55_0/stage/lib/

If running into a DB 4.8 error you need to change #include <db_cxx.h> to #include <db4.8/db_cxx.h> on line 14 in Gridcoin-Research/src/db.h

There is an issue with the permission of .Gridcoinresearch. Simply change the ownership of the file from root to user: chown $USER -R ~/.GridcoinResearch

On some distributions there is a bug when sending Gridcoins (Wallet Freezes). Change the unit to mGRC to be able so send coins again.

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