[xolominer] How to compile and run in linux

[size=14pt]How to: compile and run primeminer in Linux. [/size]

All guides apply to a fresh installed system.
All guides used the latest Xolominer v0.8 RC1 from github.
I didnt write guides for x86 systems, dont use x86 systems for primecoin mining. But anyways the setup should be the same.

[size=14pt]Ubuntu 12.04.3 LTS Precise Pangolin x64[/size]

[code]# Update & upgrade repositories and install build tools
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential software-properties-common python-software-properties git

Add db4.8 repository and update

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update

Install xolominer dependencies

sudo apt-get install libdb4.8-dev libdb4.8+±dev libssl-dev libgmp-dev libboost-chrono1.48-dev libboost-filesystem1.48-dev libboost-system1.48-dev libboost-program-options1.48-dev libboost-thread1.48-dev

Pull the xolominer source from github

git clone https://github.com/thbaumbach/primecoin.git xolominer

Go to source and compile the code

cd xolominer/src
make -f makefile.unix

Start mining

./primeminer -pooluser=[xpm-payout-address] -poolip=[choose-your-server] -poolport=1337 -genproclimit=[threads-to-use] -poolpassword=[some-random-password-for-protection][/code]

[size=14pt]Ubuntu 13.10 Saucy Salamander x64[/size]

[code]# Update & upgrade repositories and install build tools
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential git

Install xolominer dependencies

sudo apt-get install libssl-dev libgmp-dev libboost-chrono1.54-dev libboost-filesystem1.54-dev libboost-system1.54-dev libboost-program-options1.54-dev libboost-thread1.54-dev

Get db4.8 source, compile and install

wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
…/dist/configure --enable-cxx
make
sudo make install

Tell your system where to find db4.8

export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/lib/libdb-4.8.so
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb_cxx-4.8.so /usr/lib/libdb_cxx-4.8.so

Pull the xolominer source from github

cd
git clone https://github.com/thbaumbach/primecoin.git xolominer

Go to source and compile the code

cd xolominer/src
make -f makefile.unix

Start mining

./primeminer -pooluser=[xpm-payout-address] -poolip=[choose-your-server] -poolport=1337 -genproclimit=[threads-to-use] -poolpassword=[some-random-password-for-protection]
[/code]

[size=14pt]Debian 6.0.8 Squeeze x64[/size]

[code]# Get root access
su -

Update & upgrade repositories and install build tools

apt-get update && apt-get upgrade
apt-get install build-essential git

Install xolominer dependencies

apt-get install libssl-dev libgmp3-dev

Get boost source, compile and install

cd
wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz
tar -xzvf boost_1_54_0.tar.gz
cd boost_1_54_0
./bootstrap.sh --prefix=/usr/local
./b2 install --with=all

Tell your system where to find boost

export BOOST_INCLUDE_PATH="/usr/local/include/boost"
export BOOST_LIB_PATH="/usr/local/lib"
ldconfig

Get db4.8 source, compile and install

wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
…/dist/configure --enable-cxx
make
make install

Tell your system where to find db4.8

export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/lib/libdb-4.8.so
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb_cxx-4.8.so /usr/lib/libdb_cxx-4.8.so

Pull the xolominer source from github

cd
git clone https://github.com/thbaumbach/primecoin.git xolominer

Go to source and compile the code

cd xolominer/src
make -f makefile.unix

Start mining

./primeminer -pooluser=[xpm-payout-address] -poolip=[choose-your-server] -poolport=1337 -genproclimit=[threads-to-use] -poolpassword=[some-random-password-for-protection]
[/code]

[size=14pt]Debian 7.2.0 Wheezy x64[/size]

[code]# Get root access
su -

Update & upgrade repositories and install build tools

apt-get update && apt-get upgrade
apt-get install build-essential git

Install xolominer dependencies

apt-get install libssl-dev libgmp3-dev libboost-chrono1.49-dev libboost-filesystem1.49-dev libboost-system1.49-dev libboost-program-options1.49-dev libboost-thread1.49-dev

Get db4.8 source, compile and install

wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
…/dist/configure --enable-cxx
make
make install

Tell your system where to find db4.8

export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/lib/libdb-4.8.so
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb_cxx-4.8.so /usr/lib/libdb_cxx-4.8.so

Pull the xolominer source from github

cd
git clone https://github.com/thbaumbach/primecoin.git xolominer

Go to source and compile the code

cd xolominer/src
make -f makefile.unix

Start mining

./primeminer -pooluser=[xpm-payout-address] -poolip=[choose-your-server] -poolport=1337 -genproclimit=[threads-to-use] -poolpassword=[some-random-password-for-protection]
[/code]

[size=14pt]CentOS 6.4 Final x64[/size]

[code]# Get root access
su -

Update repositories and install build tools & dependencies

yum update
yum groupinstall “Development Tools”
yum install gmp gmp-devel zlib zlib-devel

NOTE: This only works if you have no boost, openssl and db4 isntalled. remove them and clean your system first.

Get openssl source, compile and install

wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar -xzvf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config --prefix=/usr/local enable-ec enable-ecdh enable-ecdsa
make
make install

Get boost source, compile and install

cd
wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz
tar -xzvf boost_1_54_0.tar.gz
cd boost_1_54_0
./bootstrap.sh --prefix=/usr/local
./b2 install --with=all

Get db4.8 source, compile and install

cd
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
…/dist/configure --prefix=/usr/local --enable-cxx
make
make install

Pull the xolominer source from github

cd
git clone https://github.com/thbaumbach/primecoin.git xolominer

Go to source and compile the code

cd xolominer/src
LDFLAGS="-Wl,-R/usr/local/lib" make -f makefile.unix

Start mining

./primeminer -pooluser=[xpm-payout-address] -poolip=[choose-your-server] -poolport=1337 -genproclimit=[threads-to-use] -poolpassword=[some-random-password-for-protection]
[/code]

[size=14pt]FAQ[/size]
Q: Where to get Berkeley DB 4.8 from in Ubuntu?
A:
From bitcoin launchpad repository.

# Add db4.8 repository and update sudo add-apt-repository ppa:bitcoin/bitcoin sudo apt-get update sudo apt-get install libdb4.8-dev libdb4.8++-dev

Q: How to compile Berkeley DB 4.8?
A:
Code

[code]# Get db4.8 source, compile and install
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
…/dist/configure --enable-cxx
make
sudo make install

Tell your system where to find db4.8

export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/lib/libdb-4.8.so
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb_cxx-4.8.so /usr/lib/libdb_cxx-4.8.so
sudo ldconfig[/code]

Q: How to compile OpenSSL correctly?
A:
Code

# Get openssl source, compile and install wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz tar -xzvf openssl-1.0.1e.tar.gz cd openssl-1.0.1e ./config --prefix=/usr/local enable-ec enable-ecdh enable-ecdsa ALL=? make sudo make install sudo ldconfig

Q: How to compile Boost correctly?
A:
Code

[code]# Get boost source, compile and install
wget http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz
tar -xzvf boost_1_54_0.tar.gz
cd boost_1_54_0
./bootstrap.sh --prefix=/usr/local
sudo ./b2 install --with=all

Tell your system where to find boost

export BOOST_INCLUDE_PATH="/usr/local/include/boost"
export BOOST_LIB_PATH="/usr/local/lib"
sudo ldconfig[/code]

Q: Compiling fails due to low available memory. What to do?
You get messages like this:

[code]# Compiler error output
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.

dmesg output

[ 1377.575785] Out of memory: Kill process 12305 (cc1plus) score 905 or sacrifice child
[ 1377.575800] Killed process 12305 (cc1plus) total-vm:579928kB, anon-rss:546144kB, file-rss:0kB[/code]

A: Add a temporary swap space:

[code]# Create and enable 1GB swap space
sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

Do your stuff and compile things

[…]

Disable Swap

sudo swapoff /swapfile
sudo rm /swapfile[/code]

If you can figure out CentOS I will be soooo happy.

Also on Debian 7 I was able to get it to work by using the Berkely db5 instead of 4.8.

Added Debian 6, CentOS is still bitchy :smiley:

good job so far & thank you

I’d be great to have it working at CentOS! I have several servers waiting to mine primecoins but couldn’t compile the miner at CentOS :-[

How much ram is required to compile on Ubuntu Server 12.04.3 LTS?

Around 1 GB, but if you have less, you can add a temporary swap partition.

[code]# Create and enable 1GB Swap space
sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

Do your stuff and compile things

[…]

Disable Swap

sudo swapoff /swapfile
sudo rm /swapfile[/code]

if your RAM is 512 MByte or lower (any linux distribution) compiling with this command might help:

> make -j 1 -f makefile.unix primeminer CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=4096"
or when you're unlucky but it's no problem for you to wait HOURS (DAYS?):
> make -j 1 -f makefile.unix primeminer CXXFLAGS="--param ggc-min-expand=[color=red]0[/color] --param ggc-min-heapsize=4096"
(the latter one is not recommended as it really slows down the compilation)

Added CentOS. Note: This only seems to work on a clean environment. Make sure you completly remove all openssl, db4 and boost from yum!

Just compiled on debian wheezy x64, followed your apt-get instructions but skipped on libdb4.8

apt-get install libdb-dev libdb++-dev
and you are done, why compile 4.8? This is no wallet so the version doesn't matter, Berkeley DB is used for wallet, blockchain data and peers. Compiles just fine.

You didn’t use

apt-get install libminiupnpc-dev
though so it should throw a compile error without USE_UPNP=0 with make, didn't test though, just installed it anyway ^^

[quote=“Sy, post:12, topic:825”]Just compiled on debian wheezy x64, followed your apt-get instructions but skipped on libdb4.8

apt-get install libdb-dev libdb++-dev
and you are done, why compile 4.8? This is no wallet so the version doesn't matter, Berkeley DB is used for wallet, blockchain data and peers. Compiles just fine.[/quote]

Next time you tell me before I compile this on a dozen of systems :slight_smile:

[quote=“Sy, post:12, topic:825”]You didn’t use

apt-get install libminiupnpc-dev
though so it should throw a compile error without USE_UPNP=0 with make, didn't test though, just installed it anyway ^^[/quote]

Default should be = 0. Never needed this to specify.

if i remember corretly

USE_UPNP=-

is possible too. this should completely ignore (mini) UPNP & all dependencies.

[quote=“xolokram, post:10, topic:825”]if your RAM is 512 MByte or lower (any linux distribution) compiling with this command might help:

> make -j 1 -f makefile.unix primeminer CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=4096"
or when you're unlucky but it's no problem for you to wait HOURS (DAYS?):
> make -j 1 -f makefile.unix primeminer CXXFLAGS="--param ggc-min-expand=[color=red]0[/color] --param ggc-min-heapsize=4096"
(the latter one is not recommended as it really slows down the compilation)[/quote]

**EDIT: The first one worked perfect, and it actual did not take that long! Thanks again!

Will these already by installed if you just installed the OS? If they are how do I remove them.

Will these already by installed if you just installed the OS? If they are how do I remove them.[/quote]

No, dont think so. But if you are running server environments I guess at least openssl should be installed. Try:

yum remove openssl openssl-devel db4 db4-devel boost boost-devel

TODO: add the CentOS 5.9 howto
it’s somewhere in the official / tech support forum (lately)

Please do video tutorial for CentOS or Debian OS. I be very glad for this!! send youtube.

Install and config miner in new OS. Thank you!

Does anyone has a static(binary) x86 and x86_64 version ?

Or the way to compile as static ?

Thankz.