Linux
The following instructions are specific to Linux installations.
There are several ways to install Lotus on Linux:
Storage providers should build from source.
Building Lotus from source allows you to strictly configure how Lotus runs and how it communicates with its dependencies. Storage providers looking to improve their system efficiency should install Lotus by building from source.
Snap package manager
To install Lotus using Snap, run:
snap install lotus-filecoin
You can also install nightly builds by using the --edge
flag. These builds are created every night from the master
branch Lotus GitHub repository.
snap install lotus-filecoin --edge
You can find out more about this Snap over at Snapcraft.io.
AppImage
AppImages are portable applications that allow developers to package software and dependencies in a single executable. AppImages run on most Linux-based operating systems.
Go to the latest releases page in the Lotus GitHub repository.
Under Assets, download the AppImage.
Open a terminal window and move to the location where you downloaded the AppImage. This location is likely your Downloads folder:
cd ~/Downloads
Make the AppImage executable:
chmod +x lotus_v1.13.0_linux-amd64.appimage
You can now run the AppImage file by double-clicking on it or opening it from a terminal window:
./lotus-v1.13.0_linx-amd64.appimage
Building from source
You can build the Lotus executables from source by following these steps.
Software dependencies
You will need the following software installed to install and run Lotus.
System-specific
Building Lotus requires some system dependencies, usually provided by your distribution.
Arch:
sudo pacman -Syu opencl-icd-loader gcc git bzr jq pkg-config opencl-icd-loader opencl-headers opencl-nvidia hwloc
Ubuntu/Debian:
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y && sudo apt upgrade -y
Fedora:
sudo dnf -y install gcc make git bzr jq pkgconfig mesa-libOpenCL mesa-libOpenCL-devel opencl-headers ocl-icd ocl-icd-devel clang llvm wget hwloc hwloc-devel
OpenSUSE:
sudo zypper in gcc git jq make libOpenCL1 opencl-headers ocl-icd-devel clang llvm hwloc && sudo ln -s /usr/lib64/libOpenCL.so.1 /usr/lib64/libOpenCL.so
Amazon Linux 2:
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm; sudo yum install -y git gcc bzr jq pkgconfig clang llvm mesa-libGL-devel opencl-headers ocl-icd ocl-icd-devel hwloc-devel
Rustup
Lotus needs rustup. The easiest way to install it is:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Go
To build Lotus, you need a working installation of Go 1.17.9 or higher:
wget -c https://golang.org/dl/go1.17.9.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
You’ll need to add /usr/local/go/bin
to your path. For most Linux distributions you can run something like:
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc
See the official Golang installation instructions if you get stuck.
Build and install Lotus
Once all the dependencies are installed, you can build and install Lotus.
Clone the repository:
git clone https://github.com/filecoin-project/lotus.git cd lotus/
Checkout the release for the network you wish to use.
To join mainnet, checkout the latest release.
If you are changing networks from a previous Lotus installation or there has been a network reset, read the Switch networks guide before proceeding.
For networks other than mainnet, look up the current branch or tag/commit for the network you want to join in the Filecoin networks dashboard, then build Lotus for your specific network below.
git checkout <tag_or_branch> # For example: git checkout <vX.X.X> # tag for a release
Currently, the latest code on the master branch corresponds to the mainnet.
If you are in China, see “Lotus: tips when running in China”.
Depending on your CPU model, you will want to export additional environment variables:
a. If you have an AMD Zen or Intel Ice Lake CPU (or later), enable the use of SHA extensions by adding these two environment variables:
export RUSTFLAGS="-C target-cpu=native -g" export FFI_BUILD_FROM_SOURCE=1
See the Native Filecoin FFI section for more details about this process.
a. Some older Intel and AMD processors without the ADX instruction support may panic with illegal instruction errors. To solve this, add the
CGO_CFLAGS
environment variable:export CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" export CGO_CFLAGS="-D__BLST_PORTABLE__"
a. By default, a ‘multicore-sdr’ option is used in the proofs library. This feature is also used in FFI unless explicitly disabled. To disable building with the ‘multicore-sdr’ dependency, set
FFI_USE_MULTICORE_SDR
to0
:export FFI_USE_MULTICORE_SDR=0
Build and install Lotus
Lotus is compiled to operate on a single network, run one of the following commands to build the lotus node for the specific lotus network.
# join mainnet make clean all # Or to join a testnet or devnet: make clean calibnet # Calibration with min 32GiB sectors sudo make install
This will put
lotus
,lotus-miner
andlotus-worker
in/usr/local/bin
.lotus
will use the$HOME/.lotus
folder by default for storage (configuration, chain data, wallets). See advanced options for information on how to customize the Lotus folder.Once the installation is finished, use the command down below to ensure lotus is installed successfully for the right network.
lotus --version
lotus version 1.13.0+calibnet+git.7a55e8e89
You should now have Lotus installed. You can now start the Lotus daemon.
Native Filecoin FFI
Some newer CPU architectures like AMD’s Zen and Intel’s Ice Lake have support for SHA extensions. Having these extensions enabled significantly speeds up your Lotus node. To make full use of your processor’s capabilities, make sure you set the following variables before building from source:
export RUSTFLAGS="-C target-cpu=native -g"
export FFI_BUILD_FROM_SOURCE=1
This method of building does not produce portable binaries. Make sure you run the binary on the same computer as you built it.
Systemd service files
Lotus provides generic Systemd service files. They can be installed with:
make install-daemon-service
make install-miner-service
Provided service files should be inspected and edited according to user needs as they are very generic and may lack specific environment variables and settings needed by the users.
One example is that logs are redirected to files in /var/log/lotus
by default and not visible in journalctl
.
Start the Lotus daemon and sync the chain
The lotus
application runs as a daemon and a client to control and interact with that daemon. A daemon is a long-running program that is usually run in the background.
When using mainnet, we recommend you start the daemon syncing from a trusted state snapshot. In any case, you can start the daemon with the following command:
lotus daemon
During the first run, Lotus will:
- Set up its data folder at
~/.lotus
. - Download the necessary proof parameters. This is a few gigabytes of data that is downloaded once.
- Import the snapshot (if specified) and start syncing the Lotus chain.
The daemon will start producing lots of log messages right away. From this point, you will have to work on a new terminal. Anylotus
commands you run now will communicate with the running daemon.
If you used snapshots, subsequent daemon starts can proceed as normal without any options:
lotus daemon
## When running with systemd do:
# systemctl start lotus-daemon
For more information about syncing and snapshots, see the Chain management section.
We recommend waiting until the syncing process has completed, which should be relatively fast when using trusted state snapshot imports:
lotus sync wait
Interact with the daemon
The lotus
command allows you to interact with a running Lotus daemon. The lotus-miner
and lotus-worker
commands work in the same way.
Lotus comes with built-in CLI documentation.
lotus
- chain: Interact with filecoin blockchain
- client: Make deals, store data, retrieve data
- wallet: Manage wallet
- net: Manage P2P Network
- sync: Inspect or interact with the chain syncer
...
# Show general help
lotus --help
# Show help for the "client" to make deals, store data, retrieve data
lotus client --help
For example, after your Lotus daemon has been running for a few minutes, use lotus sync
to check the sync status of your lotus node.
lotus net sync
sync status:
...
Target: [bafy2bzaceaki6bjhe2lxmtyexcff6vh5y5uw4tmbjr3gatwvh5dhaqqb2ykaa] (320791)
Stage: complete
Height: 320791
...
Or use lotus net
to check the number of other peers that it is connected to in the Filecoin network.
lotus net peers
12D3KooWSDqWSDNZtpJae15FBGpJLeLmyabUfZmWDWEjqEGtUF8N, [/ip4/58.144.221.27/tcp/33425]
12D3KooWRTQoDUhWVZH9z5u9XmaFDvFw14YkcW7dSBFJ8CuzDHnu, [/ip4/67.212.85.202/tcp/10906]
Or check the current version of your Lotus node as well as network.
lotus version
Daemon: 1.13.0+calibnet+git.7a55e8e89+api1.4.0
Local: lotus version 1.13.0+calibnet+git.7a55e8e89
# running lotus v1.13.0 on Calibration testnet
Stop the Lotus daemon
To gracefully stop the running lotus daemon (required when restarting the daemon to update Lotus), use the following command:
lotus daemon stop
## When running with systemd do:
# systemctl stop lotus-daemon