Created
May 6, 2014 06:38
-
-
Save ahmadsoe/e90a3639ce70f8c3b930 to your computer and use it in GitHub Desktop.
Setup postgresql 9.3 on ubuntu 12.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
REPO_FILE=/etc/apt/sources.list.d/pgdg.list | |
UBUNTU_VERSION=$(lsb_release -sr) | |
if [[ $UBUNTU_VERSION -eq '12.04' ]]; then | |
echo ' * Using defaults for 12.04 (Precise)' | |
UBUNTU_VERSION='precise' | |
elif [[ $UBUNTU_VERSION -eq '10.04' ]]; then | |
echo ' * Using defaults for 10.04 (Lucid)' | |
UBUNTU_VERSION='lucid' | |
elif | |
echo " ! This Ubuntu version is not supported by this script ($UBUNTU_VERSION)" | |
exit 1 | |
fi | |
if [[ ! -f $REPO_FILE ]]; then | |
touch $REPO_FILE | |
fi | |
REPOSITORY="deb http://apt.postgresql.org/pub/repos/apt/ $UBUNTU_VERSION-pgdg main" | |
if [[ -z $(grep $REPOSITORY $REPO_FILE) ]]; then | |
echo $REPOSITORY >> $REPO_FILE | |
end | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \ | |
sudo apt-key add - | |
apt-get update | |
apt-get install -y postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 postgresql-doc-9.3 | |
echo " * DONE!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment