"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."


Centos에서 Docker를 이용하여 모네로 채굴 하기 #3
728x90

이번 포스팅에서는 모네로 (Monero/XMR) 채굴 툴을 Ubuntu에 설치하는 방법에 대해서 알아보겠습니다.

지난 포스팅에서 docker에 Ubuntu 컨테이너를 설치했습니다. 그 Ubuntu에서 실행하는 모네로 채굴 툴인 xmr-stak을 어떻게 설치하는지 설명하겠습니다.






1. xmr-stak 설치 전 준비


docker에 Ubuntu 컨테이너를 다운로드 한 경우 apt-get의 리스트가 갱신되지 않은 상태이기 때문에 가장 먼저 apt-get의 리스트를 갱신합니다.


root@d27b09943ae8:/# apt update


Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]

Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]

Get:3 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [81.2 kB]

Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]        

Get:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [638 kB]

Get:6 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]

Get:7 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]         

Get:8 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.7 kB]

Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [445 kB]

Get:10 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3743 B]

Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]

Get:12 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]

Get:13 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]

Get:14 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]                                                                                                                                                       

Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [256 kB]                                                                                                                                                        

Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1012 kB]                                                                                                                                                    

Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.1 kB]                                                                                                                                              

Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [814 kB]                                                                                                                                                 

Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [18.8 kB]                                                                                                                                              

Get:20 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [5157 B]                                                                                                                                                   

Get:21 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8068 B]                                                                                                                                               

Fetched 25.3 MB in 7s (3528 kB/s)                                                                                                                                                                                                       

Reading package lists... Done

Building dependency tree       

Reading state information... Done


 

그 다음으로 필수로 필요한 패키지인 git과 vim을 설치합니다.


root@d27b09943ae8:/# apt install git

root@d27b09943ae8:/# apt install vim





2. xmr-stak 툴 다운로드 및 빌드


xmr-stak의 소스는 github에서 다운로드 받을 수 있고, git 툴에서 클론을 받아도 됩니다. 

아래와 같이 클론을 받는 방법으로 진행하며, CPU only 모드로 빌드를 진행합니다.


root@d27b09943ae8:/# apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev

root@d27b09943ae8:/# git clone https://github.com/fireice-uk/xmr-stak.git

root@d27b09943ae8:/# cd xmr-stak

root@d27b09943ae8:/xmr-stak# cmake . -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF

root@d27b09943ae8:/xmr-stak# make install



make install이 끝나면 ./xmr-stak/bin 디렉토리가 생성되고 xmr-stak 바이너리 생성되었음을 확인할 수 있습니다.





3. xmr-stak 실행하기


아래 명령으로 xmr-stak 툴을 실행시킵니다.


root@d27b09943ae8:/xmr-stak/bin# cd bin

root@d27b09943ae8:/xmr-stak/bin# ./xmr_stak



xmr-stak을 최초 실행하면 설정을 수행합니다. 아래 볼드로 된 부분을 참고해서 설정을 하시면 됩니다.


Please enter:

- Do you want to use the HTTP interface?

Unlike the screen display, browser interface is not affected by the GPU lag.

If you don't want to use it, please enter 0, otherwise enter port number that the miner should listen on

0

Configuration stored in file 'config.txt'

Please enter:

- Please enter the currency that you want to mine: 

        - aeon7

        - bbscoin

        - croat

        - cryptonight

        - cryptonight_heavy

        - cryptonight_lite

        - cryptonight_lite_v7

        - cryptonight_lite_v7_xor

        - cryptonight_v7

        - cryptonight_v7_stellite

        - edollar

        - electroneum

        - graft

        - haven

        - intense

        - ipbc

        - karbo

        - masari

        - monero7

        - stellite

        - sumokoin

        - turtlecoin


monero7

- Pool address: e.g. pool.usxmrpool.com:3333

asia.cryptonight-hub.miningpoolhub.com:20580 (마이닝 풀 주소)

- Username (wallet address or pool login):

abcd.abcd (마이닝풀의 유저이름)       

- Password (mostly empty or x):

x (보통 패스워드는 없음)

- Rig identifier for pool-side statistics (needs pool support). Can be empty:


- Does this pool port support TLS/SSL? Use no if unknown. (y/N)

y  

- Do you want to use nicehash on this pool? (y/n)

y

- Do you want to use multiple pools? (y/n)

n

Pool configuration stored in file 'pools.txt'

[2018-06-02 14:09:33] : Your CPU doesn't support hardware AES. Don't expect high hashrates.

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

-------------------------------------------------------------------

xmr-stak 2.4.4 c0ab173


Brought to you by fireice_uk and psychocrypt under GPLv3.

Based on CPU mining code by wolf9466 (heavily optimized by fireice_uk).


Configurable dev donation level is set to 2.0%


You can use following keys to display reports:

'h' - hashrate

'r' - results

'c' - connection

-------------------------------------------------------------------

[2018-06-02 14:09:33] : Mining coin: monero7

[2018-06-02 14:09:33] : CPU configuration stored in file 'cpu.txt'

[2018-06-02 14:09:33] : Starting 2x thread, affinity: 0.

[2018-06-02 14:09:33] : hwloc: memory pinned

[2018-06-02 14:09:33] : Starting 1x thread, affinity: 1.

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : hwloc: memory pinned

[2018-06-02 14:09:33] : Starting 2x thread, affinity: 2.

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : hwloc: memory pinned

[2018-06-02 14:09:33] : Starting 1x thread, affinity: 3.

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : hwloc: memory pinned

[2018-06-02 14:09:33] : MEMORY ALLOC FAILED: mmap failed

[2018-06-02 14:09:33] : Fast-connecting to asia.cryptonight-hub.miningpoolhub.com:20580 pool ...

[2018-06-02 14:09:33] : Pool asia.cryptonight-hub.miningpoolhub.com:20580 connected. Logging in...

[2018-06-02 14:09:34] : Difficulty changed. Now: 40000.

[2018-06-02 14:09:34] : Pool logged in.

[2018-06-02 14:09:34] : New block detected.

[2018-06-02 14:09:34] : New block detected.



실행 중에 h를 누르면 hashrate를 확인할 수 있고, ctrl+c로 종료할 수 있습니다.


위와 같이 커맨드 입력 모드로 툴을 실행하면 접속한 터미널이 종료되면 툴도 같이 종료 됩니다.

툴을 백그라운드 job으로 계속해서 돌리기 위해서는 config.txt 파일을 vi로 열어서 데몬 모드로 설정을 바꿔야 합니다.


root@d27b09943ae8:/xmr-stak/bin# ls -l

total 2284

drwxr-xr-x  2 root root    4096 Jun  2 14:09 ./

drwxr-xr-x 10 root root    4096 Jun  2 14:08 ../

-rw-r--r--  1 root root    7569 Jun  2 14:08 config.txt

-rw-r--r--  1 root root    2031 Jun  2 14:09 cpu.txt

-rw-r--r--  1 root root 1382490 Jun  2 14:08 libxmr-stak-backend.a

-rw-r--r--  1 root root   74638 Jun  2 14:07 libxmr-stak-c.a

-rw-r--r--  1 root root    1966 Jun  2 14:09 pools.txt

-rwxr-xr-x  1 root root  848520 Jun  2 14:08 xmr-stak*


root@d27b09943ae8:/xmr-stak/bin# vi config.txt

........

/*

 * Daemon mode

 *

 * If you are running the process in the background and you don't need the keyboard reports, set this to true.

 * This should solve the hashrate problems on some emulated terminals.

 */

"daemon_mode" : false, -> true

.......

:wq로 quit



설정을 바꾸고 xmr-stak을 다시 실행했을 때 h 키가 실행되지 않으면 데몬 모드로 정상적으로 수행된 것 입니다.


이번 포스팅에서는 모네로 채굴 툴인 xmr-stak을 docker의 ubuntu 컨테이너에서 빌드하고 실행하는 방법을 소개하였습니다.

다음에서는 채굴 툴을 백그라운드 job으로 자동 실행하는 방법에 대해서 포스팅 할 예정입니다.



728x90
728x90
LIST