Files
runner-images/images/linux/scripts/installers/postgresql.sh
Darii Nurgaleev 3be17cf239 PostgreSQL install on Ubuntu/Windows. (#636)
* added windows installation script for postgresql

* removed if from Start-PostreSQL

* added script to packar template.

* changed postgresql.sh for ubuntu.

* postgresql stop and disalbe services.

* change name of the functions

* Stop postgreSQL after validation instead of start.

* added validation and re-work installation prcoedur

* remove redundunt code from psql

* correct intendation

* path to Path

* added PostgreSQL validation procedure.

* Removed useless last line.

* redundunt parameter passed in function call.

* removed repeated part of code.

* removed Stop function since it was useless.

* spaces

* spaces =

* Update Windows2019-Azure.json

* resolve confictls

* added validate and install postgresql

* added password to choco install and variables.

* add new system variables.

* added --params flag

* added correct quotas

* added logging for PostgreSQL install

Co-authored-by: Dariy.Nurgaleev <d.nurgaleev@trueengineering.ru>
2020-06-02 15:52:42 +03:00

32 lines
1.0 KiB
Bash

#!/bin/bash
################################################################################
## File: postgresql.sh
## Desc: Installs Postgresql
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
#Preparing repo for PostgreSQL 12.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
echo "Install PostgreSQL"
apt update
apt install postgresql postgresql-client
echo "Install libpq-dev"
apt-get install libpq-dev
#Verify that PostgreSQL is ready for accept incoming connections.
# exit codes:
# ready - 0
# reject - 1
# connection timeout - 2
pg_isready
DocumentInstalledItem "$(psql -V 2>&1 | cut -d ' ' -f 1,2,3)"
# Disable postgresql.service
systemctl is-active --quiet postgresql.service && systemctl stop postgresql.service
systemctl disable postgresql.service