-bash:cfssl:找不到命令

时间:2015-06-03 14:36:19

标签: go

当我尝试使用此命令安装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 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

我真的不知道为什么会这样,因为我安装了this版本。

2 个答案:

答案 0 :(得分:3)

您似乎在获取cfssl时遇到错误。

因为Cloudflare's Github page表示你需要至少使用Go lang 1.4版。

如果你下载并安装go 1.4并获得cfssl,那么将创建二进制文件 http://localhost/dummy/index.html

参考$ GOPATH变量 - here

答案 1 :(得分:0)

安装最新的Go lang版本。

1.yum更新

2.wget https://dl.google.com/go/go1.12.linux-amd64.tar.gz

3.tar -xzf go1.12.linux-amd64.tar.gz

4.mv转到/ usr / local

5。设置环境变量。

 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安装树

6.tree bin

7.go获取-u github.com/cloudflare/cfssl/cmd /...