千家信息网

Ubuntu 14.04 下如何安装Ontology区块链浏览器开发

发表于:2025-02-05 作者:千家信息网编辑
千家信息网最后更新 2025年02月05日,这篇文章主要介绍了Ubuntu 14.04 下如何安装Ontology区块链浏览器开发,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。温
千家信息网最后更新 2025年02月05日Ubuntu 14.04 下如何安装Ontology区块链浏览器开发

这篇文章主要介绍了Ubuntu 14.04 下如何安装Ontology区块链浏览器开发,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

温馨提示:需要在单机上部署好 Ontology,详情请见 Ubuntu 14.04 下,Ontology 开发环境构建 、部署及测试

安装Java

可参考:https://my.oschina.net/uchihamadara/blog/1798979

安装Maven

可参考:https://my.oschina.net/uchihamadara/blog/1798979

安装 MariaDB 10.2

官网链接

  • 添加源

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943dbsudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/10.2/ubuntu trusty main'
  • 安装 MariaDB

sudo apt-get updatesudo apt-get install software-properties-commonsudo apt-get install mariadb-server

在安装中,会被要求设置 MariaDB 的 root 密码。

命令行进入 MariaDB,

blockchain@ThinkPad-T460:~$ mysql -uroot -pEnter password: Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 51Server version: 10.2.14-MariaDB-10.2.14+maria~trusty-log mariadb.org binary distributionCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> show databases ;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema |+--------------------+3 rows in set (0.00 sec)MariaDB [(none)]> exit ;Byeblockchain@ThinkPad-T460:~$

MariaDB 安装成功。

安装 Nginx

blockchain@ThinkPad-T460:~$ sudo add-apt-repository ppa:nginx/stableblockchain@ThinkPad-T460:~$ sudo apt-get updateblockchain@ThinkPad-T460:~$ sudo apt-get install software-properties-commonblockchain@ThinkPad-T460:~$ sudo apt-get install nginx

查看 nginx 版本

blockchain@ThinkPad-T460:~$ nginx -vnginx version: nginx/1.12.2blockchain@ThinkPad-T460:~$

启动 nginx

blockchain@ThinkPad-T460:~$ sudo /etc/init.d/nginx startstart: Job is already running: nginxblockchain@ThinkPad-T460:~$ blockchain@ThinkPad-T460:~$ ps -ef | grep nginxroot     15943     1  0 15:39 ?        00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;www-data 15945 15943  0 15:39 ?        00:00:00 nginx: worker process                           www-data 15946 15943  0 15:39 ?        00:00:00 nginx: worker process                           www-data 15947 15943  0 15:39 ?        00:00:00 nginx: worker process                           www-data 15948 15943  0 15:39 ?        00:00:00 nginx: worker process                           blockch+ 16003  2577  0 15:51 pts/1    00:00:00 grep --color=auto nginx

然后访问 http://localhost/ ,出现如下页面,表明一切正常。

安装Node.js

点击 Node.js官网,选择相应版本 解压该压缩文件

blockchain@ThinkPad-T460:~$ tar xvJf Downloads/node-v8.11.2-linux-x64.tar.xz

配置环境变量

export NODE_HOME=$HOME/node-v8.11.2-linux-x64export PATH=$NODE_HOME/bin:$PATH

查看版本号

blockchain@ThinkPad-T460:~$ node -vv8.11.2blockchain@ThinkPad-T460:~$ npm -v5.6.0blockchain@ThinkPad-T460:~$

至此,Node.js 安装完成。

下载 Ontology blockchain explore

blockchain@ThinkPad-T460:~/GitClone$ git clone https://github.com/ontio/ontology-explorerCloning into 'ontology-explorer'...remote: Counting objects: 635, done.remote: Compressing objects: 100% (326/326), done.remote: Total 635 (delta 282), reused 583 (delta 242), pack-reused 0Receiving objects: 100% (635/635), 5.70 MiB | 187.00 KiB/s, done.Resolving deltas: 100% (282/282), done.Checking connectivity... done.blockchain@ThinkPad-T460:~/GitClone$

配置 Ontology blockchain explorer 后端

进入 ontology-explorer 工程 back-end 目录下 的 sql 子目录

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$ cd sql/ ; pwd/home/blockchain/GitClone/ontology-explorer/back-end/sqlblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end/sql$ ls -lttotal 20-rw-rw-r-- 1 blockchain blockchain  941  5月 23 10:58 tbl_ont_block.sql-rw-rw-r-- 1 blockchain blockchain  637  5月 23 10:58 tbl_ont_current.sql-rw-rw-r-- 1 blockchain blockchain  831  5月 23 10:58 tbl_ont_ontid_detail.sql-rw-rw-r-- 1 blockchain blockchain 1065  5月 23 10:58 tbl_ont_txn_detail.sql-rw-rw-r-- 1 blockchain blockchain  432  5月 23 10:58 view_ont_transaction.sqlblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end/sql$

在 MariaDB 中 建立 _explorer _库,在 explorer 下,根据上述 5个 sql 文件 ,建立相应的 表 或者 视图。

MariaDB [(none)]> use explorer ;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedMariaDB [explorer]> show tables ;+----------------------+| Tables_in_explorer   |+----------------------+| tbl_ont_block        || tbl_ont_current      || tbl_ont_ontid_detail || tbl_ont_txn_detail   || view_ont_transaction |+----------------------+5 rows in set (0.00 sec)MariaDB [explorer]>

进入 ontology-explorer 工程 back-end 目录下 的 lib 子目录

blockchain@ThinkPad-T460:~/GitClone$ cd ontology-explorer/back-end/lib/ ; ls -lttotal 4608-rw-rw-r-- 1 blockchain blockchain 4717357  5月 16 17:58 ontology-sdk-java.jarblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end/lib$

mvn install jar 包,如下所示

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end/lib$ mvn install:install-file -DgroupId=com.github.ontio -DartifactId=javasdk -Dversion=v1.0 -Dpackaging=jar -Dfile=ontology-sdk-java.jar[INFO] Scanning for projects...[INFO]                                                                         [INFO] ------------------------------------------------------------------------[INFO] Building Maven Stub Project (No POM) 1[INFO] ------------------------------------------------------------------------[INFO] [INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---[INFO] Installing /home/blockchain/GitClone/ontology-explorer/back-end/lib/ontology-sdk-java.jar to /home/blockchain/.m2/repository/com/github/ontio/javasdk/v1.0/javasdk-v1.0.jar[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 2.263 s[INFO] Finished at: 2018-05-23T11:04:03+08:00[INFO] Final Memory: 6M/141M[INFO] ------------------------------------------------------------------------blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end/lib$

返回 ontology-explorer 工程 的 back-end 目录,

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end/lib$ cd .. ; ls -lttotal 44drwxrwxr-x 4 blockchain blockchain 4096  5月 23 10:58 src-rw-rw-r-- 1 blockchain blockchain 6468  5月 23 10:58 mvnw-rw-rw-r-- 1 blockchain blockchain 4994  5月 23 10:58 mvnw.cmd-rw-rw-r-- 1 blockchain blockchain 3592  5月 23 10:58 pom.xmldrwxrwxr-x 2 blockchain blockchain 4096  5月 23 10:58 sqldrwxrwxr-x 2 blockchain blockchain 4096  5月 23 10:58 configdrwxrwxr-x 2 blockchain blockchain 4096  5月 23 10:58 lib-rw-rw-r-- 1 blockchain blockchain 7651  5月 23 10:58 LICENSEblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$

maven 编译打包

mvn clean package

此时,报错

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$ mvn clean package[INFO] Scanning for projects...[INFO]                                                                         [INFO] ------------------------------------------------------------------------[INFO] Building explorer 1.0.0-SNAPSHOT[INFO] ------------------------------------------------------------------------[WARNING] The POM for com.github.ontio:javasdk:jar:v1.1 is missing, no dependency information available[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 2.704 s[INFO] Finished at: 2018-05-16T20:49:08+08:00[INFO] Final Memory: 17M/200M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal on project explorer: Could not resolve dependencies for project com.ont:explorer:jar:1.0.0-SNAPSHOT: Failure to find com.github.ontio:javasdk:jar:v1.1 in http://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of alimaven has elapsed or updates are forced -> [Help 1][ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionExceptionblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$

打开 目录 下的 pom.xml 文件,找到

                                                       com.github.ontio                        javasdk                        v1.1                

v1.1 改为 version>v1.0,然后重新输入 mvn clean package,又报错

[ ERROR] [2018-05-16 21:11:54] org.apache.tomcat.jdbc.pool.ConnectionPool [181] - Unable to create initial connections of pool.java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873)        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1710)        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2191)        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2222)        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2017)        at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:779)        at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)        at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310)        at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203)        at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:735)        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:667)        at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:482)        at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:154)        at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118)        at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107)        at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131)        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)

从这个错误来看,是Mysql密码的问题。修改 ontology-explorer 工程 back-end 目录 config 子目录下的 application.properties 文件,

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$ vim config/application.properties

找到 database

################database################### Specify the DBMSspring.jpa.database = MYSQLspring.datasource.driverClassName = com.mysql.jdbc.Driverspring.datasource.url = jdbc:mysql://localhost:3306/explorer?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNullspring.datasource.username = rootspring.datasource.password = 123

修改相应的用户名 和 密码。然后重新输入 mvn clean package,终于成功。

Results :Tests run: 1, Failures: 0, Errors: 0, Skipped: 0[INFO] [INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ explorer ---[INFO] Building jar: /home/blockchain/GitClone/ontology-explorer/back-end/target/explorer-1.0.0-SNAPSHOT.jar[INFO] [INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) @ explorer ---[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 55.571 s[INFO] Finished at: 2018-05-23T16:54:34+08:00[INFO] Final Memory: 39M/280M[INFO] ------------------------------------------------------------------------blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$

此时,在 ontology-explorer 工程 back-end 文件夹 target 子目录下,能看到编译成功的 explorer-1.0.0-SNAPSHOT.jar

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$ ls -lt target/total 40812-rw-rw-r-- 1 blockchain blockchain 41691335  5月 23 16:54 explorer-1.0.0-SNAPSHOT.jar-rw-rw-r-- 1 blockchain blockchain    68317  5月 23 16:54 explorer-1.0.0-SNAPSHOT.jar.originaldrwxrwxr-x 2 blockchain blockchain     4096  5月 23 16:54 maven-archiverdrwxrwxr-x 2 blockchain blockchain     4096  5月 23 16:54 surefire-reportsdrwxrwxr-x 3 blockchain blockchain     4096  5月 23 16:53 test-classesdrwxrwxr-x 3 blockchain blockchain     4096  5月 23 16:53 generated-test-sourcesdrwxrwxr-x 4 blockchain blockchain     4096  5月 23 16:53 classesdrwxrwxr-x 3 blockchain blockchain     4096  5月 23 16:53 generated-sourcesdrwxrwxr-x 3 blockchain blockchain     4096  5月 23 16:53 maven-statusblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$

至此,Ontology blockchain explorer 后端 配置完成。

配置 Ontology blockchain explorer 前端

修改 ontology-explorer 工程 back-end 文件夹 config 子目录下的 application.properties 文件,找到 blockchain param

################port#######################server.port=8090################blockchain param###########node.restful.url = http://polaris1.ont.io:20334node.restful.url = http://127.0.0.1:20334node.amount=4#node.restful.url_0=http://polaris1.ont.io:20334node.restful.url_0=http://127.0.0.1:20334#node.restful.url_1=http://polaris2.ont.io:20334node.restful.url_1=http://127.0.0.1:20335#node.restful.url_2=http://polaris3.ont.io:20334node.restful.url_2=http://127.0.0.1:20336#node.restful.url_3=http://polaris4.ont.io:20334node.restful.url_3=http://127.0.0.1:20337

修改相应的 node.restful.url,保存退出。

修改 ontology-explorer 工程 front-end 文件夹 config 子目录下的 prod.env.js 文件, 修改前的内容为

'use strict'module.exports = {  NODE_ENV: '"production"',  BASE_URL: '"https://ont.io/"',  API_URL: '"https://explorer.ont.io/api/v1/explorer"',  BC_URL: '"https://srv.ont.io:10443/api/v1/"'}

修改后的内容为

'use strict'module.exports = {  NODE_ENV: '"production"',  BASE_URL: '"https://ont.io/"',  API_URL: '"http://127.0.0.1:8090/api/v1/explorer"',  BC_URL: '"https://srv.ont.io:10443/api/v1/"'}

返回 ontology-explorer 工程 front-end 目录,

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$ npm install> uglifyjs-webpack-plugin@0.4.6 postinstall /home/blockchain/GitClone/ontology-explorer/front-end/node_modules/webpack/node_modules/uglifyjs-webpack-plugin> node lib/post_install.jsnpm notice created a lockfile as package-lock.json. You should commit this file.npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})added 1379 packages in 104.893sblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$ blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$ npm run build> onto@1.0.0 build /home/blockchain/GitClone/ontology-explorer/front-end> node build/build.jsHash: fba06f0cd586b9cfb58fVersion: webpack 3.12.0Time: 48302ms                                                  Asset       Size  Chunks                    Chunk Names                  static/fonts/fontawesome-webfont.woff      98 kB          [emitted]                                     static/img/logo.96d4d40.png    13.7 kB          [emitted]                        static/js/vendor.012a6941fa3d926e8278.js     241 kB       0  [emitted]         vendor                  static/js/app.d52192ac235d91770dfd.js     142 kB       1  [emitted]         app             static/js/manifest.2ae2e69a05c33dfc65f8.js  857 bytes       2  [emitted]         manifest    static/css/app.4bac9a6dc37015ba26010943391ac5eb.css    14.1 kB       1  [emitted]         appstatic/css/app.4bac9a6dc37015ba26010943391ac5eb.css.map    29.7 kB          [emitted]                    static/js/vendor.012a6941fa3d926e8278.js.map    1.04 MB       0  [emitted]         vendor              static/js/app.d52192ac235d91770dfd.js.map     393 kB       1  [emitted]         app         static/js/manifest.2ae2e69a05c33dfc65f8.js.map    4.97 kB       2  [emitted]         manifest                                             index.html    1.36 kB          [emitted]                       static/css/bootstrap-4.0.0-litera.min.css     146 kB          [emitted]                                 static/css/font-awesome.min.css      31 kB          [emitted]                                             static/css/main.css      11 kB          [emitted]                            static/fonts/fontawesome-webfont.eot     166 kB          [emitted]                            static/fonts/fontawesome-webfont.svg     444 kB          [emitted]  [big]                     static/fonts/fontawesome-webfont.ttf     166 kB          [emitted]                                     static/img/timg.482a7da.gif    36.7 kB          [emitted]                          static/fonts/fontawesome-webfont.woff2    77.2 kB          [emitted]                                    static/fonts/FontAwesome.otf     135 kB          [emitted]                             static/fonts/SourceSansPro-Bold.otf     235 kB          [emitted]                       static/fonts/SourceSansPro-ExtraLight.otf     222 kB          [emitted]                                          static/img/backimg.png    1.14 kB          [emitted]                                          static/img/favicon.ico    9.66 kB          [emitted]                                       static/img/footerlogo.png    10.5 kB          [emitted]                          static/fonts/SourceSansPro-Regular.otf     230 kB          [emitted]                                          static/img/ontlogo.png    10.7 kB          [emitted]                                        static/img/header_bg.jpg    16.4 kB          [emitted]                                             static/img/timg.gif    36.7 kB          [emitted]                          static/js/bootstrap-4.0.0-beta2.min.js    50.6 kB          [emitted]                                          static/js/Chart.min.js     160 kB          [emitted]                              static/js/jquery-3.2.1.slim.min.js    69.6 kB          [emitted]                                  static/js/popper-1.12.9.min.js    19.2 kB          [emitted]                                               static/sdk/sdk.js   54 bytes          [emitted]                                              static/js/Chart.js     404 kB          [emitted]  [big]    Build complete.  Tip: built files are meant to be served over an HTTP server.  Opening index.html over file:// won't work.

此时,会在 ontology-explorer 工程 front-end 目录下,生成一个新的 dist 子目录

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$ ls -lt dist/total 8drwxrwxr-x 7 blockchain blockchain 4096  5月 23 21:02 static-rw-rw-r-- 1 blockchain blockchain 1359  5月 23 21:02 index.htmlblockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$

将新生成的 dist 目录下的 index.html 文件 和 static 文件夹,复制到 Nginx 的 root 目录

打开 Nginx 默认的配置文件

blockchain@ThinkPad-T460:~$ sudo vim /etc/nginx/sites-available/default

内容如下

# Default server configuration#server {        listen 80 default_server;        listen [::]:80 default_server;        # SSL configuration        #        # listen 443 ssl default_server;        # listen [::]:443 ssl default_server;        #        # Note: You should disable gzip for SSL traffic.        # See: https://bugs.debian.org/773332        #        # Read up on ssl_ciphers to ensure a secure configuration.        # See: https://bugs.debian.org/765782        #        # Self signed certs generated by the ssl-cert package        # Don't use them in a production server!        #        # include snippets/snakeoil.conf;        root /var/www/html;        # Add index.php to the list if you are using PHP        index index.html index.htm index.nginx-debian.html;        #server_name localhost;        server_name _;        location / {                # First attempt to serve request as file, then                # as directory, then fall back to displaying a 404.            try_files $uri $uri/ =404;        }        # pass PHP scripts to FastCGI server        #        #location ~ \.php$ {        #       include snippets/fastcgi-php.conf;        #        #       # With php-fpm (or other unix sockets):        #       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;        #       # With php-cgi (or other tcp sockets):        #       fastcgi_pass 127.0.0.1:9000;        #}        # deny access to .htaccess files, if Apache's document root        # concurs with nginx's one        #        #location ~ /\.ht {        #       deny all;        #}}

在笔者的环境下,Nginx 默认的 root 目录为 /var/www/html。

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$ sudo cp dist/index.html /var/www/html/[sudo] password for blockchain: blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$ sudo cp -r dist/static/ /var/www/html/blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/front-end$

至此,Ontology blockchain explorer 前端 配置完成。

运行整个工程

  • 启动部署的ONT单节点

blockchain@ThinkPad-T460:~/node2$ ./ontology 2018/05/23 22:00:33.675726 [TRACE] GID 1, main() main.go:76 Node version:  v0.6-98-g521b2018/05/23 22:00:33.675939 [INFO ] GID 1, 0. Open the accountPassword:2018/05/23 22:00:38.904321 [INFO ] GID 1, 1. Loading the Ledger2018/05/23 22:00:39.359335 [INFO ] GID 1, InitCurrentBlock currentBlockHash a199831b9bf5ec7ef7c5b2909401d09cceca6046dfbd3f37abb65aecf4fd5dfb currentBlockHeight 136372018/05/23 22:00:39.435820 [INFO ] GID 1, 3. Start the transaction pool server2018/05/23 22:00:39.437324 [INFO ] GID 67, txpool-verify actor: started and be ready to receive validator's msg2018/05/23 22:00:39.437460 [INFO ] GID 68, txpool actor started and be ready to receive txPool msg2018/05/23 22:00:39.437526 [INFO ] GID 69, txpool-tx actor started and be ready to receive tx msg2018/05/23 22:00:39.437691 [INFO ] GID 70, stateless-validator: started and be ready to receive txn2018/05/23 22:00:39.438545 [INFO ] GID 1, 4. Start the P2P networks2018/05/23 22:00:39.438643 [INFO ] GID 72, statefull-validator: started and be ready to receive txn2018/05/23 22:00:39.438740 [INFO ] GID 1, Init node ID to 0xab5b89d2770202122018/05/23 22:00:39.439018 [WARN ] GID 77, p2p actor started2018/05/23 22:00:39.440084 [INFO ] GID 1, WaitForSyncBlkFinish... current block height is  13637  ,current header height is  136372018/05/23 22:00:39.440124 [INFO ] GID 1, 5. Start Consensus Services2018/05/23 22:00:39.440176 [INFO ] GID 1, ConsensusType:solo2018/05/23 22:00:39.440248 [WARN ] GID 82, solo actor started2018/05/23 22:00:44.441845 [INFO ] GID 1, --Start the RPC interface2018/05/23 22:00:45.440794 [INFO ] GID 88, incr validator block height 4294967295 != ledger block height 136372018/05/23 22:00:45.440971 [INFO ] GID 88, current block Height 13637, incrValidateHeight 136372018/05/23 22:00:45.486135 [INFO ] GID 88, solo actor receives block complete event. block height= 136382018/05/23 22:00:50.443933 [INFO ] GID 59, BlockHeight = 13638
  • 启动后端进程

blockchain@ThinkPad-T460:~/GitClone/ontology-explorer/back-end$ java -jar target/explorer-1.0.0-SNAPSHOT.jar  .   ____          _            __ _ _ /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/  ___)| |_)| | | | | || (_| |  ) ) ) )  '  |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot ::        (v1.5.9.RELEASE)[ INFO ] [2018-05-23 22:05:58] com.github.ontio.ExplorerApplication [48] - Starting ExplorerApplication v1.0.0-SNAPSHOT on ThinkPad-T460 with PID 4982 (/home/blockchain/GitClone/ontology-explorer/back-end/target/explorer-1.0.0-SNAPSHOT.jar started by blockchain in /home/blockchain/GitClone/ontology-explorer/back-end)[ INFO ] [2018-05-23 22:05:58] com.github.ontio.ExplorerApplication [597] - The following profiles are active: uat[ INFO ] [2018-05-23 22:05:59] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext [583] - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3d71d552: startup date [Wed May 23 22:05:59 CST 2018]; root of context hierarchy[ INFO ] [2018-05-23 22:06:01] org.hibernate.validator.internal.util.Version [30] - HV000001: Hibernate Validator 5.3.6.Final

打开 http://localhost/ ,

和 https://explorer.ont.io/ 界面类似。

感谢你能够认真阅读完这篇文章,希望小编分享的"Ubuntu 14.04 下如何安装Ontology区块链浏览器开发"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!

0