{"id":28146,"date":"2023-03-06T12:58:43","date_gmt":"2023-10-04T02:32:17","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/"},"modified":"2025-08-12T06:34:25","modified_gmt":"2025-08-11T22:34:25","slug":"%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/","title":{"rendered":"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55"},"content":{"rendered":"<h1>\u74b0\u5883<\/h1>\n<pre class=\"post-pre\"><code>$ cat \/etc\/os-release\r\nNAME=\"Ubuntu\"\r\nVERSION=\"19.10 (Eoan Ermine)\"\r\n<\/code><\/pre>\n<h1>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3082\u306e<\/h1>\n<pre class=\"post-pre\"><code>$ pg_config | grep VERSION\r\nVERSION = PostgreSQL 12.2 (Ubuntu 12.2-2.pgdg19.10+1)\r\n<\/code><\/pre>\n<h1>\u5b89\u88c5<\/h1>\n<p>\u516c\u5f0f\u3092\u898b\u306a\u304c\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<pre class=\"post-pre\"><code>$ sudo apt-get install curl ca-certificates gnupg\r\n$ curl https:\/\/www.postgresql.org\/media\/keys\/ACCC4CF8.asc | sudo apt-key add-\r\n$ sudo apt-get update\r\n$ sudo apt-get install postgresql-11 pgadmin4\r\n<\/code><\/pre>\n<p>\u81ea\u5206\u306e\u74b0\u5883\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u4f7f\u3048\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4ee5\u4e0b\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<br \/>\nsudo apt-get install libpq-dev<\/p>\n<h1>\u5728PSQL\u4e2d\u521b\u5efa\u89d2\u8272\u548c\u6570\u636e\u5e93<\/h1>\n<p>\u5728\u7ec8\u7aef\u4e0a\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<br \/>\npsql\u542f\u52a8\u3002<br \/>\nsudo -u postgres psql\u3002<\/p>\n<pre class=\"post-pre\"><code>create role \u30ed\u30fc\u30eb\u540d with createdb login password '\u30d1\u30b9\u30ef\u30fc\u30c9';\r\ncreate database \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d;\r\n\\l\r\n\\q\r\n<\/code><\/pre>\n<p>\\l\u4e3a\u663e\u793a\u6570\u636e\u5e93\u5217\u8868\u3002<br \/>\n\\q\u4e3a\u65ad\u5f00\u8fde\u63a5\u3002<\/p>\n<p>\u521b\u5efa PostgreSQL \u89d2\u8272\u7684 SQL \u547d\u4ee4\u5728 psql \u6587\u6863\u4e2d\u53ef\u4ee5\u627e\u5230\u3002<\/p>\n<h1>PSQL\u63a7\u5236\u53f0\u4e0a\u7684\u6ce8\u610f\u4e8b\u9879<\/h1>\n<p>\u5982\u679c\u6ca1\u6709\u52a0\u4e0a\u5206\u53f7\u300c;\u300d\uff0c\u5219\u63a7\u5236\u53f0\u5c06\u53ea\u4f1a\u6362\u884c\u800c\u4e0d\u4f1a\u53d1\u751f\u4efb\u4f55\u5176\u4ed6\u64cd\u4f5c\u3002<br \/>\n\u4e2a\u4eba\u7ecf\u9a8c\u603b\u7ed3\u3002<\/p>\n<h1>\u57fa\u672c\u4e0a\u4f7f\u7528pgAdmin<\/h1>\n<p>\u56e0\u4e3aWeb\u754c\u9762\u4f7f\u7528GUI\u5f88\u65b9\u4fbf\u3002<br \/>\n\u53ea\u9700\u4ece\u5e94\u7528\u7a0b\u5e8f\u4e2d\u9009\u62e9pgAdmin\u8fdb\u884c\u542f\u52a8\uff0c\u5373\u53ef\u5728\u76f8\u5e94\u7684\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00\u5c4f\u5e55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883 $ cat \/etc\/os-release NAME=&#8221;Ubuntu&#8221; VERSION=&#8221;19.10 ( [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-28146","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5b89\u88c5postgresql\u5907\u5fd8\u5f55-4\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5b89\u88c5postgresql\u5907\u5fd8\u5f55-4\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-04T02:32:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-11T22:34:25+00:00\" \/>\n<meta name=\"author\" content=\"\u9038, \u79d1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u9038, \u79d1\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/\",\"name\":\"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-10-04T02:32:17+00:00\",\"dateModified\":\"2025-08-11T22:34:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487\"},\"description\":\"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487\",\"name\":\"\u9038, \u79d1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g\",\"caption\":\"\u9038, \u79d1\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keyi\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55 - Blog - Silicon Cloud","description":"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5b89\u88c5postgresql\u5907\u5fd8\u5f55-4\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55","og_description":"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5b89\u88c5postgresql\u5907\u5fd8\u5f55-4\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-10-04T02:32:17+00:00","article_modified_time":"2025-08-11T22:34:25+00:00","author":"\u9038, \u79d1","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u9038, \u79d1","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/","name":"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-10-04T02:32:17+00:00","dateModified":"2025-08-11T22:34:25+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487"},"description":"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5728Ubuntu\u4e0a\u5b89\u88c5PostgreSQL\u5907\u5fd8\u5f55"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487","name":"\u9038, \u79d1","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g","caption":"\u9038, \u79d1"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keyi\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85postgresql%e5%a4%87%e5%bf%98%e5%bd%95-4\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=28146"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28146\/revisions"}],"predecessor-version":[{"id":86680,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28146\/revisions\/86680"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=28146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=28146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=28146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}