Upgrading PostgreSQL in Cloud9
I got most of this information from this blog post and this Medium post . I'm going to upgrade to version 9.5 to get the JSONB functionality.
Step 1. Figure out which version you're using.
psql --version
Use this version number for the next commands. I have 9.3.14 installed, so I'll be using 9.3 in any commands that require it.
Step 2. Stop PostgreSQL service.
sudo pg_ctlcluster 9.3 main stop
Step 3. Add apt repository to your sources.
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/postgres.list
Step 4. Add repository key for newly added source.
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Step 5. Update and install the new package.
sudo apt-get update
sudo apt-get install postgresql-9.5
Note: When the prompt appears asking what to do about the createcluster.conf
file, select keep the local version currently installed .
Step 6. Remove the newly created empty cluster.
sudo pg_dropcluster --stop 9.5 main
Step 7. Upgrade your databases.
sudo pg_upgradecluster 9.3 main
Note: This may take a while.
Step 8. Check the clusters for giggles.
sudo pg_lsclusters
Step 9. Drop the old cluster.
sudo pg_dropcluster 9.3 main
You're good to go!
You're welcome and I don't think you should take it down, it's good to have it for posterity. Especially because it might either: