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