Files
weiyu/docs/assets/js/5721fd23.6318afa9.js
jack ning fffbecbf17 update
2025-01-03 07:52:00 +08:00

1 line
4.3 KiB
JavaScript

"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1759],{7690:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>a,contentTitle:()=>l,default:()=>c,frontMatter:()=>i,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"deploy/depend/postgresql","title":"PostgreSQL 16","description":"- Operating System: Ubuntu 20.04 LTS","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/deploy/depend/postgresql.md","sourceDirName":"deploy/depend","slug":"/deploy/depend/postgresql","permalink":"/bytedesk/docs/deploy/depend/postgresql","draft":false,"unlisted":false,"editUrl":"https://github.com/bytedesk/bytedesk/docs/deploy/depend/postgresql.md","tags":[],"version":"current","sidebarPosition":1,"frontMatter":{"sidebar_label":"PostgreSQL","sidebar_position":1},"sidebar":"tutorialSidebar","previous":{"title":"MySQL","permalink":"/bytedesk/docs/deploy/depend/mysql"},"next":{"title":"Redis","permalink":"/bytedesk/docs/deploy/depend/redis"}}');var o=t(5723),r=t(6246);const i={sidebar_label:"PostgreSQL",sidebar_position:1},l="PostgreSQL 16",a={},d=[{value:"Installation",id:"installation",level:2}];function p(e){const s={admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.header,{children:(0,o.jsx)(s.h1,{id:"postgresql-16",children:"PostgreSQL 16"})}),"\n",(0,o.jsx)(s.admonition,{type:"tip",children:(0,o.jsxs)(s.ul,{children:["\n",(0,o.jsx)(s.li,{children:"Operating System: Ubuntu 20.04 LTS"}),"\n",(0,o.jsx)(s.li,{children:"Server Requirements: Minimum 2 cores 4GB RAM, Recommended 4 cores 8GB RAM"}),"\n"]})}),"\n",(0,o.jsx)(s.h2,{id:"installation",children:"Installation"}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-bash",children:"# ubuntu\n# https://www.postgresql.org/download/linux/ubuntu/\nsudo apt install -y postgresql-common\nsudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh\n# Import the repository signing key:\nsudo apt install curl ca-certificates\nsudo install -d /usr/share/postgresql-common/pgdg\nsudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc\n# Create the repository configuration file:\nsudo sh -c 'echo \"deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main\" > /etc/apt/sources.list.d/pgdg.list'\n# Update the package lists:\nsudo apt update\n# Install the latest version of PostgreSQL:\n# If you want a specific version, use 'postgresql-16' or similar instead of 'postgresql'\nsudo apt -y install postgresql\n# Check version\npsql --version\n# Check if running\nlsof -i:5432\n# If you need local client to connect to cloud service, open port 5432 in Tencent Cloud or Alibaba Cloud firewall\n# Find configuration file path\nlocate postgresql.conf\n# /etc/postgresql/16/main/postgresql.conf\n# Download all configuration files from /etc/postgresql/16/main/ for easier modification\n# Enable external access, modify postgresql.conf file\nlisten_addresses = '*'\n# Modify pg_hba.conf file, add the following at the end:\nhost all all 0.0.0.0/0 scram-sha-256\n# Change password\nsudo -u postgres psql\nALTER USER postgres WITH PASSWORD 'password'; # Change password https://suijimimashengcheng.bmcx.com/\n# Press \\q to exit\n# Install pgvector\napt install postgresql-16-pgvector\n# Upload modified configuration files to server, then restart\nservice postgresql restart\n# service postgresql stop\n# Check port 5432\nlsof -i:5432\n# Or\nnetstat -tunlp | grep 5432\n# Use pgadmin client, desktop client remote connection\n# Create database bytedesk_im\n# Add vector extension to the newly created database bytedesk_im (right click extensions, create->General->name: vector)\n"})})]})}function c(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(p,{...e})}):p(e)}},6246:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>l});var n=t(2155);const o={},r=n.createContext(o);function i(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]);