|
2 | 2 |
|
3 | 3 | ## Install pg 9.6 as major |
4 | 4 |
|
| 5 | +``` |
| 6 | +
|
5 | 7 | yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm |
6 | 8 | yum install -y postgresql96 postgresql96-server postgresql96-contrib wget |
7 | 9 | /usr/pgsql-9.6/bin/postgresql96-setup initdb |
8 | 10 | systemctl start postgresql-9.6 |
9 | 11 | systemctl status postgresql-9.6 |
10 | | - |
| 12 | +``` |
11 | 13 |
|
12 | 14 | ## Create sampledatabase |
| 15 | +``` |
13 | 16 | su - postgres |
14 | 17 | psql |
15 | 18 | \password |
16 | 19 | CREATE DATABASE sampledatabase; |
17 | 20 | \q |
18 | | - |
| 21 | +``` |
19 | 22 | ## instering sample dataset |
20 | | - |
| 23 | +``` |
21 | 24 | wget https://raw.githubusercontent.com/morenoh149/postgresDBSamples/master/worldDB-1.0/world.sql |
22 | 25 | psql -d sampledatabase -f world.sql |
23 | | - |
| 26 | +``` |
24 | 27 | # varify that database was imported |
25 | | - |
| 28 | +``` |
26 | 29 | psql |
27 | 30 | \l |
28 | 31 | \c sampledatabase |
29 | 32 | \dt |
30 | 33 | \q |
31 | | - |
| 34 | +``` |
32 | 35 | ## Stop postgresql servers |
| 36 | +``` |
33 | 37 | systemctl stop postgresql-9.6 |
34 | | - |
| 38 | +``` |
35 | 39 | ## installing version 12 |
36 | | - |
| 40 | +``` |
37 | 41 | yum install -y postgresql12 postgresql12-contrib postgresql12-server |
38 | 42 | /usr/pgsql-12/bin/postgresql-12-setup initdb |
39 | | - |
| 43 | +``` |
40 | 44 | ## executing pg_upgrade from new version binary |
41 | | - |
| 45 | +``` |
42 | 46 | /usr/pgsql-12/bin/pg_upgrade --check \ |
43 | 47 | --old-datadir=/var/lib/pgsql/9.6/data \ |
44 | 48 | --new-datadir=/var/lib/pgsql/12/data \ |
45 | 49 | --old-bindir=/usr/pgsql-9.6/bin \ |
46 | 50 | --new-bindir /usr/pgsql-12/bin |
47 | | - |
| 51 | +``` |
48 | 52 | # run same upgrade without --check option |
49 | | - |
| 53 | +``` |
50 | 54 | /usr/pgsql-12/bin/pg_upgrade \ |
51 | 55 | --old-datadir=/var/lib/pgsql/9.6/data \ |
52 | 56 | --new-datadir=/var/lib/pgsql/12/data \ |
53 | 57 | --old-bindir=/usr/pgsql-9.6/bin \ |
54 | 58 | --new-bindir /usr/pgsql-12/bin |
55 | | - |
| 59 | +``` |
56 | 60 | ## varify data was inserted into new databse after starting postgresql server |
57 | | - |
| 61 | +``` |
58 | 62 | systemctl start postgresql-12 |
59 | | - systemctl status postgresql-12 |
| 63 | + systemctl status postgresql-12 |
| 64 | + ``` |
0 commit comments