CentOS 8 how to compile: Step-by-step
Tested on CentOS Linux release 8.3.2011
Housekeeping
Update CentOS:
[root@ ~]# yum update -y [root@ ~]# yum clean packages [root@ ~]# yum clean metadata [root@ ~]# yum clean headers [root@ ~]# yum clean all
Install wget and tar
[root@ ~]# yum install wget tar -y
Install Go (compiler)
Latest release here: https://golang.org/dl/
[root@ ~]# wget https://golang.org/dl/go1.16.4.linux-amd64.tar.gz
Extract archive to desired location. In the below example, the archive is extracted to /usr/local
[root@ ~]# tar -zxvf go1.16.4.linux-amd64.tar.gz -C /usr/local/
Setup Go Environment variables
GOPATH - From /root
[root@ ~]# mkdir go
GOROOT - place the following command in $HOME/.bash_profile
file to keep persistent across sessions.
[root@ ~]# nano .bash_profile export PATH=$PATH:/usr/local/go/bin Ctrl+Z Y
Check Go Environment variables
[root@ ~]# go env GOPATH="/root/go" GOROOT="/usr/local/go"
Note: If you see a "bash go command does not exist" error, reboot server and try again.
Verify Go installation
[root@ ~]# go version go version go1.16.4 linux/amd64
Install git
[root@ ~]# sudo dnf install git -y
You can confirm that you have installed Git correctly by running the following command:
[root@ ~]# git --version git version 2.27.0
Download git repository
[root@ ~]# git clone https://github.com/PeernetOfficial/Cmd
Change directory to Cmd (location of source code)
[root@ ~]# cd Cmd
Compile!
[root@ Cmd]# go build go: downloading github.com/PeernetOfficial/core v0.0.0-20210415105906-ce2d3309af30 go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b go: downloading golang.org/x/net v0.0.0-20210414194228-064579744ee0 go: downloading github.com/btcsuite/btcd v0.21.0-beta.0.20210401013323-36a96f6a0025 go: downloading golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 go: downloading golang.org/x/sys v0.0.0-20210415045647-66c3f260301c go: downloading lukechampine.com/blake3 v1.1.5 go: downloading github.com/pkg/errors v0.9.1 go: downloading github.com/PeernetOfficial/core/dht v0.0.0-20210410140655-6a9d16717779 go: downloading github.com/klauspost/cpuid v1.3.1
Check output
[root@ Cmd]# ls Cmd 'Command Line.go' go.mod go.sum Main.go README.md Test_test.go
The output results in the Cmd binary.
Rename Cmd to Peernet
[root@ Cmd]# mv ./Cmd ../Peernet [root@ Cmd]# cd .. [root@ ~]# ls Cmd go go1.16.3.linux-amd64.tar.gz original-ks.cfg Peernet
The mv command moves the Cmd binary name to /root and renames it Peernet.
Run Peernet
[root@ ~]# ./Peernet Peernet Cmd 0.2 ------------------------------ Please enter a command: help Show this help net list Lists all network adapters and their IPs status Get current status chat Send text to all peers peer list List current peers debug key create Create Public-Private Key pair debug key self List current Public-Private Key pair hash Create blake3 hash of input warehouse get Get data from local warehouse by hash warehouse store Store data into local warehouse dht get Get data via DHT by hash dht store Store data into DHT Incoming initial response from 167.99.45.141:112
Howdy, Stranger!