-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_centos.sh
29 lines (23 loc) · 1.16 KB
/
install_centos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
# http://stackoverflow.com/questions/18215973/how-to-check-if-running-as-root-in-a-bash-script
# EUID Expands to the effective user ID of the current user, initialized at shell startup.
# This variable is readonly.
if [ "${EUID}" -ne 0 ]
then echo "Please run as root"
exit
fi
yum install xerces-c gsl git nginx python-pip python-devel
# Repository for PostgreSQL 9.6
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
yum install postgresql96-devel postgresql96
/usr/pgsql-9.6/bin/postgresql96-setup initdb
sudo cp /var/lib/pgsql/9.6/data/pg_hba.conf /var/lib/pgsql/9.6/data/pg_hba.conf.bak
sudo sh -c 'echo "local all all ident" > /var/lib/pgsql/9.6/data/pg_hba.conf'
sudo sh -c 'echo "host all all all md5">> /var/lib/pgsql/9.6/data/pg_hba.conf'
systemctl enable postgresql-9.6
systemctl start postgresql-9.6
sudo systemctl start postgresql
sudo -u postgres sh -c 'createdb om'
sudo -u postgres psql -c "CREATE USER om WITH PASSWORD 'om'"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"om\" to om;"
sudo systemctl restart postgresql-9.6