Files
weiyu/deploy/server/docs/zh-TW/assets/js/80d2fdbf.93845df3.js
2025-03-29 09:56:20 +08:00

1 line
4.9 KiB
JavaScript

"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3559],{9331:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>p,contentTitle:()=>d,default:()=>c,frontMatter:()=>l,metadata:()=>n,toc:()=>i});const n=JSON.parse('{"id":"deploy/depend/postgresql","title":"PostgreSQL 16","description":"- \u64cd\u4f5c\u7cfb\u7edf\uff1aUbuntu 24.04 LTS","source":"@site/i18n/zh-TW/docusaurus-plugin-content-docs/current/deploy/depend/postgresql.md","sourceDirName":"deploy/depend","slug":"/deploy/depend/postgresql","permalink":"/docs/zh-TW/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":"/docs/zh-TW/docs/deploy/depend/mysql"},"next":{"title":"Redis","permalink":"/docs/zh-TW/docs/deploy/depend/redis"}}');var o=t(5723),r=t(6246);const l={sidebar_label:"Postgresql",sidebar_position:1},d="PostgreSQL 16",p={},i=[{value:"\u5b89\u88c5",id:"\u5b89\u88c5",level:2}];function a(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:"\u64cd\u4f5c\u7cfb\u7edf\uff1aUbuntu 24.04 LTS"}),"\n",(0,o.jsx)(s.li,{children:"\u670d\u52a1\u5668\u63a8\u8350\u914d\u7f6e4\u68388G\u5185\u5b58"}),"\n"]})}),"\n",(0,o.jsx)(s.h2,{id:"\u5b89\u88c5",children:"\u5b89\u88c5"}),"\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# \u67e5\u770b\u7248\u672c\u53f7\npsql --version\n# \u67e5\u770b\u662f\u5426\u5df2\u7ecf\u542f\u52a8\nlsof -i:5432\n# \u5982\u9700\u8981\u672c\u5730\u5ba2\u6237\u7aef\u8fde\u63a5\u4e91\u670d\u52a1\uff0c\u5230\u817e\u8baf\u4e91\u6216\u963f\u91cc\u4e91\u9632\u706b\u5899\u5f00\u653e\u7aef\u53e3\u53f7\uff1a5432\n# \u67e5\u627e\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\nlocate postgresql.conf\n# /etc/postgresql/16/main/postgresql.conf\n# \u4e3a\u65b9\u4fbf\u4fee\u6539\u5c06/etc/postgresql/16/main/\u8def\u5f84\u4e0b\u6240\u6709\u914d\u7f6e\u6587\u4ef6\u4e0b\u8f7d\u5230\u672c\u5730\u4fee\u6539\n# \u5f00\u542f\u5916\u7f51\u8bbf\u95ee\uff0c\u4fee\u6539 postgresql.conf \u6587\u4ef6\nlisten_addresses = '*'\n# \u4fee\u6539 pg_hba.conf \u6587\u4ef6\uff0c\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a\nhost all all 0.0.0.0/0 scram-sha-256\n# \u4fee\u6539\u5bc6\u7801\nsudo -u postgres psql\nALTER USER postgres WITH PASSWORD 'password'; # \u4fee\u6539\u5bc6\u7801 https://suijimimashengcheng.bmcx.com/\n# \u6309 \\q \u9000\u51fa\n# \u5b89\u88c5 pgvector\napt install postgresql-16-pgvector\n# \u5c06\u4fee\u6539\u540e\u7684\u914d\u7f6e\u6587\u4ef6\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u91cd\u542f\nservice postgresql restart\n# service postgresql stop\n# \u67e5\u770b\u7aef\u53e3 5432\nlsof -i:5432\n# \u6216\u8005\nnetstat -tunlp | grep 5432\n# \u4f7f\u7528pgadmin\u5ba2\u6237\u7aef, \u684c\u9762\u5ba2\u6237\u7aef\u8fdc\u7a0b\u8fde\u63a5\n# \u521b\u5efa\u6570\u636e\u5e93 bytedesk\n# \u7ed9\u521a\u521b\u5efa\u7684\u6570\u636e\u5e93bytedesk\u6dfb\u52a0\u6269\u5c55vector\uff08\u53f3\u952e\u6269\u5c55\uff0c\u521b\u5efa->General->\u540d\u79f0\uff1avector\uff09\n"})})]})}function c(e={}){const{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,o.jsx)(s,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},6246:(e,s,t)=>{t.d(s,{R:()=>l,x:()=>d});var n=t(2155);const o={},r=n.createContext(o);function l(e){const s=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function d(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:l(e.components),n.createElement(r.Provider,{value:s},e.children)}}}]);