在Ubuntu安装PostgreSQL时出现错误。

huangapple go评论71阅读模式
英文:

Error while installing PostgreSQL in Ubuntu

问题

我正在下载PostgreSQL在我的Ubuntu版本18.04上,安装PostgreSQL版本12时出现了以下错误。

我已经运行了以下命令

sudo apt-get install postgresql postgresql-client

错误

如何解决这些错误。

英文:

I am downloading PostgreSQL on my Ubuntu version 18.04 and getting these errors while installing Postgresql version 12.

I have ran following command

sudo apt-get install postgresql postgresql-client

Error

How to resolve these errors.

答案1

得分: 1

尝试在安装之前运行sudo apt-get update,如果它不起作用

我建议您按照以下说明从源代码下载PostgreSQL:

从源代码安装PostgreSQL:

首先,我们将从源代码安装PostgreSQL。以下说明适用于PostgreSQL版本11和12。

您还可以参考以下链接PostgreSQL文档以获得帮助:

在指定的文件夹中下载文件

wget https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f postgresql-11.18.tar.gz

该命令将在工作目录中为Linux用户下载并提取源代码的tar文件。
安装PG:
现在我们将开始安装PG

cd postgresql-11.18

# 通过设置标志进行配置
./configure --enable-debug --enable-cassert --prefix=$(path) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"

# 现在安装
make install

在上述命令中,prefix标志将包含您想要安装PSQL的路径。请用括号中的路径替换您的路径。

英文:

Try to run sudo apt-get update before the installation, and if it didn't work

I would recommend you download the PostgreSQL from the source by following below instructions:

Installation of PostgreSQL from Source:

First, we will install PostgreSQL from the source. The following instructions are valid for PostgreSQL versions 11 and 12.

You can also take help from the following link PostgreSQL Documentation:

Download the files in your specified folder

wget https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f postgresql-11.18.tar.gz

The command will download and extract the tar files for Linux users from Source in the working directory.
Installing PG:
Now we will move toward installing PG

cd postgresql-11.18

# configure by setting flags
./configure --enable-debug --enable-cassert --prefix=$(path) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"

# now install
make install

In the above command, the prefix flag will contain the path where you would like to install the PSQL. Replace your path with the path in the parenthesis.

答案2

得分: 0

请尝试以下命令:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-12

或者简单地将其粘贴到一个.sh文件中,然后使用sudo运行该sh文件,即可成功安装PostgreSQL 12。

英文:

Try the following command

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-12

or simply paste this in a .sh file and run that sh file with sudo, postgresql 12 would be installed successfully.

答案3

得分: 0

如果您想使用包管理工具安装PostgreSQL,请运行 sudo apt install postgresql-12 postgresql-server-dev-12

英文:

If you want to install PostgreSQL using package management, run sudo apt install postgresql-12 postgresql-server-dev-12.

答案4

得分: 0

尝试运行以下命令:

sudo apt install postgresql-12 postgresql-server-dev-12

或者

这里下载所需版本,然后使用 tar 关键词解压到您希望的目录中。

然后,在解压后的文件夹中,您将看到 Makefile,现在运行 make install 来在系统上安装它。

安装成功后,使用 psql --version 来验证版本。

希望这回答了您的问题。

英文:

Try to run this:

sudo apt install postgresql-12 postgresql-server-dev-12

OR

Download the desired version from here and unzip it using tar keyword in your desired directory.

After that, you will see Makefile in that unzipped folder, now run make install to install it on your system.

After successful installation, verify it using psql --version.

I hope this answers your question.

huangapple
  • 本文由 发表于 2023年7月17日 19:56:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76704215.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定