安装 Hyperledger Explorer 时 运行 文件 createdb.sh 出错
Error when run file createdb.sh when install Hyperledger Explorer
当我运行 createdb.sh 文件时,出现错误:\
could not change directory to "/root/gopath/src/github.com/hyperledger/fabric/fabric-samples/blockchain-explorer/app/persistence/fabric/postgreSQL/db": Permission denied
psql: error: ./explorerpg.sql: No such file or directory
could not change directory to "/root/gopath/src/github.com/hyperledger/fabric/fabric-samples/blockchain-explorer/app/persistence/fabric/postgreSQL/db": Permission denied
psql: error: ./updatepg.sql: No such file or directory</code>
我按照 https://github.com/hyperledger/blockchain-explorer\ 中的说明进行操作
我已完成所有步骤并向 db/
申请权限
有文件create.sh
和文件夹数据库
# this is your command
sudo -u postgres ~~
使用 sudo -u 选项,您 运行 作为 postgres 用户执行命令。
https://helpmanual.io/help/sudo/
sudo
-u, --user=user run command (or edit file) as specified user name
or ID
预计 postgres 用户将没有访问 /root 目录的权限。
以下是三种解决方案。
1。更改文件模式位 /root dir
- 不推荐。
sudo chmod -R 775 /root
2。将 postgres 添加到超级用户组
# ubuntu 18.04
sudo usermod -aG sudo postgres
su - postgres
# centos7
sudo usermod -aG wheel postgres
su - postgres
3。独立划分工作空间
- 运行 根目录下的应用程序是危险的,并且与 Linux 用户理念相矛盾。
- 在/home目录下新建一个工作空间
- 为新工作区设置权限
- 移动您的应用程序和代码
- 授予 postgres 权限
当我运行 createdb.sh 文件时,出现错误:\
could not change directory to "/root/gopath/src/github.com/hyperledger/fabric/fabric-samples/blockchain-explorer/app/persistence/fabric/postgreSQL/db": Permission denied
psql: error: ./explorerpg.sql: No such file or directory
could not change directory to "/root/gopath/src/github.com/hyperledger/fabric/fabric-samples/blockchain-explorer/app/persistence/fabric/postgreSQL/db": Permission denied
psql: error: ./updatepg.sql: No such file or directory</code>
我按照 https://github.com/hyperledger/blockchain-explorer\ 中的说明进行操作 我已完成所有步骤并向 db/
申请权限有文件create.sh
和文件夹数据库
# this is your command
sudo -u postgres ~~
使用 sudo -u 选项,您 运行 作为 postgres 用户执行命令。
https://helpmanual.io/help/sudo/
sudo
-u, --user=user run command (or edit file) as specified user name
or ID
预计 postgres 用户将没有访问 /root 目录的权限。
以下是三种解决方案。
1。更改文件模式位 /root dir
- 不推荐。
sudo chmod -R 775 /root
2。将 postgres 添加到超级用户组
# ubuntu 18.04
sudo usermod -aG sudo postgres
su - postgres
# centos7
sudo usermod -aG wheel postgres
su - postgres
3。独立划分工作空间
- 运行 根目录下的应用程序是危险的,并且与 Linux 用户理念相矛盾。
- 在/home目录下新建一个工作空间
- 为新工作区设置权限
- 移动您的应用程序和代码
- 授予 postgres 权限