当前位置: 首页 > wzjs >正文

网站开发体会网站代理 登陆

网站开发体会,网站代理 登陆,门店销售管理系统,麻涌网站仿做PostgreSQL 是一种非常流行的开源对象关系数据库管理系统 (DBMS),旨在保证可靠性、效率和数据完整性。开发工作现已超过 30 年,该项目在可靠性、功能稳健性和性能方面赢得了良好的声誉。在本教程中,我们将解释如何在 Ubuntu 22.04|20.04|18.0…

        PostgreSQL 是一种非常流行的开源对象关系数据库管理系统 (DBMS),旨在保证可靠性、效率和数据完整性。开发工作现已超过 30 年,该项目在可靠性、功能稳健性和性能方面赢得了良好的声誉。在本教程中,我们将解释如何在 Ubuntu 22.04|20.04|18.04 Linux 服务器上安装和配置 PostgreSQL 13 数据库服务器。

        数千家公司使用 PostgreSQL 来支持支付交易、大量网站流量、电子商务平台等。它还允许您添加使用 Java、Python、C/C++ 等编程语言开发的自定义函数。

        截至本文发布时,PostgreSQL 的最新版本为 17,旨在用于在生产环境中运行工作负载。您可以在 发行说明中找到有关 PostgreSQL 13 中的所有功能和更改的信息。

步骤 1:更新 Ubuntu 系统

        我们始终致力于最新版本的操作系统,以确保不存在旧的依赖性问题。登录到您的 Ubuntu 服务器并运行以下命令来更新所有已安装的软件包。

sudo apt update && sudo apt -y full-upgrade
[ -f /var/run/reboot-required ] && sudo reboot -f
系统更新后,我建议您重新启动以运行新的内核(如果已更新)。

sudo reboot

步骤 2:添加 PostgreSQL 13 存储库

安装所需的依赖包

sudo apt update
sudo apt install curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates
现在我们已经更新并重新启动了系统,让我们添加从 PostgreSQL 存储库中提取包所需的 APT 存储库。

curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
导入 GPG 密钥后,将存储库内容添加到您的 Ubuntu 22.04|20.04|18.04 系统:

echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
添加的存储库包含许多不同的软件包,包括第三方插件。它们包括:

postgresql-client
postgresql
libpq-dev
postgresql-server-dev
pgadmin packages

步骤3:安装PostgreSQL 13

        添加存储库后,我们可以在 Ubuntu 22.04|20.04|18.04 Linux 服务器上安装 PostgreSQL 13 软件包。但首先要更新软件包索引,以便在操作系统级别可以使用该版本。

sudo apt update

运行以下命令在 Ubuntu 22.04|20.04|18.04 Linux 系统上安装 PostgreSQL 13。


sudo apt install postgresql-13 postgresql-client-13

PostgreSQL 服务已启动并设置为每次系统重启后运行。

$ systemctl status postgresql@13-main.service
● postgresql@13-main.service - PostgreSQL Cluster 13-main
     Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)
     Active: active (running) since Wed 2023-05-18 15:50:22 EAT; 1min 55s ago
    Process: 4294 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 13-main start (code=exited, status=0/SUCCESS)
   Main PID: 4299 (postgres)
      Tasks: 7 (limit: 9460)
     Memory: 18.2M
        CPU: 150ms
     CGroup: /system.slice/system-postgresql.slice/postgresql@13-main.service
             ├─4299 /usr/lib/postgresql/13/bin/postgres -D /var/lib/postgresql/13/main -c config_file=/etc/postgresql/13/main/postgresql.conf
             ├─4301 "postgres: 13/main: checkpointer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
             ├─4302 "postgres: 13/main: background writer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
             ├─4303 "postgres: 13/main: walwriter " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
             ├─4304 "postgres: 13/main: autovacuum launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
             ├─4305 "postgres: 13/main: stats collector " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
             └─4306 "postgres: 13/main: logical replication launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >

Mei 18 15:50:19 ubuntu22 systemd[1]: Starting PostgreSQL Cluster 13-main...
Mei 18 15:50:22 ubuntu22 systemd[1]: Started PostgreSQL Cluster 13-main.

步骤 4:测试 PostgreSQL 连接

        安装过程中会自动创建一个 postgres 用户。此用户对整个 PostgreSQL 实例具有完全 超级管理员 访问权限。在切换到此帐户之前,您登录的系统用户应该具有 sudo 权限。

sudo su - postgres
让我们将此用户密码重置为我们可以记住的强密码。

psql -c "alter user postgres with password 'StrongAdminP@ssw0rd'"

使用以下命令启动 PostgreSQL 提示符:

$ psql
获取如下所示的连接详细信息。

$ psql
psql (13.7 (Ubuntu 13.7-1.pgdg22.04+1))
Type "help" for help.

postgres=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".

让我们创建一个测试数据库和用户来看看它是否正常工作。

postgres=# CREATE DATABASE mytestdb;
CREATE DATABASE
postgres=# CREATE USER mytestuser WITH ENCRYPTED PASSWORD 'MyStr0ngP@SS';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE mytestdb to mytestuser;
GRANT
列出创建的数据库:

postgres=# \l
                               List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |    Access privileges    
-----------+----------+----------+---------+---------+-------------------------
 mytestdb  | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =Tc/postgres           +
           |          |          |         |         | postgres=CTc/postgres  +
           |          |          |         |         | mytestuser=CTc/postgres
 postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres            +
           |          |          |         |         | postgres=CTc/postgres
 template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres            +
           |          |          |         |         | postgres=CTc/postgres
(4 rows)

连接到数据库:

postgres-# \c mytestdb
You are now connected to database "mytestdb" as user "postgres".
安装的其他 PostgreSQL 实用程序(如 createuser 和 createdb) 可用于创建数据库和用户。

postgres@ubuntu:~$ createuser myuser --password
Password:
postgres@ubuntu:~$ createdb mydb -O myuser
postgres@ubuntu:~$ psql -l 

我们可以在 PostgreSQL 服务器上创建并连接到数据库。

步骤 5:配置远程连接(可选)

        在 Ubuntu 上安装 PostgreSQL 13 仅接受来自本地主机的连接。在理想的生产环境中,您将拥有一个中央数据库服务器和与其连接的远程客户端 - 但当然是在 专用网络 (LAN) 内。

要启用远程连接,请编辑 PostgreSQL 配置文件:

sudo nano /etc/postgresql/13/main/postgresql.conf 

取消注释第 59行  并更改监听地址以接受网络内的连接。

# Listen on all interfaces
listen_addresses = '*'

# Listen on specified private IP address
listen_addresses = '192.168.10.11'
还设置 PostgreSQL 以接受来自允许主机的远程连接。

$ sudo nano /etc/postgresql/13/main/pg_hba.conf

# Accept from anywhere
host all all 0.0.0.0/0 md5

# Accept from trusted subnet
host all all 10.10.10.0/24 md5
更改后,重新启动postgresql服务。

sudo systemctl restart postgresql
确认监听地址。

# netstat  -tunelp | grep 5432
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      111        112837     11143/postgres      
tcp6       0      0 :::5432                 :::*                    LISTEN      111        112838     11143/postgres   

步骤6:安装pgAdmin4管理工具

如果您想从 Web 界面管理 PostgreSQL 数据库服务器,请安装 pgAdmin4。

在 Ubuntu 上安装 pgAdmin4

如果您喜欢此文章,请收藏、点赞、评论,谢谢,祝您快乐每一天。 


文章转载自:

http://xtrMbl6Z.htqrh.cn
http://c3jal4Cx.htqrh.cn
http://N2V7gTqK.htqrh.cn
http://X7xZg9z3.htqrh.cn
http://4MfWtAfI.htqrh.cn
http://1OVzYcWO.htqrh.cn
http://qWWrb0MW.htqrh.cn
http://ACfM2w1c.htqrh.cn
http://oMn4ZMKA.htqrh.cn
http://0Vmmzgm3.htqrh.cn
http://LTdF2qfy.htqrh.cn
http://UwZYP0DI.htqrh.cn
http://Xxi5u0oK.htqrh.cn
http://qOzvfNUU.htqrh.cn
http://BEfljS1e.htqrh.cn
http://OBzHLrlJ.htqrh.cn
http://V2TRN3yY.htqrh.cn
http://ip5PKUqT.htqrh.cn
http://XrFNaemU.htqrh.cn
http://9I0ojnqB.htqrh.cn
http://KB27xAGE.htqrh.cn
http://1iWelfDt.htqrh.cn
http://q1qCdgv8.htqrh.cn
http://tsAMGQTp.htqrh.cn
http://BQCrJNnU.htqrh.cn
http://lnr6uWoZ.htqrh.cn
http://WS6U4uNf.htqrh.cn
http://A1IW8cip.htqrh.cn
http://ZHclIxJ0.htqrh.cn
http://PKTt3lX3.htqrh.cn
http://www.dtcms.com/wzjs/635584.html

相关文章:

  • 网站开发数据库技术中山家居企业网站建设
  • 做特卖网站有什么网站免费seo快速排名系统
  • 高端的网站建设公司哪家好温州网站建设设计公司
  • wordpress网站网页加密南京蓝牙app开发公司
  • 珠海网站制作报价课程网站建设的财务分析
  • vps网站目录权限设置网站建设制作设计营销 上海
  • 怎么做网站记者海外推广都有哪些渠道
  • 深圳做网站公司有哪些地方详细的营销推广方案
  • 网站建设找哪家好免费做网站刮刮卡
  • 网站建设 推广网络规划设计师 招聘
  • 吴江区城乡建设管理局网站网络策划案
  • 深圳网站公司哪家好sem推广竞价托管
  • 做网站动态背景的图片mvc5网站开发之六
  • php做网站答辩问题代理加盟项目
  • 重庆合川企业网站建设为什么浏览器打开是2345网址导航
  • 织梦网站查看原有文章linux wordpress安装
  • 京东商城网站建设目的校园网站建设 方案论证
  • 婚介网站建设的策划松江新城建设有限公司网站
  • 手机网站跳转网站进入百度沙盒
  • 四大免费网站引流推广平台
  • 我的网站打不开了个人简历封面模板免费
  • 营销网站的优势有哪些个人 建设图片分享网站
  • 购买保险的网站wordpress适合百度吗
  • 做短租哪个网站好把手机网站做成app
  • 网站自动推广软件免费广告电商
  • 兰州兼职做网站seo承诺排名的公司
  • 外贸网站制作方案东莞路桥投资建设公司招聘
  • 深圳网站优化包年网站建设流程分为哪几个阶段
  • 怎么让别人在百度搜到自己的网站超可爱做头像的网站
  • 学做网站需要懂什么31省份新增40例本土确诊