{"id":549,"date":"2015-01-13T17:17:56","date_gmt":"2015-01-13T23:17:56","guid":{"rendered":"https:\/\/www.galador.org\/blog\/?p=549"},"modified":"2015-07-14T15:53:43","modified_gmt":"2015-07-14T21:53:43","slug":"upgrading-postgres-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.galador.org\/blog\/upgrading-postgres-on-ubuntu\/","title":{"rendered":"Upgrading Postgres on Ubuntu"},"content":{"rendered":"<p>Since I had a post on how to <a href=\"https:\/\/www.galador.org\/blog\/upgrading-brew-installed-postgresql-on-osx\/\" title=\"Upgrading Postgres on OS X\">update Postgres on OS X<\/a>, I thought I might as well create one for Ubuntu for my own reference, as well.<\/p>\n<p>First of all, take a look at <a href=\"https:\/\/wiki.postgresql.org\/wiki\/Apt\">this page<\/a> to see how you can use the official Postgres Apt packages. It&#8217;s important to note that if you use these packages (maybe the ones from Canonical, too, but I&#8217;ve never used those), the data directory for Postgres will be put in different locations, and the old version will continue to start if you use the <code>\/etc\/init.d<\/code> script. Each version will start on a different port, beginning at 5432 (the default) for the oldest version.<\/p>\n<p>Be sure to change the version numbers below:<\/p>\n<pre lang=\"bash\">\r\nold=9.3\r\nnew=9.4\r\n\r\nsudo apt-get install -y postgresql-$new postgresql-server-dev-$new postgresql-contrib-$new postgresql-client-$new postgresql-doc-$new\r\nsudo -u postgres psql -p 5432 -c \"select version()\" #make sure your old version is still on port 5432\r\nsudo -u postgres psql -p 5433 -c \"select version()\" #make sure the new version is on port 5433\r\nsudo -u postgres pg_dumpall -p 5432 > ~\/pg_backup.sql #default home path is \/var\/lib\/postgresql\r\nsudo -u postgres psql -p 5433 < ~\/pg_backup.sql\r\nsudo -u postgres psql -p 5433 -l #make sure your databases were created successfully\r\nsudo apt-get remove -y postgresql-$old postgresql-server-dev-$old postgresql-contrib-$old postgresql-client-$old postgresql-doc-$old\r\nsudo \/etc\/init.d\/postgresql restart\r\nsudo -u postgres psql -c \"select version()\" #make sure the new version is on port 5432\r\n<\/pre>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>Since I had a post on how to update Postgres on OS X, I thought I might as well create one for Ubuntu for my own reference, as well. First of all, take a look at this page to see how you can use the official Postgres Apt packages. It&#8217;s important to note that if &hellip; <a href=\"https:\/\/www.galador.org\/blog\/upgrading-postgres-on-ubuntu\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Upgrading Postgres on Ubuntu<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62],"tags":[],"class_list":["post-549","post","type-post","status-publish","format-standard","hentry","category-postgres"],"_links":{"self":[{"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/posts\/549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/comments?post=549"}],"version-history":[{"count":4,"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/posts\/549\/revisions"}],"predecessor-version":[{"id":556,"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/posts\/549\/revisions\/556"}],"wp:attachment":[{"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/media?parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/categories?post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.galador.org\/blog\/wp-json\/wp\/v2\/tags?post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}