multichain-web-demo安装与实现

项目相关介绍请查看https://github.com/MultiChain/multichain-web-demo,简单来说就是multichain节点的网页可视化。

第一步:安装Apache

1 # 安装Apache2
2 sudo apt-get install apache2
3 # 重启Apache服务
4 sudo apache2ctl restart
5 # 如果出现AH00558: apache2: Could not reliably determine the server's fully qualified domain name的错误
6 vim /etc/apache2/apache2.conf
7 # 最后加入一句 ServerName localhost:80
8 # 测试,浏览器输入http://localhost或者是http://127.0.0.1,如果看到了It works!,那就说明Apache就成功的安装了,Apache的默认安装,会在/var下建立一个名为www的目录,这个就是Web目录了,所有要能过浏览器访问的Web文件都要放到这个目录里。稍后的multichain-web-demo文件会放在该目录下。
9 # 如果出现其他问题,可以参考https://blog.csdn.net/newfarhui/article/details/81448260

第二步:安装PHP

 1 # 安装最新版本的php
 2 sudo apt-get install php
 3 # 查看本机php版本
 4 php -v
 5 # 测试Apache能否解析PHP
 6 vim /var/www/html/phpinfo.php
 7 # 文件代码如下
 8 <?php echo phpinfo();?>
 9 # 浏览器访问,会出现PHP Version网页,如果是云服务器,则改为云服务器IP
10 http://localhost/phpinfo.php 

第三步:安装PHP扩展curl

 1 # 查询curl的php支持名字
 2 apt-cache search curl | grep php
 3 # 会出现如下内容
 4 # php-curl - CURL module for PHP [default]
 5 # php-http-request2 - Provides an easy way to perform HTTP requests
 6 # php-picofeed - Modern library to handle RSS/Atom feeds
 7 # php7.1-curl - CURL module for PHP
 8 # php7.2-curl - CURL module for PHP
 9 # php7.3-curl - CURL module for PHP
10 # 安装提示的版本
11 sudo apt-get install php7.3-curl
12 # 重启Apache服务
13 sudo apache2ctl restart

第四步:项目拷贝

# 在/var/www/html/路径下拷贝项目
git clone https://github.com/MultiChain/multichain-web-demo.git
# 出现fatal: unable to access 'https://github.com/MultiChain/multichain-explorer.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.克隆失败
git config --global http.sslVerify "false"
git clone https://github.com/MultiChain/multichain-web-demo.git

第五步:安装Multichain Blockchain

 1 # 进入超级用户 rott
 2 su (enter root password)
 3 # 切换目录
 4 cd /tmp
 5 # 下载项目
 6 wget https://www.multichain.com/download/multichain-2.1.2.tar.gz
 7 # 解压文件
 8 tar -xvzf multichain-2.1.2.tar.gz
 9 # 进入目录
10 cd multichain-2.1.2
11 # 移动命令
12 mv multichaind multichain-cli multichain-util /usr/local/bin (to make easily accessible on the command line)
13 # 完成退出
14 exit (to return to your regular user)

第六步:建链

1 # 创建chain1
2 multichain-util create chain1
3 # 运行chain1
4 multichaind chain1 -daemon

第七步:查看链路信息

1 # 查看rpcuser和rpcpassword
2 cat ~/.multichain/chain1/multichain.conf
3 # 查看default-rpc-port
4 grep rpc-port ~/.multichain/chain1/params.dat

第八步:修改配置文件

1 # 修改配置文件名
2 cp config-example.txt config.txt
3 # 修改文件,替换为刚刚查看的信息
4 default.name=Default(可修改)                   # name to display in the web interface
5 default.rpchost=127.0.0.1(可修改)              # IP address of MultiChain node
6 default.rpcport=12345(需要修改)                # usually default-rpc-port from params.dat
7 default.rpcuser=multichainrpc(需要修改)        # username for RPC from multichain.conf
8 default.rpcpassword=mnBh8aHp4n.. (需要修改)    # password for RPC from multichain.conf

第九步:访问网页

1 # ip/文件名,例子如下,文件名为/var/www/html/下项目的文件名,一般与我一致
2 http://127.0.0.1/multichain-web-demo/

 

posted @ 2021-04-17 10:12  北漂的尘埃  阅读(190)  评论(0编辑  收藏  举报