aboutsummaryrefslogtreecommitdiff
path: root/getmepostgres.sh
diff options
context:
space:
mode:
authorcjd242018-02-07 03:09:50 +0000
committercjd242018-02-07 03:09:50 +0000
commitd66a0d90a658d5094ba274c4b4c4c3d66d8254a3 (patch)
tree997352d8fdc611f7a16df9ed409c706413cd877e /getmepostgres.sh
parentMerge branch 'cjd24/stubsgres' into 'master' (diff)
downloadmedicine-d66a0d90a658d5094ba274c4b4c4c3d66d8254a3.tar.gz
medicine-d66a0d90a658d5094ba274c4b4c4c3d66d8254a3.zip

Streamlined script for adding postgres, and added packages in preparation for writing ORM

Diffstat (limited to 'getmepostgres.sh')
-rwxr-xr-xgetmepostgres.sh46
1 files changed, 32 insertions, 14 deletions
diff --git a/getmepostgres.sh b/getmepostgres.sh
index 05db59d..50976f8 100755
--- a/getmepostgres.sh
+++ b/getmepostgres.sh
@@ -6,6 +6,15 @@ if [ -d "~/pg" ]; then
exit 1;
fi
+echo " ";
+echo " ";
+echo " ";
+echo "This installation process takes ~3:50 minutes to complete.";
+echo " ";
+echo " ";
+echo " ";
+sleep 3;
+
echo "> Making postgres directory at ~/pg";
mkdir ~/pg;
currentDir=$(pwd);
@@ -16,30 +25,39 @@ cd ~/pg;
echo "> Cloning Repo";
git clone https://github.com/postgres/postgres.git;
-echo "> Checking out to version 10";
+echo "> Checking out to version 10.1";
cd ./postgres;
-git reset --hard REL_10_0;
+git reset --hard REL_10_1;
echo "> Configuring";
-sleep 2;
./configure --prefix=$HOME/pg/postgres/ --with-python PYTHON=/usr/bin/python2.7;
-
-read -p "Press [Enter] key to Build Postgres...";
echo "> Building Postgres";
make -j 5;
-read -p "Press [Enter] key to Install Postgres...";
echo "> Installing Postgres";
make install;
-echo "> Creating the Database";
+echo "> Initialise the Database";
~/pg/postgres/bin/initdb -D ~/pg/postgres/data/;
-
-echo "";
-echo "";
-echo "";
-echo "";
-echo "";
-echo "> Completed the installation of Postgres. Please use `./runmepostgres.sh` to run.";
+echo " ";
+echo " ";
+echo " ";
+echo " ";
+echo "> Starting the postgres server";
+~/pg/postgres/bin/pg_ctl -D ~/pg/postgres/data/ -l POSTGRES_logfile start;
+echo "> Create the Database";
+~/pg/postgres/bin/createdb be4;
+echo "> Creating Admin user";
+~/pg/postgres/bin/psql -U ${USER} postgres -c "CREATE USER admin WITH PASSWORD 'eprprJacR0hBpmWvs5IDJZTnjRAY2gM3tSm0b1af';";
+echo "> Granting Admin Permissions";
+~/pg/postgres/bin/psql -U ${USER} postgres -c "ALTER DATABASE be4 OWNER TO admin;";
+
+
+echo " ";
+echo " ";
+echo " ";
+echo " ";
+echo " ";
+echo "> Completed the installation of Postgres.";
cd $currentDir;