In this post we will see how to to upgrade postgre-SQL from current version to latest need to follow below steps(I did the upgrade from 9.3 to 9.5beta2)
Step1: Verify the current version of PostgreSQL:
# /etc/init.d/postgresql-9.3 status
Step2: Stop current version of postgres database
# /etc/init.d/postgresql-9.3 stop
To install new version of the PostgreSQL database first you need to download the binary file to which you need to upgrade your version (In this case postgresql-9.5.0-beta2-linux-x64.run ) you have to run it as root
In this case we have downloaded it in /opt/PostgreSQL
After downloading file change file permissions:
# chmod +x postgresql-9.5.0-beta2-linux-x64.run
Step3: Now install new PostgreSQL:
# ./postgresql-9.5.0-beta2-linux-x64.run
Step4: Start postgreSQL :
# /etc/init.d/postgresql-9.5 start
Try to access using psql (Port will be same as you mentioned while installation) as postgres user
# psql -U postgres 5433
PostgreSQL upgrade steps
To upgrade from old PostgreSQL database to new version please follow below steps:
# cd /opt/PostgreSQL/9.5/bin/
Step1: Run below pg upgrade command:
Assuming that your old postgreSQL is install in /opt
# ./pg_upgrade -d ../../9.3/data -D ../../9.5/data -b ../../9.3/bin -B ../../9.5/bin
Step2: After upgrade you need to analyze newly installed version:
# cd /opt/PostgreSQL/9.5/bin/ # ./analyze_new_cluster.sh
Setp3: Set new version variable :
# cat /opt/PostgreSQL/9.5/pg_env.sh
Copy the env veriables and paste that in .bash_profile of user (here postgre)
vim ~/.bash_profile
If every thing goes well we can change the port of new version from /opt/PostgreSQL/9.5/data/postgresql.conf to default or oldverison port and same in .bash_profile file of user postgres
You can change the authentication type from /opt/PostgreSQL/9.5/data/pg_hba.conf
It is very important to take backup of old version config file in this /opt/PostgreSQL/9.3 data file and binary files as per your path given while installation of old version of database.
Warning: count(): Parameter must be an array or an object that implements Countable in /home/vhosts/howtolinuxblog.orgfree.com/wp-includes/class-wp-comment-query.php on line 399
MOST COMMENTED
Uncategorized
Ubuntu 16.04 No desktop only shows background wallpaper
Administration / DNS / Linux
Dig command examples
Virtualization
OpenVz(Kernel Base Open source Virtulization)
Uncategorized
Install Ansible on Linux
Puppet
Configuring puppet4 server agent and puppetdb on ubuntu16.04
Database
Installing postgresql on ubuntu 16.04
Puppet
opensource puppet4 installation on ubuntu16.04