Install Chia Network on Linux / Debian (instructions and tips for Node + Farmer + Plot Setup)
Today I want to show you how to get Chia (Chia Network/XCH) (external link to github.com) installed and running on Linux (Debian). Debian is my personal favorite distribution and Chia has also proven to be very stable here.
Please send coffee donations to: 0xd0803A568615A18403C3722AC6dBb3202FD14034 (Ethereum)
Are you finding all this too complicated? I also create plots on behalf of you! Click here
First, Debian needs to be installed on a new machine or inside a VM (important tip for VM at the end of the article). I recommend using the netinstall images (external link to debian.org) for this. No GUI or PrintServer is needed for the installation, but the SSH server is. I assume in this Chia tutorial that you have now successfully installed debian.
If you want to log in directly as root, you have to add in the “/etc/ssh/sshd_config” the line
PermitRootLogin yes
add (e.g. using the text editor vi (vi /etc/ssh/sshd_config | Add New Text: EINFG | Save: ESC :wc ENTER). Of course you should get root rights before you start the text editor, this can be done with the command
su
Chia Installation
If you are not logged in as root, you must put sudo in front of the commands (apt-get install sudo before if necessary).
Now please run the following commands:
apt-get update
apt-get upgrade
apt-get -y install screen
apt-get -y install lsb-release
apt-get -y install git
apt-get -y install iotop
These commands first update and install the screen, lsb-release, git, and iotop tools.
Now we can install chia (under home)
cd /home/
git clone https://github.com/Chia-Network/chia-blockchain.git -b latest --recurse-submodules
cd chia-blockchain
chmod 775 install.sh
./install.sh
If you are logged in as root you have to replace (e.g. with a text editor) all occurrences of “sudo ” (sudo and a space) with “” (nothing). Otherwise you will get an error message.
Of course, I don’t need to mention at this point that running any program with root privileges can be a security risk (=create extra user).
Now chia is installed too! Let’s get to setting it up, with the following commands:
screen
. ./activate
chia init
Now you need to either generate a new seed or add an existing seed.
You can generate a new seed (key) with this command:
chia keys generate
chia keys show
If you already have a seed (key), you can add it with this command:
chia keys add
You will be prompted to enter the seed, if everything is correct can also be conveniently matched with the ID that is displayed afterwards.
After that, we also initialize the wallet for security:
chia init
chia wallet show
s
chia wallet show
Now you should be shown the account balance in XCH.
Note: For the newer Chia versions, you will need to update/download the blockchain first (chia start farmer) and wait a bit.
Next, we start the node and the farmer software:
chia start farmer
The status of the Chia node can be queried later with this command:
chia show -s
and the status of the Chia farm with this command:
chia farm summary
To add a new directory of plots to the “farm”, the following syntax can be used
chia plots add -d /home/myplots
This already completes the installation, setup and startup of Chia. For updating Chia, I created a separate tutorial (click here).
Generate New Chia Plots
In the following part we will devote ourselves to the creation of new plots with chia and for this we will take a closer look at the syntax of this command.
. ./activate
screen -mdS Chia1 chia plots create -k 32 -r 2 -n 1 -t /ssd/1 -d /hdd/1
Screen -mdS will start Chia in a new window – this prevents us from terminating the operation if the connection is lost.
Chia1 is the name of the window
plots create is the command to create a new plot
-k 32 specifies that we want to create a plot of size k32 (about 250 GB temporary data and 100 GB final plot)
-r 2 indicates that we want to use 2 threads for this
-n 1 specifies that we want to create 1 plot
-t /ssd/1 specifies that the temporary directory is “/ssd/1”
-d /hdd/1 specifies that the final plot directory is “/hdd/1”
Tip: With “Screen” you can easily run multiple plot operations (on different hard disks, for example) at the same time. I recommend here an interval of about 15 to 30 minutes per thread (especially if the same plot target is used).
Transfer Chia Plots to another PC (network)
In the following example you will additionally learn how to create new plots on a “plot computer” and transfer them to a “farm computer” – and this in an endless loop.
This requires rsync and sshpass to be installed:
apt-get -y install rsync
apt-get -y install sshpass
Creates a new file “endless.sh”
vi endless.sh
INSERT key
with the following content
for (( ; ; ))
do
echo "infinite loop [ CTRL+C to exit]"
echo "powered by lautenbacher.io"
chia plots create -k 32 -r 12 -n 1 -t /tempDirectory -d /FinalPlotDirectory
sshpass -p "secretpassword" rsync --remove-source-files --progress -e 'ssh -p23' --recursive /FinalesPlotDirectory/ username@hostOrIP-AddressoftheFarmComputer:/home/destinationDirectoryFuerPlotsOnTheFarmComputer/
done
Of course, the content still needs to be adjusted accordingly, then we save with
ESC-Tase
:wq
ENTER key
and make the file executable
chmod 775 endless.sh
and start the infinite loop in a new screen session, with venv enabled
screen
. ./activate
/endless.sh
In addition, you still need to add the HostKey or disable the HostKey check for the farm machine, that can be done by editing the file “/etc/ssh/ssh_config” and adding an entry according to the following example:
Host deinfarmer.de/IP
StrictHostKeyChecking no
From now on, we plot endless chia plots and then automatically transfer them to the target host. If the SSH connection is disconnected this is no problem (thanks to the little tool screen).
Tip: You can see the current writing speed with the command “iotop”. All screen sessions can be displayed with “screen -ls” and recalled with “screen -r ID”. With the key combination Ctrl+A and D you can leave the currently open screen window without closing it.
Please send coffee donations to: 0xd0803A568615A18403C3722AC6dBb3202FD14034 (Ethereum)
You have 256GB of RAM and want to create a ramdisk for Chia? No problem:
mount -t tmpfs -o size=241G ilovelautenbacherch /home/ramdisk/
This command creates a 241 GB ramdisk under /home/ramdisk/ – This is sufficient for plotting k32 plots. I recommend using ECC ram. To erase, just use “umount”.
You have a lot of new disks attached and now you want to format, partition and mount them?
Tip: You can see all (already) available directories (and mounted disks) directly with “df”
Let’s first check if the new disk is present, with
fdisk -l
Here we also detect the very important path of the new disk, e.g. /dev/sdb
Now we create a new GPT table and a new partition for the disk sdb:
fdisk /dev/sdb
g
n
1
ENTER
ENTER
w
Now we format the new partition sdb1 on the hard disk sdb:
mke2fs -j /dev/sdb1
and last but not least, we create the “virtual path” and mount the disk to the system:
mkdir /hdd/1
mount -v -o rw /dev/sdb1 /hdd/1
Explanation: “/hdd/1” here stands for the later path of the hard disk and “/dev/sdb1/” is the “original hardware address”, so to speak. “mkdir” creates a new directory, if necessary the directory “/hdd” must be created first
Tip: The hard disk can be removed again with “umount”.
These steps must be repeated for each new hard disk/SSD. If the hard disk is already formatted, creating the GPT table and partitioning can be omitted. FAT32 is not a suitable file system for Chia. MBR tables are limited to 2 TB partitions, for this reason I recommend and use GPT tables.
To ensure that the new partitions are mounted after a reboot, the file “/etc/fstab/” must be edited. Here, the original address and the virtual path must be specified for each hard disk, each on a new line. Attached is an example for the partition sdb1 which is mounted in the directory /hdd/1:
/dev/sdb1 /hdd/1 auto rw 0 0
VirtualBox port forwarding (SSH terminal for Linux virtual server)
Of course you want to access your (virtual) server via SSH (Putty), for this you just need to set up a port forwarding in VirtualBox (Change->Network->Port forwarding).
In detail, the host port and guest port must be set to 22 and forwarded, respectively.
After that you can log in to the Linux virtual server with putty using the address “localhost”
Frequently asked questions about Chia
How much data is written for a plot (k32)
During the creation of a plot, about 1.6 TB are written and read. This is done in 128 so-called (temporary) buckets.
Why are SSDs/NVMEs faster than HDDs?
Because there are 128 buckets involved (see above), there are also a corresponding number of I/O accesses, which ultimately explains why SSDs/NVMEs are faster.
How long does it take to create a plot with an SSD/HDD/NVME/Ramdisk?
Plotting with a conventional HDD takes about 18 hours, with an SSD about 7 hours, with an NVME about 6 hours and with a ramdisk about 5 hours. Personally, I have already been able to create a plot in 4.33 hours.
How long will my SSD, HDD, NVME or ramdisk survive?
Theoretically, the HDD survives endless writes, an SSD survives about 600 TBW or 374 plots, an NVME survives about 150 TBW or 93.5 plots. With the HDD, however, the ramp and the write head are also heavily stressed by the many back and forth jumps. A Ramdisk does not know all these problems, here are endlessly many write operations with best possible I/O access of the CPU possible.
Why is a ramdisk not enough for plotting in practice?
With a Ramdisk can be created only 1 plot at the same time, that is fast and material-conserving but not purposeful. It is better to create plots on several SSDs at the same time.
Can I use a PCIe SATA controller with 6 ports?
Yes and no, these controllers are usually only equipped with a PCIe x1 connector. While this allows you to connect HDDs for your Chia farm, these controllers are not suitable for plotting itself. I recommend using controllers with PCIe x4 or more.
How do I time my plots best when using multiple SSDs?
I recommend you to start your plots time-shifted (about 15 to 30 minutes difference). Especially if the target of the plot is the same HDD. You will need about 15 to 30 minutes to copy your plot to the HDD.
How many plots can I create simultaneously on an SSD or NVME?
You should have about 250 GB of temp memory available for each plot. Therefore, on a 1 TB SSD, you can generate 3 plots at a time. The same is true for NVMEs, as they have very good access times anyway.
But I personally would still recommend you to start these simultaneous plotting operations on the same SSD, with a time difference of about 1 hour.
Shouldn’t I use more CPU cores for creating the plots?
It is best to use 2 CPU cores or threads, using more than 4 cores will actually cause a drop in speed.
What does the CPU depend on?
A high single-core performance is preferable.
How much memory does a plotting process need/is more RAM better?
A plot process requires about 1.2 to 4.5 GB of memory. Allocating more than 4.5 GB of ram does not result in significant improvements.
Can I plot via USB3?
With a Samsung 860 Evo and USB3, the plot time is a substantial 13 hours – a waste of the SSD.
Can I farm via USB3?
Of course, that’s not a problem.
Can you help me?
Yes, I can help you with your Chia project at reasonable hourly rates – here’s the contact form.
Note: This text is protected by copyright. There is no other Chia tutorial so far that actually covers all important steps, especially with relevant hints that go beyond just installing Chia. So copying is prohibited – should you quote small parts from here, the least you can do is a backlink; should you create a YouTube video, I expect a backlink in the upper part of the description text and that the page is also featured in the video.
Should you need (inexpensive but chargeable) help, I’m happy to be of assistance at contact.
Please send coffee donations to: 0xd0803A568615A18403C3722AC6dBb3202FD14034 (Ethereum)