|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +if [ -f /etc/os-release ]; then |
| 4 | + . /etc/os-release |
| 5 | + OS=$NAME |
| 6 | + if [ $OS == "Fedora" ]; then |
| 7 | + echo "==========================================" |
| 8 | + echo "============Welcome User =================" |
| 9 | + echo "==========================================" |
| 10 | + VER=$VERSION_ID |
| 11 | + if [ $VER == 26 ]; then |
| 12 | + echo "$OS $VER" |
| 13 | + dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-26-x86_64/pgdg-fedora10-10-3.noarch.rpm -y |
| 14 | + dnf install postgresql10 postgresql10-server -y |
| 15 | + dnf install pgadmin3 phppgadmin -y |
| 16 | + /usr/pgsql-10/bin/postgresql-10-setup initdb |
| 17 | + |
| 18 | + # Modification /var/lib/pgsql/10/data/pg_hba.conf Note: User will do manually |
| 19 | + echo "===================================================" |
| 20 | + echo "===================================================" |
| 21 | + echo " Note: Modify /var/lib/pgsql/10/data/pg_hba.conf" |
| 22 | + echo "For that please Read instruction from README.md" |
| 23 | + echo "===================================================" |
| 24 | + echo "===================================================" |
| 25 | + |
| 26 | + systemctl start postgresql-10.service |
| 27 | + systemctl enable postgresql-10.service |
| 28 | + |
| 29 | + #Creating Test Database and Create New User |
| 30 | + useradd postgres |
| 31 | + mkdir /usr/pgsql-10/data |
| 32 | + chown postgres:postgres /usr/pgsql-10/data |
| 33 | + su - postgres -c "/usr/pgsql-10/bin/initdb /usr/pgsql-10/data/; sleep 2s; /usr/pgsql-10/bin/pg_ctl -D /usr/pgsql-10/data/ -l logfile start" |
| 34 | + firewall-cmd --permanent --zone=public --add-service=postgresql |
| 35 | + firewall-cmd --permanent --zone=public --add-port=5432/tcp |
| 36 | + systemctl restart firewalld.service |
| 37 | + systemctl enable firewalld.service |
| 38 | + |
| 39 | + elif [ $VER == 27 ]; then |
| 40 | + echo "Version 27" |
| 41 | + dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-27-x86_64/pgdg-fedora10-10-3.noarch.rpm -y |
| 42 | + dnf install postgresql10 postgresql10-server -y |
| 43 | + dnf install pgadmin3 phpPgAdmin -y |
| 44 | + /usr/pgsql-10/bin/postgresql-10-setup initdb |
| 45 | + |
| 46 | + # Modification /var/lib/pgsql/10/data/pg_hba.conf |
| 47 | + echo "===================================================" |
| 48 | + echo "===================================================" |
| 49 | + echo " Note: Modify /var/lib/pgsql/10/data/pg_hba.conf" |
| 50 | + echo "For that please Read instruction from README.md" |
| 51 | + echo "===================================================" |
| 52 | + echo "===================================================" |
| 53 | + |
| 54 | + systemctl start postgresql-10.service |
| 55 | + systemctl enable postgresql-10.service |
| 56 | + |
| 57 | + #Creating Test Database and Create New User |
| 58 | + |
| 59 | + useradd postgres |
| 60 | + mkdir /usr/pgsql-10/data |
| 61 | + chown postgres:postgres /usr/pgsql-10/data |
| 62 | + su - postgres -c "/usr/pgsql-10/bin/initdb /usr/pgsql-10/data/; sleep 2s; /usr/pgsql-10/bin/pg_ctl -D /usr/pgsql-10/data/ -l logfile start" |
| 63 | + firewall-cmd --permanent --zone=public --add-service=postgresql |
| 64 | + firewall-cmd --permanent --zone=public --add-port=5432/tcp |
| 65 | + systemctl restart firewalld.service |
| 66 | + systemctl enable firewalld.service |
| 67 | + fi |
| 68 | + fi |
| 69 | +fi |
0 commit comments