postgresql 安装

这篇博客详细介绍了在Ubuntu系统中安装PostgreSQL数据库的步骤,包括创建仓库配置、导入签名密钥、更新包列表以及安装指定版本的PostgreSQL。此外,还提到了如果安装速度慢可以使用国内源,并提供了配置Docker安装PostgreSQL 9.5的教程。同时,内容还涉及了nodejs 8.11.4的安装以及区块链浏览器的配置和启动,包括数据库初始化和端口开放。
摘要由CSDN通过智能技术生成

ubuntu

1. Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
2. Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3. Update the package lists:
sudo apt-get update
4. Install the latest version of PostgreSQL. If you want a specific version, use ‘postgresql-12’ or similar instead of ‘postgresql’:
sudo apt-get install postgresql

如果太慢,使用国内源

国内源安装

explorer

参考官方文档:https://github.com/hyperledger/blockchain-explorer

1、nodejs安装(nodejs 8.11.x (Note that v9.x is not yet supported)),由于上一篇博客已经安装了nvm,所以只需用nvm安装指定版本即可(此处安装8.11.4版本)

root@ubuntu:~# nvm install 8.11.4
Downloading and installing node v8.11.4…
Downloading https://nodejs.org/dist/v8.11.4/node-v8.11.4-linux-x64.tar.xz…
################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v8.11.4 (npm v5.6.0)
root@ubuntu:~# node -v
v8.11.4
root@ubuntu:~#
2、postgresql安装(PostgreSQL 9.5 or greater),这里以docker的形式进行安装

docker pull postgres:9.5
docker run --name postgres1 -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres:9.5 #postgres镜像默认的用户名为postgres,设置一个密码postgres
3、安装jq

sudo apt-get install jq
二、具体步骤

1、下载blockchain-explorer源码

cd /root/demo
git clone https://github.com/hyperledger/blockchain-explorer.git
cd blockchain-explorer
2、数据库初始化

root@iZq0c7mivu8vrvZ:~# docker exec -it b88997d1aad3 /bin/bash #进入postgresql容器:b88997d1aad3
root@b88997d1aad3:/# su postgres #切换用户
postgres@b88997d1aad3:/$ psql #进入命令行客户端
psql (9.5.15)
Type “help” for help.

postgres=# CREATE DATABASE fabricexplorer owner postgres; #创建fabricexplorer数据库并指定用户fabricexplorer

数据库创建好后执行初始化sql语句(也可以用postgresql相关桌面客户端连接数据库),以下数据库脚本参考官方https://github.com/hyperledger/blockchain-explorer/blob/master/app/persistence/fabric/postgreSQL/db/explorerpg.sql&#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值