Google 云平台上的 FusionPBX 安装

FusionPBX installation on Google Cloud Platform

有什么方法可以分解这行代码吗?它总是 return 权限错误。我正在 Google 云上部署 fusionPBX。

sudo wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/ubuntu/pre-install.sh | sh;
sudo cd /usr/src/fusionpbx-install.sh/ubuntu && ./install.sh

我遇到了这个错误

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
fatal: could not create work tree dir 'fusionpbx-install.sh': Permission denied
sh: 13: cd: can't cd to /usr/src/fusionpbx-install.sh/ubuntu

看看你的命令:

$ sudo cd /usr/src/fusionpbx-install.sh/ubuntu && ./install.sh

只有左侧(第一个)命令 运行 具有 root 权限:

sudo cd /usr/src/fusionpbx-install.sh/ubuntu

但是 && 之后的右侧(第二个)命令将 运行 具有用户权限(&& 意味着右侧(第二个)命令只会 运行仅当左侧(第一个)命令成功时:

./install.sh

您可以在错误消息中看到它:

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

或者更清楚:

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

为了让这个问题更明显,你可以运行这个命令:

$ sudo whoami && whoami
root
username

要解决这个问题你应该改变你的命令:

$ sudo whoami && sudo whoami     
root
root

如果你有一些命令需要执行,你可以这样做:

$ sudo -s
# whoami && whoami 
root
root
# whoami && whoami 
root
root
exit
$

此外,我检查了 FusionPBX documentation 并在我的测试 VM 上尝试了 Debian 的步骤:

Debian

Debian 9 is the preferred operating system by the FreeSWITCH developers. It supports the latest video dependencies and should be used if you want to do video mixing. Download Debian 9 Stretch at https://cdimage.debian.org/cdimage/release/current/

wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/debian/pre-install.sh | sh;
cd /usr/src/fusionpbx-install.sh/debian && ./install.sh

但与你的相比,我改变了它们:

wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/ubuntu/pre-install.sh | sudo sh;
cd /usr/src/fusionpbx-install.sh/debian && sudo ./install.sh

没有发现任何问题。