InstallationGuidelines/Linux/Server/CherokeePostgreSQL: upgrade-wheezy-2.sh

File upgrade-wheezy-2.sh, 2.6 KB (added by Fran Boon, 11 years ago)

Upgrade Squeeze to Wheezy

Line 
1#!/bin/sh
2
3# Script to upgrade Debian Squeeze to Wheezy
4# Part 2 - after Reboot
5
6cd /tmp
7apt-get install -y libgeos-dev
8wget http://pypi.python.org/packages/source/S/Shapely/Shapely-1.2.18.tar.gz
9tar zxvf Shapely-1.2.18.tar.gz
10cd Shapely-1.2.18
11python setup.py install
12cd ..
13wget http://projects.unbit.it/downloads/uwsgi-1.2.6.tar.gz
14tar zxvf uwsgi-1.2.6.tar.gz
15cd uwsgi-1.2.6/buildconf
16wget http://eden.sahanafoundation.org/downloads/uwsgi_build.ini
17cd ..
18sed -i "s|, '-Werror'||" uwsgiconfig.py
19python uwsgiconfig.py --build uwsgi_build
20/etc/init.d/uwsgi stop
21/etc/init.d/uwsgi-prod stop
22/etc/init.d/uwsgi-test stop
23cp uwsgi /usr/local/bin
24rm -rf /home/web2py/eden/compiled/
25compile
26compile prod
27rm -rf /home/test/eden/compiled/
28compile test
29reboot
30
31# PostgreSQL
32apt-get install -y postgresql-9.1-postgis
33apt-get clean
34/etc/init.d/uwsgi stop
35/etc/init.d/uwsgi-prod stop
36/etc/init.d/uwsgi-demo stop
37/etc/init.d/uwsgi-test stop
38su postgres
39pg_dropcluster --stop 9.1 main
40pg_upgradecluster 8.4 main
41/etc/init.d/uwsgi start
42/etc/init.d/uwsgi-prod start
43
44# Upgrade management scripts
45sed -i 's/8.4/9.1/g' /usr/local/bin/clean
46sed -i 's/su -c - postgres "createlang plpgsql/#su -c - postgres "createlang plpgsql/g' /usr/local/bin/clean
47
48cat << EOF > "/usr/local/bin/pg1024"
49#!/bin/sh
50sed -i 's|kernel.shmmax = 279134208|#kernel.shmmax = 279134208|' /etc/sysctl.conf
51sed -i 's|#kernel.shmmax = 552992768|kernel.shmmax = 552992768|' /etc/sysctl.conf
52sysctl -w kernel.shmmax=552992768
53sed -i 's|shared_buffers = 56MB|shared_buffers = 160MB|' /etc/postgresql/9.1/main/postgresql.conf
54sed -i 's|effective_cache_size = 256MB|effective_cache_size = 512MB|' /etc/postgresql/9.1/main/postgresql.conf
55sed -i 's|work_mem = 2MB|work_mem = 4MB|' /etc/postgresql/9.1/main/postgresql.conf
56/etc/init.d/postgresql restart
57EOF
58chmod +x /usr/local/bin/pg1024
59
60cat << EOF > "/usr/local/bin/pg512"
61#!/bin/sh
62sed -i 's|#kernel.shmmax = 279134208|kernel.shmmax = 279134208|' /etc/sysctl.conf
63sed -i 's|kernel.shmmax = 552992768|#kernel.shmmax = 552992768|' /etc/sysctl.conf
64sysctl -w kernel.shmmax=279134208
65sed -i 's|shared_buffers = 160MB|shared_buffers = 56MB|' /etc/postgresql/9.1/main/postgresql.conf
66sed -i 's|effective_cache_size = 512MB|effective_cache_size = 256MB|' /etc/postgresql/9.1/main/postgresql.conf
67sed -i 's|work_mem = 4MB|work_mem = 2MB|' /etc/postgresql/9.1/main/postgresql.conf
68/etc/init.d/postgresql restart
69EOF
70chmod +x /usr/local/bin/pg512
71
72pg_dropcluster 8.4 main
73apt-get remove -y postgresql-8.4 postgresql-client-8.4 postgresql-8.4-postgis libgeos-3.2.0
74
75echo 'Now run pg512 or pg1024, as-appropriate for your RAM'
76
77# END