Lotus安装部署与挖矿

Lotus

设置环境变量:

vim /root/.bashrc
export FIL_PROOFS_PARAMETER_CACHE=/home/storage/filecoin-proof-parameters
export LOTUS_STORAGE_PATH=/home/storage/lotuswork/lotusstorage
export LOTUS_PATH=/home/storage/lotuswork/lotus
export WORKER_PATH=/home/storage/lotuswork/lotusworker
export TMPDIR=/home/storage/lotuswork/tmpdir
export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
export BELLMAN_CUSTOM_GPU="GeForce GTX 1080 Ti:3584"
export RUST_LOG=info
export RUST_BACKTRACE=full
source /root/.bashrc
vim /etc/profile
export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
source /etc/profile

装之前确认当前是否在/home目录下

Run

sudo apt update
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev

Build

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-go gcc git bzr jq pkg-config mesa-opencl-icd ocl-icd-opencl-dev 
Github代理:
vim /etc/hosts
140.82.113.3  github.com
199.232.69.194  github.global.ssl.fastly.net
140.82.114.9  codeload.github.com
reboot

Clone

git config --global http.postBuffer 524288000
git clone https://github.com/filecoin-project/lotus.git
cd lotus/

Install

切换测试网分支:
git show
git tag
git checkout
git checkout interopnet (master)
git branch
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
//build之前加这个环境变量
env RUSTFLAGS="-C target-cpu=native -g" FFI_BUILD_FROM_SOURCE=1
make clean && make all
sudo make install

Join Testnet

lotus daemon
lotus net peers | wc -l
lotus net peers
下载零知识证明:

也可以拷贝

lotus fetch-params 32GiB

Chain sync

lotus sync wait
lotus sync status
链同步文件位置:

拷贝的时候只打包datastore就行(两边所有lotus进程必须都停掉)

sftp 提示找不到文件是权限的原因 r:4 w:2 x:1 600=rw-------

打包:tar -cvf 【包名】【要打包的文件】
解包:tar -xvf 【包名】
chmod -R 777 /home/storage
LOTUS_PATH:/home/storage/lotuswork/lotus/datastore
sftp {
     username}@192.168.0.205 (有文件的机器)
get /home/storage/lotuswork/lotus/datastore.tar.gz /home/storage/lotuswork/lotus
tar -xvf datastore.tar.gz
chmod -R 600 /home/storage

Storage Mining

Get started

lotus wallet new bls

Visit the https://faucet.testnet.filecoin.io/ to create miner, this may take 5 minutes.

Initialize miner

lotus-storage-miner init --actor=ACTOR_VALUE_RECEIVED --owner=OWNER_VALUE_RECEIVED

or (when facuet fail)

send funds
lotus-storage-miner init --owner=t3...

Mining Locally

export FIL_PROOFS_MAXIMIZE_CACHING=1    一定需要的环境变量
export FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1
lotus-storage-miner run
lotus-seal-worker run --address=127.0.0.1:2346 
查看端口号命令:
netstat -tupln

Mining Status

lotus-storage-miner info
lotus-storage-miner workers list
lotus-storage-miner storage list
lotus-storage-miner sectors list

Seal Random Data

lotus-storage-miner sectors pledge

Remote Seal worker in LAN

Miner machine

ListenAddress用miner自己的地址

RemoteListenAddress用miner自己的地址

vim /home/storage/lotuswork/lotusstorage/config.toml
[API]
ListenAddress = "/ip4/192.168.0.205/tcp/2345/http"
RemoteListenAddress = "192.168.0.205:2345"
Copy files

将miner机器LOTUS_STORAGE_PATH下的api和token两个文件拷贝到worker机器的LOTUS_STORAGE_PATH下

miner机器开着daemon和miner

LOTUS_STORAGE_PATH=/home/storage/lotuswork/lotusstorage
sftp [email protected] (有token的机器)
get /home/storage/lotuswork/lotusstorage/api /home/storage/lotuswork/lotusstorage
chmod 777 token
get /home/storage/lotuswork/lotusstorage/token /home/storage/lotuswork/lotusstorage
Worker machine

(address=worker IP in LAN)

export FIL_PROOFS_MAXIMIZE_CACHING=1    一定需要的环境变量
export FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1
lotus-storage-miner run
lotus-seal-worker run --address=192.168.0.204:2346 
Too many open files
ulimit -n 1048576
sed -i "/nofile/d" /etc/security/limits.conf
echo "* hard nofile 1048576" >> /etc/security/limits.conf
echo "* soft nofile 1048576" >> /etc/security/limits.conf
echo "root hard nofile 1048576" >> /etc/security/limits.conf
echo "root soft nofile 1048576" >> /etc/security/limits.conf

修改系统时间:

apt-get update
apt install ntpdate
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate ntp.aliyun.com

部署NFS服务

在两台机器运行

apt install nfs-kernel-server
vim /etc/hosts.allow
#NFS DAEMONS
portmap:192.168.0.
lockd:192.168.0.
rquotab:192.168.0.
mountd:192.168.0.
statd:192.168.0.

在存储机器运行

vim /etc/exports
/home 192.168.0.205(rw,sync,no_root_squash)

在两台机器运行

sudo /etc/init.d/nfs-kernel-server restart

在miner机器运行

mount 192.168.0.204:/home /home
查看信息 showmount -e 192.168.0.204
通过挂载点卸载 umount -v /home

性能调优

BIOS 中关闭Numa

CPU改为性能模式

apt-get install cpufrequtils
cpufreq-info
cpufreq-set -g performance

你可能感兴趣的:(Lotus,linux)