This: * Re-organizes the docs into sections that align with what docs.filecoin.io becoming: * An installation section * A "getting started" section (lotus client focused) * A "storing" section (lotus client focused) * A "mining" section (miner focused) * A "build" section (developer focused) * An legacy "architecture" section is left in the last place. A few high-value documentation pages have been reviewed and updated with the latest recommendations: * Installation section and lotus setup * Miner setup * etc. ... Other pages have been correctly merged into the new relevant sections. Some pages have not been touched. The filesystem layout of the documentation has been changed into folders corresponding to the sections (as requested by @cw). Some pages that were not linked at all and/or where hidden, have been moved to "unclassified". This should make the porting of the Lotus documentation to docs.filecoin.io much easier, while ensuring it is more up to date than it was before. For the moment, this breaks most links as link-aliasing is not supported in lotus-docs.
3.7 KiB
Linux installation
This page will show you the steps to build and install Lotus in your Linux computer.
Dependencies
System dependencies
First of all, building Lotus will require installing some system dependencies, usually provided by your distribution.
For Arch Linux:
sudo pacman -Syu opencl-icd-loader gcc git bzr jq pkg-config opencl-icd-loader opencl-headers
For Ubuntu:
sudo apt update
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl
sudo apt upgrade
For Fedora:
sudo dnf -y update
sudo dnf -y install gcc git bzr jq pkgconfig mesa-libOpenCL mesa-libOpenCL-devel opencl-headers ocl-icd ocl-icd-devel clang llvm
For OpenSUSE:
sudo zypper in gcc git jq make libOpenCL1 opencl-headers ocl-icd-devel clang llvm
sudo ln -s /usr/lib64/libOpenCL.so.1 /usr/lib64/libOpenCL.so
Rustup
Lotus needs rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Please make sure your $PATH
variable is correctly configured after the rustup installation so that cargo
and rustc
are found in their rustup-configured locations.
Go
To build lotus you will need a working installation of Go1.14. Follow the installation instructions, which generally amount to:
# Example! Check the installation instructions.
wget -c https://dl.google.com/go/go1.14.7.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
Build and install Lotus
With all the above, you are ready to build and install the Lotus suite (lotus
, lotus-miner
and lotus-worker
):
git clone https://github.com/filecoin-project/lotus.git
cd lotus/
IF YOU ARE IN CHINA, set export GOPROXY=https://goproxy.cn
before building
Now, choose the network that you will be joining:
- For
testnet
:git checkout master
- For
nerpa
:git checkout ntwk-nerpa
- For
butterfly
:git checkout ntwk-butterfly
Once on the right branch, do:
make clean install
sudo make install
This will put lotus
, lotus-miner
and lotus-worker
in /usr/local/bin
. lotus
will use the $HOME/.lotus
folder by default for storage (configuration, chain data, wallets...). lotus-miner
will use $HOME/.lotusminer
respectively. See the environment variables section below for how to customize these.
Remeber to move your Lotus folder if you are switching between different networks, or there has been a network reset.
Native Filecoin FFI
Some newer processors (AMD Zen (and later), Intel Ice Lake) have support SHA extensions. To make full use of your processor's capabilities, make sure you set the following variables BEFORE building from source (as described above):
export RUSTFLAGS="-C target-cpu=native -g"
export FFI_BUILD_FROM_SOURCE=1
Note
: This method of building does not produce portable binaries! Make sure you run the binary in the same machine as you built it.
systemd service files
Lotus provides Systemd service files. They can be installed with:
make install-daemon-service
make install-miner-service
After that, you should be able to control Lotus using systemctl
.
Troubleshooting
This section mentions some of the common pitfalls for building Lotus. Check the getting started section for more tips on issues when running the lotus daemon.
Build errors
Please check the build logs closely. If you have a dirty state in your git branch make sure to:
git checkout <desired_branch>
git reset origin/<desired_branch> --hard
make clean
Slow builds from China
Users from China can speed up their builds by setting:
export GOPROXY=https://goproxy.cn