{"id":647,"date":"2016-09-28T15:18:39","date_gmt":"2016-09-28T15:18:39","guid":{"rendered":"https:\/\/netadmintools.com\/?p=647"},"modified":"2016-10-03T03:25:45","modified_gmt":"2016-10-03T03:25:45","slug":"postgresql-initial-install","status":"publish","type":"post","link":"https:\/\/www.netadmintools.com\/postgresql-initial-install\/","title":{"rendered":"PostgreSQL Initial Install"},"content":{"rendered":"<p>PostgreSql is an Open Source project with a BSD license. It is a mature and stable database with transactions, stored procedures, and rollback. PostgreSQL is available for win32;however, we will be compiling and installing this on a GNU\/Linux system. First, let&#8217;s grab the source from <a href=\"http:\/\/www.postgresql.org\/\">here<\/a> and decompress:<\/p>\n<table border=\"0\" width=\"99%\" bgcolor=\"#E0E0E0\">\n<tbody>\n<tr>\n<td>\n<pre>root@srv-1 src # <b>tar -xjf postgresql-8.0.0beta1.tar.bz2<\/b>\r\nroot@srv-1 postgresql-8.0.0beta1 # <b>ls<\/b>\r\nCOPYRIGHT       HISTORY  Makefile  aclocal.m4  configure     contrib  src\r\nGNUmakefile.in  INSTALL  README    config      configure.in  doc\r\nroot@srv-1 postgresql-8.0.0beta1 #\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In our case, we want to put this on opt, so we use the prefix option when we configure:<\/p>\n<table border=\"0\" width=\"99%\" bgcolor=\"#E0E0E0\">\n<tbody>\n<tr>\n<td>\n<pre>root@srv-1 postgresql-8.0.0beta1 # <b>.\/configure --prefix=\/opt\/pgsql<\/b>\r\nchecking build system type... i686-pc-linux-gnu\r\nchecking host system type... i686-pc-linux-gnu\r\nchecking which template to use... linux\r\n.\r\n.\r\n.\r\nconfig.status: linking .\/src\/include\/port\/linux.h to src\/include\/pg_config_os.h\r\nconfig.status: linking .\/src\/makefiles\/Makefile.linux to src\/Makefile.port\r\nroot@srv-1 postgresql-8.0.0beta1 #\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Install:<\/p>\n<table border=\"0\" width=\"99%\" bgcolor=\"#E0E0E0\">\n<tbody>\n<tr>\n<td>\n<pre>root@srv-1 postgresql-8.0.0beta1 # <b>make install<\/b>\r\nmake -C doc install\r\nmake[1]: Entering directory `\/usr\/local\/src\/postgresql-8.0.0beta1\/doc'\r\ngzip -d -c man.tar.gz | \/bin\/tar xf -\r\nfor file in man1\/*.1; do \\\r\n.\r\n.\r\n.\r\nving directory `\/usr\/local\/src\/postgresql-8.0.0beta1\/config'\r\nPostgreSQL installation complete.\r\nroot@srv-1 postgresql-8.0.0beta1 #\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Add a postgres user and prepare a home and data directory:<\/p>\n<table border=\"0\" width=\"99%\" bgcolor=\"#E0E0E0\">\n<tbody>\n<tr>\n<td>\n<pre>root@srv-1 root # <b>adduser postgres<\/b>\r\nroot@srv-1 root #\r\nroot@srv-1 root # <b>mkdir \/opt\/pgsql\/data -p<\/b>\r\nroot@srv-1 root #\r\nroot@srv-1 root # <b>chown postgres \/opt\/pgsql\/data<\/b>\r\nLet's initialize the system databases:\r\nroot@srv-1 root # <b>su - postgres<\/b>\r\npostgres@srv-1 pgsql $ <b>pwd<\/b>\r\n\/opt\/pgsql\r\npostgres@srv-1 pgsql $ <b>ls -l<\/b>\r\ntotal 28\r\ndrwxr-xr-x  2 root     root 4096 Aug 17 05:33 bin\r\ndrwxr-xr-x  2 postgres root 4096 Aug 17 05:36 data\r\ndrwxr-xr-x  3 root     root 4096 Aug 17 05:29 doc\r\ndrwxr-xr-x  5 root     root 4096 Aug 17 05:33 include\r\ndrwxr-xr-x  3 root     root 4096 Aug 17 05:34 lib\r\ndrwxr-xr-x  4 root     root 4096 Aug 17 05:29 man\r\ndrwxr-xr-x  3 root     root 4096 Aug 17 05:33 share\r\npostgres@srv-1 pgsql $\r\npostgres@srv-1 pgsql $ <b>bin\/initdb -D data\/<\/b>\r\nThe files belonging to this database system will be owned by user \"postgres\".\r\nThis user must also own the server process.\r\nThe database cluster will be initialized with locale C.\r\nfixing permissions on existing directory data ... ok\r\ncreating directory data\/global ... ok\r\ncreating directory data\/pg_xlog ... ok\r\n.\r\n.\r\n.\r\nSuccess. You can now start the database server using:\r\n\/opt\/pgsql\/bin\/postmaster -D data\r\nor\r\n\/opt\/pgsql\/bin\/pg_ctl -D data -l logfile start\r\npostgres@srv-1 pgsql $\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Start up the database:<\/p>\n<table border=\"0\" width=\"99%\" bgcolor=\"#E0E0E0\">\n<tbody>\n<tr>\n<td>\n<pre>postgres@srv-1 pgsql $ <b>\/opt\/pgsql\/bin\/postmaster -D data<\/b>\r\nLOG:  database system was shut down at 2004-08-17 05:39:10 PDT\r\nLOG:  checkpoint record is at 0\/A452E0\r\nLOG:  redo record is at 0\/A452E0; undo record is at 0\/0; shutdown TRUE\r\nLOG:  next transaction ID: 492; next OID: 17228\r\nLOG:  database system is ready\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Create a test database and poke around:<\/p>\n<table border=\"0\" width=\"99%\" bgcolor=\"#E0E0E0\">\n<tbody>\n<tr>\n<td>\n<pre>postgres@srv-1 pgsql $ <b>bin\/createdb test<\/b>\r\nCREATE DATABASE\r\npostgres@srv-1 pgsql $\r\npostgres@srv-1 pgsql $ <b>bin\/psql test<\/b>\r\nWelcome to psql 8.0.0beta1, the PostgreSQL interactive terminal.\r\nType:  \\copyright for distribution terms\r\n\\h for help with SQL commands\r\n\\? for help with psql commands\r\n\\g or terminate with semicolon to execute query\r\n\\q to quit\r\ntest=#\r\ntest=# <b>show all;<\/b>\r\nname              |    setting\r\n--------------------------------+----------------\r\nadd_missing_from               | on\r\narchive_command                | unset\r\naustralian_timezones           | off\r\nauthentication_timeout         | 60\r\nbgwriter_delay                 | 200\r\nbgwriter_maxpages              | 100\r\nbgwriter_percent               | 1\r\nblock_size                     | 8192\r\ncheck_function_bodies          | on\r\ncheckpoint_segments            | 3\r\ncheckpoint_timeout             | 300\r\n.\r\n.\r\n.\r\ntest=# \\q\r\npostgres@srv-1 pgsql $\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Looks good.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSql is an Open Source project with a BSD license. It is a mature and stable database with transactions, stored procedures, and rollback. PostgreSQL is available for win32;however, we will be compiling and installing this on a GNU\/Linux system. First, let&#8217;s grab the source from here and decompress: root@srv-1 src # tar -xjf postgresql-8.0.0beta1.tar.bz2 root@srv-1 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":{"0":"post-647","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-database","7":"entry"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PostgreSQL Initial Install - Network Admin Tools<\/title>\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.netadmintools.com\/art363.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL Initial Install - Network Admin Tools\" \/>\n<meta property=\"og:description\" content=\"PostgreSql is an Open Source project with a BSD license. It is a mature and stable database with transactions, stored procedures, and rollback. PostgreSQL is available for win32;however, we will be compiling and installing this on a GNU\/Linux system. First, let&#8217;s grab the source from here and decompress: root@srv-1 src # tar -xjf postgresql-8.0.0beta1.tar.bz2 root@srv-1 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.netadmintools.com\/art363.html\" \/>\n<meta property=\"og:site_name\" content=\"Network Admin Tools\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-28T15:18:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-10-03T03:25:45+00:00\" \/>\n<meta name=\"author\" content=\"Paul Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Paul_AndersonNA\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/art363.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/art363.html\"},\"author\":{\"name\":\"Paul Anderson\",\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/#\\\/schema\\\/person\\\/eee9a07392c4bee0964628c706e86a7f\"},\"headline\":\"PostgreSQL Initial Install\",\"datePublished\":\"2016-09-28T15:18:39+00:00\",\"dateModified\":\"2016-10-03T00:00:00+0000\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/art363.html\"},\"wordCount\":98,\"articleSection\":[\"Database\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/art363.html\",\"url\":\"https:\\\/\\\/www.netadmintools.com\\\/art363.html\",\"name\":\"PostgreSQL Initial Install - Network Admin Tools\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/#website\"},\"datePublished\":\"2016-09-28T15:18:39+00:00\",\"dateModified\":\"2016-10-03T03:25:45+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/#\\\/schema\\\/person\\\/eee9a07392c4bee0964628c706e86a7f\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/art363.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.netadmintools.com\\\/art363.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/art363.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.netadmintools.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL Initial Install\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/#website\",\"url\":\"https:\\\/\\\/www.netadmintools.com\\\/\",\"name\":\"Network Admin Tools\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.netadmintools.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.netadmintools.com\\\/#\\\/schema\\\/person\\\/eee9a07392c4bee0964628c706e86a7f\",\"name\":\"Paul Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/cdn.netadmintools.com\\\/wp-content\\\/uploads\\\/paul-anderson-150x150.jpg\",\"url\":\"https:\\\/\\\/cdn.netadmintools.com\\\/wp-content\\\/uploads\\\/paul-anderson-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/cdn.netadmintools.com\\\/wp-content\\\/uploads\\\/paul-anderson-150x150.jpg\",\"caption\":\"Paul Anderson\"},\"description\":\"Paul is an Avid Tech Geek who Loves writing, Cycling and All Things Linux! He comes from a Background of Windows Administration along with Ubuntu\\\/Centos Server administration. Paul holds industry wide certifications include CompTIA & Microsoft Accredited certifications.\",\"sameAs\":[\"https:\\\/\\\/www.netadmintools.com\\\/author\\\/editor\\\/\",\"https:\\\/\\\/x.com\\\/Paul_AndersonNA\"],\"url\":\"https:\\\/\\\/www.netadmintools.com\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL Initial Install - Network Admin Tools","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.netadmintools.com\/art363.html","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL Initial Install - Network Admin Tools","og_description":"PostgreSql is an Open Source project with a BSD license. It is a mature and stable database with transactions, stored procedures, and rollback. PostgreSQL is available for win32;however, we will be compiling and installing this on a GNU\/Linux system. First, let&#8217;s grab the source from here and decompress: root@srv-1 src # tar -xjf postgresql-8.0.0beta1.tar.bz2 root@srv-1 [&hellip;]","og_url":"https:\/\/www.netadmintools.com\/art363.html","og_site_name":"Network Admin Tools","article_published_time":"2016-09-28T15:18:39+00:00","article_modified_time":"2016-10-03T03:25:45+00:00","author":"Paul Anderson","twitter_card":"summary_large_image","twitter_creator":"@Paul_AndersonNA","twitter_misc":{"Written by":"Paul Anderson","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.netadmintools.com\/art363.html#article","isPartOf":{"@id":"https:\/\/www.netadmintools.com\/art363.html"},"author":{"name":"Paul Anderson","@id":"https:\/\/www.netadmintools.com\/#\/schema\/person\/eee9a07392c4bee0964628c706e86a7f"},"headline":"PostgreSQL Initial Install","datePublished":"2016-09-28T15:18:39+00:00","dateModified":"2016-10-03T00:00:00+0000","mainEntityOfPage":{"@id":"https:\/\/www.netadmintools.com\/art363.html"},"wordCount":98,"articleSection":["Database"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.netadmintools.com\/art363.html","url":"https:\/\/www.netadmintools.com\/art363.html","name":"PostgreSQL Initial Install - Network Admin Tools","isPartOf":{"@id":"https:\/\/www.netadmintools.com\/#website"},"datePublished":"2016-09-28T15:18:39+00:00","dateModified":"2016-10-03T03:25:45+00:00","author":{"@id":"https:\/\/www.netadmintools.com\/#\/schema\/person\/eee9a07392c4bee0964628c706e86a7f"},"breadcrumb":{"@id":"https:\/\/www.netadmintools.com\/art363.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.netadmintools.com\/art363.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.netadmintools.com\/art363.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.netadmintools.com\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL Initial Install"}]},{"@type":"WebSite","@id":"https:\/\/www.netadmintools.com\/#website","url":"https:\/\/www.netadmintools.com\/","name":"Network Admin Tools","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.netadmintools.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.netadmintools.com\/#\/schema\/person\/eee9a07392c4bee0964628c706e86a7f","name":"Paul Anderson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cdn.netadmintools.com\/wp-content\/uploads\/paul-anderson-150x150.jpg","url":"https:\/\/cdn.netadmintools.com\/wp-content\/uploads\/paul-anderson-150x150.jpg","contentUrl":"https:\/\/cdn.netadmintools.com\/wp-content\/uploads\/paul-anderson-150x150.jpg","caption":"Paul Anderson"},"description":"Paul is an Avid Tech Geek who Loves writing, Cycling and All Things Linux! He comes from a Background of Windows Administration along with Ubuntu\/Centos Server administration. Paul holds industry wide certifications include CompTIA & Microsoft Accredited certifications.","sameAs":["https:\/\/www.netadmintools.com\/author\/editor\/","https:\/\/x.com\/Paul_AndersonNA"],"url":"https:\/\/www.netadmintools.com\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/posts\/647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/comments?post=647"}],"version-history":[{"count":1,"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/posts\/647\/revisions"}],"predecessor-version":[{"id":648,"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/posts\/647\/revisions\/648"}],"wp:attachment":[{"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/media?parent=647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/categories?post=647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netadmintools.com\/wp-json\/wp\/v2\/tags?post=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}