我需要在AWS中的新Ubuntu机器上运行shell脚本,该脚本包含以下命令:
sudo apt-get install postgresql postgresql-contrib但是,由于一些限制,我不想去互联网上这样做。因此,我下载了以下两个.debs并将它们打包到包装盒中。
postgresql_12+213.pgdg18.04+1_all.deb
postgresql-contrib_12+213.pgdg18.04+1_all.deb并且,在shell脚本中,我将上面的命令替换为以下命令:
sudo dpkg -i postgresql_12+213.pgdg18.04+1_all.deb
sudo dpkg -i postgresql-contrib_12+213.pgdg18.04+1_all.deb现在,在执行脚本时,我得到了以下错误:
(Reading database ... 56588 files and directories currently installed.)
Preparing to unpack postgresql_12+213.pgdg18.04+1_all.deb ...
Unpacking postgresql (12+213.pgdg18.04+1) ...
dpkg: dependency problems prevent configuration of postgresql:
postgresql depends on postgresql-12; however:
Package postgresql-12 is not installed.
dpkg: error processing package postgresql (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
postgresql
Selecting previously unselected package postgresql-contrib.
(Reading database ... 56591 files and directories currently installed.)
Preparing to unpack postgresql-contrib_12+213.pgdg18.04+1_all.deb ...
Unpacking postgresql-contrib (12+213.pgdg18.04+1) ...
dpkg: dependency problems prevent configuration of postgresql-contrib:
postgresql-contrib depends on postgresql-contrib-12; however:
Package postgresql-contrib-12 is not installed.
dpkg: error processing package postgresql-contrib (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
postgresql-contrib所以,我试着单独运行下面的命令(只是为了检查一下,因为它们在我本地的ubuntu机器上运行得很好),我相信它会连接到互联网上:
sudo apt-get install postgresql postgresql-contrib我得到以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-contrib is already the newest version (12+213.pgdg18.04+1).
postgresql is already the newest version (12+213.pgdg18.04+1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
postgresql : Depends: postgresql-12 but it is not installable
postgresql-contrib : Depends: postgresql-contrib-12 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).我不太擅长linux,但在上面的错误中,我看到postgresql已经是最新版本了。但当我尝试运行以下命令时,它们不起作用:
postgres --version
postgres -V
locate /bin/postgres
psql --version似乎postgres没有预装在机器上。所以,我这里的问题是,我需要在没有互联网连接的情况下运行下面的命令(为此,我下载了deb,并尝试了,但没有工作)
sudo apt-get install postgresql postgresql-contrib发布于 2020-05-11 03:54:23
尝试更新您的ubuntu,然后再次安装软件包-
sudo apt-get update -y && sudo apt-get upgrade -y然后安装postgresql -
sudo apt-get install postgresql postgresql-contrib -y希望能有所帮助。
https://stackoverflow.com/questions/61715477
复制相似问题