CentOS 7 安装EOS 并启动钱包

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/joelcat/article/details/81252496

服务器信息

系统 地区 磁盘 内存 CPU
CentOS 7 日本 4T 64G

安装前环境

  1. 更新yum
yum update
  1. 安装git
yum install git
  1. 创建工作目录(此目录为个人喜好, 可以在任意位置)
mkdir eos_install && cd eos_install

安装 EOS

  1. 拉取源码
git clone https://github.com/EOSIO/eos --recursive
  1. 编译
cd eos

chmod +x eosio_build.sh

./eosio_build.sh

在编译的途中会自己下载一些依赖, 可能需要输入管理员的密码,
因为我不是root 账户,所以我输入了大概三次, 所以编译过程中最好值守;

编译完成之后会有下图信息:

这里写图片描述

  1. 拷贝可执行文件到/usr/local/
cd build
make install

eos 程序将安装到 /usr/local/eosio

第一步不是必须做的, 因为在 build/programs/ 目录下已经有可执行文件
这里安装一下是为了在任何地方执行eos 的相关工具, 和为了方便使用c++ 开发时包含eos api 的头文件

  1. 配置环境变量
echo "export PERSONAL_ESO_HOME=/usr/local/eosio" >> /etc/profile
echo "export PATH=$PATH:$PERSONAL_ESO_HOME/bin" >> /etc/profile
source /etc/profile
which cleos

上面我是修改了系统环境变量, 当然你也可以修改当前用户下的环境变量 ~/.bashrc
上面我给EOS 设置的环境变量是 PERSONAL_ESO_HOME 是因为我怕EOS 会自己配置环境变量, 我的目的是不冲突;
如果执行最后一句命令(which cleos) 没有输出cleos 的路径(/usr/local/eosio/bin/cleos), 那么安装出错了

启动钱包

  1. 启动钱包

启动钱包所用的到工具是keosd
可以用 -h 参数来查看keosd 启动需要的参数,

keosd -h

具体输出我这里就省略了

其中 -c (–config) 和 -d (–data-dir) 是常用的, 其他都会通过配置文件设定;
-d 选项: 指定钱包的文件目录, 默认在 ~/eosio-wallet
-c 选项: 设定钱包配置文件的名字,默认为 config.ini,配置文件必须在-d 指定的目录下

  1. 钱包配置文件

以下是钱包的一些简单配置选项,我在英文注释上添加了个人理解和中文注释

# The local IP and port to listen for incoming http connections; set blank to disable. (eosio::http_plugin)
#设置监听端口和地址,如果要允许公网连接, 将ip地址填写成你的公网ip地址,本机直接用127.0.0.1(localhost)即可
#如果要禁用这个功能 直接设置为空就是了
http-server-address = 161.202.101.105:13335

# The local IP and port to listen for incoming https connections; leave blank to disable. (eosio::http_plugin)
#同上,此为https设定
# https-server-address = 

# Filename with the certificate chain to present on https connections. PEM format. Required for https. (eosio::http_plugin)
# https-certificate-chain-file = 

# Filename with https private key in PEM format. Required for https (eosio::http_plugin)
# https-private-key-file = 

#以下四项用来设定特定的返回头信息, 如果要浏览器调用eos, 这四项可以设置成跨域样式
# Specify the Access-Control-Allow-Origin to be returned on each request. (eosio::http_plugin)
# access-control-allow-origin = 

# Specify the Access-Control-Allow-Headers to be returned on each request. (eosio::http_plugin)
# access-control-allow-headers = 

# Specify the Access-Control-Max-Age to be returned on each request. (eosio::http_plugin)
# access-control-max-age = 

#此项可以设定ajax跨域时是否携带cookie
# Specify if Access-Control-Allow-Credentials: true should be returned on each request. (eosio::http_plugin)
access-control-allow-credentials = false

# The maximum body size in bytes allowed for incoming RPC requests (eosio::http_plugin)
max-body-size = 1048576

# Append the error log to HTTP responses (eosio::http_plugin)
verbose-http-errors = false


# If set to false, then any incoming "Host" header is considered valid (eosio::http_plugin)
http-validate-host = 1

# Additionaly acceptable values for the "Host" header of incoming HTTP requests, can be specified multiple times.  Includes http/s_server_address by default. (eosio::http_plugin)
# http-alias = 

##钱包文件的存储路径, 也就是说生成的xxx.wallet会保存到那个文件夹下
# The path of the wallet files (absolute path or relative to application data dir) (eosio::wallet_plugin)
wallet-dir = "."

#设置钱包解锁后未活动多久自动锁定,单位秒,任何钱包命令都表示在活动
# Timeout for unlocked wallet in seconds (default 900 (15 minutes)). Wallets will automatically lock after specified number of seconds of inactivity. Activity is defined as any wallet command e.g. list-wallets. (eosio::wallet_plugin)
unlock-timeout = 900

# Override default URL of http://localhost:12345 for connecting to yubihsm-connector (eosio::wallet_plugin)
# yubihsm-url = 

# Enables YubiHSM support using given Authkey (eosio::wallet_plugin)
# yubihsm-authkey = 

######################################################
#插件设定,此项是可重复设置的
#上面的英文注释最后的括号中的就是相应的插件
#例如要开启http模块和钱包模块:
#plugin = eosio::http_plugin
#plugin = eosio::wallet_plugin
#######################################################

# Plugin(s) to enable, may be specified multiple times
# plugin = 
  1. 启动钱包

假如你通过上面的配置了一份配置文件, 放在 ~/mywallet 下, 名字为 mywallet.conf;
那么启动命令如下

扫描二维码关注公众号,回复: 5318309 查看本文章
keosd -d ~/mywallet -c mywallet.conf

不过在我的keosd 指定-d 没有效果,最后我只有用默认目录了(~/eosio-wallet/)

注意: keosd 这个命令启动不是守护进程, 所以你可能要使用nohup 命令将命令挂在到后台

参考资料:

EOSIO 开发者: https://developers.eos.io/

猜你喜欢

转载自blog.csdn.net/joelcat/article/details/81252496