在 Linux 上安装 PostgreSQL

Linux安装部署PostgreSQL详细步骤 阅读详情
 在 Linux 上安装 PostgreSQL
作者:star33375249   2005-09-07 14:45:33) 
 
MySQL 是一条轻快的小海豚,但是缺少很多现代关系数据库应有的特色,例如:引用完整性,视图,触发器等。因此,如果你需要开发一个电子商务的网站,需要这些功能的话,你或许应该考虑 PostgreSQL 了。本文将通过其在 Red Hat 7.1 上安装过程,简要介绍其用法。

PostgreSQL 的官方下载地址为:

ftp://ftp.postgresql.org/pub/v7.1.3/postgresql-7.1.3.tar.gz
http://www.postgresql.org/

如果下载最新的开发版本,你需要下载并安装 flex(版本号大于 2.5.4) 以及 bison (版本号大于 1.28)

设计人员为了安全考虑,PostgreSQL 不能以 root 用户运行,所以必须建立对应的用户和组。

# useradd postgre (自动建立 postgre 组)

安装的过程并不复杂和其他源码版本的安装方法类似:
解压到 /usr/local/src:
# tar xvfz postgresql-7.1.3.tar.gz
# cd postgresql-7.1.3
# ./configure --prefix=/usr/local/pgsql
# make
# make install
# chown -R postgre.postgre /usr/local/pgsql

这样安装完毕后,并不是万事大吉了,还有一些收尾工作要做:
# vi ~postgre/.bash_profile
添加:

PGLIB=/usr/local/pgsql/lib
PGDATA=$HOME/data
PATH=$PATH:/usr/local/pgsql/bin
MANPATH=$MANPATH:/usr/local/pgsql/man
export PGLIB PGDATA PATH MANPATH

以 postgres 用户登录,
# su - postgre
建立数据库目录:
$ mkdir data

启动数据库引擎:

$ initdb
[postgre@www postgre]$ initdb
This database system will be initialized with username "postgre".
This user will own all the data files and must also own the server process.

Fixing permissions on pre-existing data directory /home/postgre/data
Creating database system directory /home/postgre/data/base
Creating database XLOG directory /home/postgre/data/pg_xlog
Creating template database in /home/postgre/data/base/template1
Creating global relations in /home/postgre/data/base
Adding template1 database to pg_database

Creating view pg_user.
Creating view pg_rules.
Creating view pg_views.
Creating view pg_tables.
Creating view pg_indexes.
Loading pg_description.
Vacuuming database.

Success. You can now start the database server using:

/usr/local/pgsql/bin/postmaster -D /home/postgre/data
or
/usr/local/pgsql/bin/pg_ctl -D /home/postgre/data start
$ postmaster -i -D ~/data &
[1] 22603
[postgre@www postgre]$ DEBUG: Data Base System is starting up at Thu Jan 31 02:00:44 2002
DEBUG: Data Base System was shut down at Thu Jan 31 01:57:58 2002
DEBUG: Data Base System is in production state at Thu Jan 31 02:00:44 2002

这样 PostgreSQL 使用位于 /usr/local/pgsql/data 的数据库,允许 Internet 用户的连接( -i ) ,并在后台运行。

建立数据库

$createdb mydb
PostgreSQL 会返回 “ CREATED DATABASE”的信息,表明数据库建立完成。
$psql mydb
进入交互 psql 工具,建立表:

CREATE TABLE mytable (
id varchar(20),
name varchar(30));

建立完成后,会得到一条 “CREATED” 的信息,表示建立成功。现在插入一条数据:

INSERT INTO mytable values('Author', 'Xu Yongjiu');

psql 返回 INSERT 18732 1,查询插入是否成功:

SELECT * FROM MYTABLE;

退出 psql ,用 /q 命令

Linux 上安装 PostgreSQL 在 Linux 上安装 PostgreSQL 是一个相对简单的任务,特别是如果您熟悉您的 Linux 发行版的包管理器。一旦安装完成,您就可以开始使用这个强大的数据库管理系统来满足您的数据存储和管理需求。记得始终保持您的 PostgreSQL 服务器更新,以确保安全和性能。 阅读详情

相关推荐

[DA45] 使用PageRank算法分析希拉里邮件中的人物关系

一. 相关知识 (一) PageRank算法 PageRank 算法是 google 公司的创始人拉里·佩奇和谢尔·盖布林于1998年提出的网页搜索优化算法. 详细内容请见百度百科:google pagerank. 如果你了解了该算法, 就能明白上一段的超链接从本页面链出, 链入百度百科的 PageRank 算法页面增加了该页面...

Vincent_Chu的博客 2381

Linux系统之安装PostgreSQL数据库

Linux系统之安装PostgreSQL数据库

jks212454的博客 1万+

APK静态分析(取证角度)——理论部分

APP是指应用程序(Application),是指能够在手机、平板电脑、电脑等移动设备上运行的软件。APP可以帮助用户进行各种功能操作,如社交媒体、游戏、购物、学习、工作等。用户可以通过应用商店或者在线下载安装APP,然后在设备上使用它们。APP的种类非常丰富,能够满足用户不同的需求和兴趣。

currify的博客 3220

Linux安装PostGresql

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档。

qq_42923937的博客 7639

TCMSP数据库+R语言实战:从网页爬虫到中药-靶点网络图的全流程解析

本文详细解析了如何使用R语言从TCMSP数据库抓取中药-靶点数据,并通过数据清洗、网络分析和可视化构建完整的中药作用机制研究流程。涵盖动态网页爬虫、ADME参数筛选、网络图构建及高级可视化技巧,为中医药现代化研究提供实用的生物信息学方法。

weixin_31304817的博客 349

DIY电磁炉核心驱动方案:IR2153PBF自振荡半桥芯片实战指南(附电路图)

本文详细介绍了IR2153PBF自振荡半桥驱动芯片在DIY电磁炉核心驱动方案中的实战应用。该芯片集成了振荡器与600V高压驱动能力,仅需少量外围元件即可生成互补带死区的PWM信号,极大简化了半桥逆变电路设计。文章深入解析了其工作原理、关键参数,并提供了完整的电路设计、PCB布局指南及调试步骤,帮助电子爱好者构建稳定高效的感应加热驱动核心。

beer8的博客 629

PostgreSQL(二)基于linux环境的安装

本文以版本14为例。

shmily_coco的博客 4394

ABAP Bits and Bytes 完全参考,理解内存、字节、位运算与类型解释

ABAP开发中业务代码与底层字节处理的差异:业务层关注采购订单、会计凭证等语义信息,而接口开发需处理十六进制、位运算等底层操作。文章通过整数变量示例说明同一段字节在不同类型解释下会呈现不同值,并介绍x类型、位运算及类型转换的实际应用。这些知识在文件接口、加密传输等场景中尤为重要,开发者需注意字节序、编码等问题。建议将底层协议处理与业务逻辑分离,以保持代码清晰和可维护性。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 150

Linux下安装PostgreSQL

Linux下安装PostgreSQL,二制式、源码、yum等安装方式,以及基本的数据库操作

冰之杍的博客 2万+

YOLOv8改进 | 注意力机制 | 添加HAttention(HAT)超分辨率重建助力小目标检测 (全网首发,超分辨率检测)

本文给大家带来的改进机制是HAttention注意力机制,混合注意力变换器(HAT)的设计理念是通过融合通道注意力和自注意力机制来提升单图像超分辨率重建的性能。通道注意力关注于识别哪些通道更重要,而自注意力则关注于图像内部各个位置之间的关系。HAT利用这两种注意力机制,有效地整合了全局的像素信息,从而提供更为精确的结果(这个注意力机制挺复杂的光代码就700+行),但是效果挺好的也是10月份最新的成果非常适合添加到大家自己的论文中。⭐⭐⭐⭐⭐(最新的改进机制)

Snu77的博客 1万+

【数据分析】R语言分段结构方程模型手把手教程(Piecewise Structural Equation Model)

分段结构方程模型(Piecewise Structural Equation Model, SEM)是一种用于分析变量之间因果关系的统计方法。它通过将复杂的因果关系分解为多个简单的线性模型来评估变量之间的直接和间接效应。与传统的结构方程模型(SEM)不同,分段结构方程模型不需要假设数据的多变量正态分布,因此在处理非正态数据时更为灵活。

专注生信领域 2670

Postgresql编译安装linux、postgresql参数笔记

摘要:本文详细介绍了在CentOS7系统上安装配置PostgreSQL15数据库的完整流程并提供了详细的命令行操作步骤,适合DBA参考

qq_42299196的博客 1035

飞行机械臂设计

其后对飞行机械臂系统的机 理模型和基于 ADAMS 的物理模型进行了控制系统的搭建,对于机理模 型,设计了三个输入通道,分别是俯仰力矩,翻滚力矩与偏航力矩,控 制量为翻滚角,俯仰角,偏航角。四旋翼无人机自身具有独特的优势,在无人机上增加机械臂,整个 机体系统相当于一架空中行动自如的空中机器人,可以适应更多的应用场合,能够实现空中抓取,运输载荷,巡航监视等任务。的函数模块如图 4-8 所示,可见输入为 U1,U2,U3,U4,分别对应总力矩,俯仰力矩,翻滚力矩,偏航力矩,控制 量为俯仰角,翻滚角,偏航角。

coldmood77的博客 2942

LINUX安装PostgreSQL

本文详细介绍了在CentOS 7.x系统上安装和配置PostgreSQL 15的步骤。首先,确保系统具备必要的网络和权限条件,然后通过添加官方或阿里云的YUM仓库来安装PostgreSQL 15

weixin_53876268的博客 2247

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

rocky linux9.4 源码安装postgresql

例如,将 PostgreSQL 安装到/usr/local/pgsql,数据目录设置为/data/postgresql,可以这样配置。这些包包括gcc(编译器)、make(构建工具)、readline - devel(用于命令行编辑支持)、zlib - devel(用于数据压缩支持)和openssl - devel(用于加密支持)命令初始化数据库集群,例如:./initdb - D /usr/local/pgsql/data/postgresql (这里。-E 指定数据库编码,一般为UTF8。

qq_25440687的博客 1972

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Linux 下 PostgreSQL 安装与常用操作指南

PostgreSQL 是一款功能强大、开源免费的关系型数据库管理系统,常用于网站、企业应用以及数据分析场景。本文将从 Linux 系统出发,介绍 PostgreSQL 的安装、基本使用以及常用操作,帮助你快速上手。本文介绍了 PostgreSQL 在 Linux 系统下的安装方法以及最常用的操作,包括:数据库和用户管理表和数据操作数据导入导出远程访问配置掌握这些基础操作后,你就可以在 Linux 下快速部署和管理 PostgreSQL 数据库了。

kirito0000的博客 3076

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Linux下PostgreSQL的安装部署

其中,参数“listen_addresses”表示监听的IP地址,默认是在localhost处监听,也就是127.0.0.1的ip地址上监听,只接受来自本机localhost的连接请求,这会让远程的主机无法登陆这台数据库,如果想从其他的机器上登陆这台数据库,需要把监听地址改为实际网络的地址,一种简单的方法是,将行开头的#去掉,把这个地址改为*,表示在本地的所有地址上监听。修改/etc/init.d/postgresql文件,设置PostgreSQL数据库的安装目录和数据目录。安装相关依赖包后重新编译。

weixin_58170164的博客 1405

linux安装postgresql

1、修改/var/lib/pgsql/10/data/postgresql.conf文件,取消 listen_addresses 的注释,将参数值改为“*”grant all privileges on database testdb to root;1、使用postgres用户登录(PostgresSQL安装后会自动创建postgres用户,无密码)2、修改/var/lib/pgsql/10/data/pg_hba.conf文件,增加下图红框部分内容。3、创建用户和数据库并授权。第三部分:开启远程访问。

weixin_37568802的博客 257

postgresql linux安装教程,PostgreSQL安装教程 :linux系统环境下安装PostgreSQL

PostgreSQL安装教程 :linux系统环境下安装PostgreSQL时间:2020-03-25 来源:在Linux安装PostgreSQL主要有三种:1.二进制安装包安装2.通过yum源安装3.通过源码编译安装安装前系统依赖包,以RedHat/CentOS为例:最小依赖:gcc、gcc-c++、zlib-devel、readline-devel其他依赖:perl-ExtUtils-Embe...

weixin_32553639的博客 1011

Linux下的PostgreSQL安装

原博链接 pg数据库下载地址 http://www.postgresql.org/ftp/source/ 这里我们使用的是9.6.2版本 安装依赖包 yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-deve...

qq_24095055的博客 704

linux 安装Postgresql

======================================== PostgreSQL安装(Linux)一 执行 #cat /etc/redhat-release  #uname -m 查看linux系统版本,去网站http://yum.pgrpms.org/repopackages.php下载对应的linux版本的pg rpm包"pgdg-centos90-9.0...

yongyuan93139的专栏 791

linux中安装Postgresql

一、安装准备 1.查看linux系统 #> uname -a #> cat /etc/redhat-release 2.下载postgresql 在 postgresql官网 中下载对应的版本 下一步: 下一步: 下载linux对应版本的postgresql 二、...

chunegao9019的博客 169
上一篇: 日期时间1.0 总结
下一篇: 存取程序状态的几种方法--Java I/O应用杂谈
Three_H
博客等级 码龄22年 1粉丝 50原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址