英文:
-bash: cfssl: command not found
问题
当我尝试使用以下命令安装cfssl时:
go get -u github.com/cloudflare/cfssl/cmd/cfssl
我收到以下输出:
# github.com/cloudflare/cfssl/crypto/pkcs7
go_packages/src/github.com/cloudflare/cfssl/crypto/pkcs7/pkcs7.go:141: pkcs7.ContentType.String undefined (type asn1.ObjectIdentifier has no field or method String)
# github.com/cloudflare/cfssl/helpers/derhelpers
go_packages/src/github.com/cloudflare/cfssl/helpers/derhelpers/derhelpers.go:16: undefined: crypto.Signer
# github.com/cloudflare/cfssl/csr
go_packages/src/github.com/cloudflare/cfssl/csr/csr.go:191: undefined: x509.CertificateRequest
go_packages/src/github.com/cloudflare/cfssl/csr/csr.go:204: undefined: x509.CreateCertificateRequest
# golang.org/x/crypto/ocsp
go_packages/src/golang.org/x/crypto/ocsp/ocsp.go:494: undefined: crypto.Signer
# github.com/cloudflare/cf-tls/tls
go_packages/src/github.com/cloudflare/cf-tls/tls/handshake_client.go:431: undefined: crypto.Signer
我真的不知道这是否有害,以及是否与该工具的使用有关。然而,当我尝试使用它时,我收到以下错误:
-bash: cfssl: Command not found.
我从未使用过go,但我想使用这个工具。你们知道为什么它不能按预期工作吗?
编辑
go env
的输出:
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ubuntu/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"
go version
的输出:
go version go1.2.1 linux/amd64
我真的不知道为什么会这样,因为我安装了这个版本。
英文:
When I tried to install cfssl with this command:
go get -u github.com/cloudflare/cfssl/cmd/cfssl
I received following output:
# github.com/cloudflare/cfssl/crypto/pkcs7
go_packages/src/github.com/cloudflare/cfssl/crypto/pkcs7/pkcs7.go:141: pkcs7.ContentType.String undefined (type asn1.ObjectIdentifier has no field or method String)
# github.com/cloudflare/cfssl/helpers/derhelpers
go_packages/src/github.com/cloudflare/cfssl/helpers/derhelpers/derhelpers.go:16: undefined: crypto.Signer
# github.com/cloudflare/cfssl/csr
go_packages/src/github.com/cloudflare/cfssl/csr/csr.go:191: undefined: x509.CertificateRequest
go_packages/src/github.com/cloudflare/cfssl/csr/csr.go:204: undefined: x509.CreateCertificateRequest
# golang.org/x/crypto/ocsp
go_packages/src/golang.org/x/crypto/ocsp/ocsp.go:494: undefined: crypto.Signer
# github.com/cloudflare/cf-tls/tls
go_packages/src/github.com/cloudflare/cf-tls/tls/handshake_client.go:431: undefined: crypto.Signer
I really have no clue whether this is harmful or not and has something to do with the usage of this tool. However when I try to use it, I receive this error:
-bash: cfssl: Command not found.
I never used go but I wanted to use this tool. Do you guys know why this is not working as expected?
Edit
output of go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ubuntu/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"
output of go version
go version go1.2.1 linux/amd64
I really don't know why this is the case because I installed this version.
答案1
得分: 3
看起来你在获取cfssl时遇到了错误。
因为Cloudflare的Github页面上说你至少需要安装Go语言版本1.4。
如果你下载并安装了Go 1.4,并获取了cfssl,那么二进制文件将会被创建在$GOPATH/bin/cfssl
中。
请参考$GOPATH变量 - 这里。
英文:
It seems that you have errors in getting cfssl.
Because Cloudflare's Github page says you require to have Go lang version 1.4 atleast.
If you download and install go 1.4 and get cfssl, then binary will be created in
$GOPATH/bin/cfssl
Refer $GOPATH variable - here
答案2
得分: 0
安装最新版本的Go语言。
-
yum update
-
tar -xzf go1.12.linux-amd64.tar.gz
-
mv go /usr/local
-
设置环境变量。
5.1. GOROOT是Go软件包安装在系统上的位置。
export GOROOT=/usr/local/go
5.2. GOPATH是您的工作目录的位置。
export GOPATH=$HOME/your project location
5.3. 现在设置PATH变量以便系统范围内访问go二进制文件。
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
-
验证
6.1. go version
6.2. go env
CFSSL
-
git clone https://github.com/cloudflare/cfssl.git $GOPATH/src/github.com/cloudflare/cfssl
-
cd $GOPATH/src/github.com/cloudflare/cfssl
-
make
-
yum install tree
-
tree bin
-
go get -u github.com/cloudflare/cfssl/cmd/...
英文:
Install Go lang version latest.
1.yum update
2.wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz
3.tar -xzf go1.12.linux-amd64.tar.gz
4.mv go /usr/local
5.set up environment variables.
5.1.GOROOT is the location where Go package is installed on your system
export GOROOT=/usr/local/go
5.2.GOPATH is the location of your work directoryexport
export GOPATH=$HOME/your project location
5.3.Now set the PATH variable to access go binary system wide
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
6.verify
6.1.go version
6.2.go env
CFSSL
1.git clone https://github.com/cloudflare/cfssl.git
$GOPATH/src/github.com/cloudflare/cfssl
2.cd $GOPATH/src/github.com/cloudflare/cfssl
3.make
4.yum install tree
6.tree bin
7.go get -u github.com/cloudflare/cfssl/cmd/...
答案3
得分: 0
你可以使用以下命令来安装最新版本的 cfssl 和 cfssljson。你只需要在你的操作系统上安装 wget 命令,并输入以下命令:
yum -y -q install wget
VERSION=$(curl --silent "https://api.github.com/repos/cloudflare/cfssl/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*//')
VNUMBER=${VERSION#"v"}
wget https://github.com/cloudflare/cfssl/releases/download/${VERSION}/cfssl_${VNUMBER}_linux_amd64 -O cfssl
wget https://github.com/cloudflare/cfssl/releases/download/${VERSION}/cfssljson_${VNUMBER}_linux_amd64 -O cfssljson
chmod +x cfssl
chmod +x cfssljson
mv cfssl /usr/local/bin
mv cfssljson /usr/local/bin
英文:
You can use these commmand to install cfssl and cfssljson on last version. You need only have wget commmand installed on your OS and type these cmd:
yum -y -q install wget
VERSION=$(curl --silent "https://api.github.com/repos/cloudflare/cfssl/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*//')
VNUMBER=${VERSION#"v"}
wget https://github.com/cloudflare/cfssl/releases/download/${VERSION}/cfssl_${VNUMBER}_linux_amd64 -O cfssl
wget https://github.com/cloudflare/cfssl/releases/download/${VERSION}/cfssljson_${VNUMBER}_linux_amd64 -O cfssljson
chmod +x cfssl
chmod +x cfssljson
mv cfssl /usr/local/bin
mv cfssljson /usr/local/bin
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论