centos.sh
1.97 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
set -ex
### Disable annoying plugin
sed -i'' s/enabled=1/enabled=0/g /etc/yum/pluginconf.d/fastestmirror.conf
if [ -n "$http_proxy" ]; then
# force all repositories to always use the same host to take advantage of a
# local proxy
repos=$(grep -rl '^#baseurl' /etc/yum.repos.d)
if [ -n "$repos" ]; then
sed -i -e 's/^#baseurl/baseurl/; s/^mirrorlist=/#mirrorlist-/' $repos
fi
fi
### Install dependencies
yum -y groupinstall "Development tools"
yum install -y git unzip mercurial libev-devel gettext libxml2-devel libxslt-devel openssl-devel libffi-devel libjpeg-turbo-devel zlib-devel freetype-devel postgresql-devel python-devel postgresql-server java
### Install Virtualenvwrapper
which pip2.7 > /dev/null ||
curl -s -L https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py |
python2.7
if [ ! -f /etc/profile.d/virtualenvwrapper.sh ]
then
pip install virtualenvwrapper
cat > "/etc/profile.d/virtualenvwrapper.sh" <<EOF
export VIRTUALENVWRAPPER_PYTHON="/usr/bin/python2.7"
source /usr/bin/virtualenvwrapper.sh
EOF
fi
### Create conf directory
mkdir -p /etc/colab
chown vagrant:vagrant /etc/colab
## Configuring postgres
if [ ! -f /var/lib/pgsql/data/pg_hba.conf.bkp ]; then
service postgresql initdb
cp /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf.bkp
echo "local all all ident" > /var/lib/pgsql/data/pg_hba.conf
echo "host all all 127.0.0.1/32 md5" >> /var/lib/pgsql/data/pg_hba.conf
echo "host all all ::1/128 md5" >> /var/lib/pgsql/data/pg_hba.conf
service postgresql restart
fi
### Create colab user in PostgreSQL
echo "CREATE USER colab WITH PASSWORD 'colab';" | sudo -u postgres -i psql 2> /dev/null || echo
echo "ALTER USER colab CREATEDB;" | sudo -u postgres -i psql 2> /dev/null
### Create colab DB in PostgreSQL
sudo -u postgres -i createdb --owner=colab colab 2> /dev/null | echo
### Forcing postgresql to start at boot
sudo chkconfig postgresql on