| 1 | = !RedHat = |
| 2 | [[TOC]] |
| 3 | |
| 4 | We normally recommend users to install on Debian 6 Squeeze servers wherever possible as those scripts are the best maintained. |
| 5 | |
| 6 | If you need to install on a !RedHat-based system then you may find the nots on this page useful: |
| 7 | |
| 8 | == Fedora == |
| 9 | We have no Sahana-specific documentation, however this Web2Py script could be useful: |
| 10 | * https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-fedora.sh |
| 11 | |
| 12 | Also see: |
| 13 | * http://www.web2pyslices.com/slices/take_slice/98 |
| 14 | |
| 15 | == CentOS == |
| 16 | CentOS 5.x comes with just Python 2.4.3, so need to add the EPEL repository to upgrade to Python26 |
| 17 | {{{ |
| 18 | yum install -y lrzsz |
| 19 | yum install -y sqlite-devel zlib-devel bzip2-devel libxslt-devel |
| 20 | yum install -y gcc |
| 21 | |
| 22 | wget https://fedoraproject.org/static/217521F6.txt |
| 23 | rpm --import 217521F6.txt |
| 24 | |
| 25 | vim /etc/yum.repos.d/epel.repo |
| 26 | [epel] |
| 27 | name=Extra Packages for Enterprise Linux 5 - $basearch |
| 28 | #baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch |
| 29 | mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch |
| 30 | failovermethod=priority |
| 31 | enabled=1 |
| 32 | gpgcheck=1 |
| 33 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL |
| 34 | |
| 35 | [epel-debuginfo] |
| 36 | name=Extra Packages for Enterprise Linux 5 - $basearch - Debug |
| 37 | #baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug |
| 38 | mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch |
| 39 | failovermethod=priority |
| 40 | enabled=0 |
| 41 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL |
| 42 | gpgcheck=1 |
| 43 | |
| 44 | [epel-source] |
| 45 | name=Extra Packages for Enterprise Linux 5 - $basearch - Source |
| 46 | #baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS |
| 47 | mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch |
| 48 | failovermethod=priority |
| 49 | enabled=0 |
| 50 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL |
| 51 | gpgcheck=1 |
| 52 | |
| 53 | |
| 54 | yum install -y python26 python26-devel |
| 55 | yum install -y python26-imaging |
| 56 | |
| 57 | yum install -y httpd-devel |
| 58 | wget http://dl.fedoraproject.org/pub/epel/5/SRPMS/python26-mod_wsgi-3.3-1.el5.src.rpm |
| 59 | rpm -ivh python26-mod_wsgi-3.3-1.el5.src.rpm |
| 60 | yum install -y redhat-rpm-config |
| 61 | rpmbuild -bb /usr/src/redhat/SPECS/python26-mod_wsgi.spec |
| 62 | rpm -ivh /usr/src/redhat/RPMS/x86_64/python26-mod_wsgi-3.3-1.x86_64.rpm |
| 63 | cat << EOF > "/etc/httpd/conf.d/python26-mod_wsgi.conf" |
| 64 | <IfModule !python_module> |
| 65 | <IfModule !wsgi_module> |
| 66 | LoadModule wsgi_module modules/python26-mod_wsgi.so |
| 67 | WSGISocketPrefix /var/run |
| 68 | </IfModule> |
| 69 | </IfModule> |
| 70 | EOF |
| 71 | |
| 72 | wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz |
| 73 | tar zxvf setuptools-0.6c11.tar.gz |
| 74 | cd setuptools-0.6c11 |
| 75 | /usr/bin/python26 setup.py install |
| 76 | cd .. |
| 77 | |
| 78 | wget http://pypi.python.org/packages/source/l/lxml/lxml-2.3.4.tar.gz |
| 79 | tar zxvf lxml-2.3.4.tar.gz |
| 80 | cd lxml-2.3.4 |
| 81 | /usr/bin/python26 setup.py install |
| 82 | cd .. |
| 83 | |
| 84 | yum install -y rpm-build |
| 85 | wget http://pkgs.repoforge.org/geos/geos-3.2.2-1.rf.src.rpm |
| 86 | rpm -ivh geos-3.2.2-1.rf.src.rpm |
| 87 | rpmbuild -bb /usr/src/redhat/SPECS/geos.spec |
| 88 | rpm -ivh /usr/src/redhat/RPMS/x86_64/geos*.rpm |
| 89 | |
| 90 | wget http://pypi.python.org/packages/source/S/Shapely/Shapely-1.2.14.tar.gz |
| 91 | tar zxvf Shapely-1.2.14.tar.gz |
| 92 | cd Shapely-1.2.14 |
| 93 | /usr/bin/python26 setup.py install |
| 94 | cd .. |
| 95 | |
| 96 | yum install -y python26-numpy python26-numpy-devel |
| 97 | yum install -y libpng-devel |
| 98 | wget http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0.tar.gz |
| 99 | tar zxvf matplotlib-1.1.0.tar.gz |
| 100 | cd matplotlib-1.1.0 |
| 101 | /usr/bin/python26 setup.py install |
| 102 | cd .. |
| 103 | |
| 104 | wget http://pypi.python.org/packages/source/x/xlwt/xlwt-0.7.4.tar.gz |
| 105 | tar zxvf xlwt-0.7.4.tar.gz |
| 106 | cd xlwt-0.7.4 |
| 107 | /usr/bin/python26 setup.py install |
| 108 | cd .. |
| 109 | |
| 110 | wget http://pypi.python.org/packages/source/x/xlrd/xlrd-0.7.7.tar.gz |
| 111 | tar zxvf xlrd-0.7.7.tar.gz |
| 112 | cd xlrd-0.7.7 |
| 113 | /usr/bin/python26 setup.py install |
| 114 | cd .. |
| 115 | |
| 116 | yum install -y freetype-devel |
| 117 | wget http://www.reportlab.com/ftp/reportlab-2.5.tar.gz |
| 118 | tar zxvf reportlab-2.5.tar.gz |
| 119 | cd reportlab-2.5 |
| 120 | /usr/bin/python26 setup.py install |
| 121 | cd .. |
| 122 | |
| 123 | wget http://labix.org/download/python-dateutil/python-dateutil-1.5.tar.gz |
| 124 | tar zxvf python-dateutil-1.5.tar.gz |
| 125 | cd python-dateutil-1.5 |
| 126 | /usr/bin/python26 setup.py install |
| 127 | cd .. |
| 128 | |
| 129 | wget http://ipython.scipy.org/dist/0.10.2/ipython-0.10.2.tar.gz |
| 130 | tar zxvf ipython-0.10.2.tar.gz |
| 131 | cd ipython-0.10.2 |
| 132 | /usr/bin/python26 setup.py install |
| 133 | cd .. |
| 134 | |
| 135 | yum install -y mysql-server |
| 136 | yum install -y phpMyAdmin |
| 137 | yum install -y python26-mysqldb |
| 138 | /etc/init.d/mysqld start |
| 139 | chkconfig --level 3 mysqld on |
| 140 | chkconfig --level 4 mysqld on |
| 141 | chkconfig --level 5 mysqld on |
| 142 | mysqladmin -u root -p password new-password |
| 143 | <Enter - default password is blank> |
| 144 | |
| 145 | yum install -y git |
| 146 | |
| 147 | adduser -rd /var/www/web2py web2py |
| 148 | cd /var/www |
| 149 | git clone git://github.com/web2py/web2py.git |
| 150 | cat << EOF > "/var/www/web2py/routes.py" |
| 151 | #!/usr/bin/python26 |
| 152 | default_application = 'eden' |
| 153 | default_controller = 'default' |
| 154 | default_function = 'index' |
| 155 | routes_onerror = [ |
| 156 | ('eden/400', '!'), |
| 157 | ('eden/401', '!'), |
| 158 | ('eden/*', '/eden/errors/index'), |
| 159 | ('*/*', '/eden/errors/index'), |
| 160 | ] |
| 161 | EOF |
| 162 | sed -i 's|python|python26|' /var/www/web2py/wsgihandler.py |
| 163 | ln -s /var/www/web2py /home/web2py |
| 164 | ln -s /var/www/web2py ~ |
| 165 | cd web2py |
| 166 | cd applications |
| 167 | git clone git://github.com/flavour/eden.git |
| 168 | # Fix permissions |
| 169 | chown web2py ~web2py/ |
| 170 | chown web2py ~web2py/applications/admin/cache |
| 171 | chown web2py ~web2py/applications/admin/cron |
| 172 | chown web2py ~web2py/applications/admin/databases |
| 173 | chown web2py ~web2py/applications/admin/errors |
| 174 | chown web2py ~web2py/applications/admin/sessions |
| 175 | chown web2py ~web2py/applications/eden |
| 176 | chown web2py ~web2py/applications/eden/cache |
| 177 | chown web2py ~web2py/applications/eden/cron |
| 178 | mkdir -p ~web2py/applications/eden/databases |
| 179 | chown web2py ~web2py/applications/eden/databases |
| 180 | chown web2py ~web2py/applications/eden/errors |
| 181 | chown web2py ~web2py/applications/eden/models |
| 182 | chown web2py ~web2py/applications/eden/sessions |
| 183 | chown web2py ~web2py/applications/eden/static/img/markers |
| 184 | mkdir -p ~web2py/applications/eden/static/cache/chart |
| 185 | chown web2py -R ~web2py/applications/eden/static/cache |
| 186 | chown web2py ~web2py/applications/eden/uploads |
| 187 | mkdir -p ~web2py/applications/eden/uploads/gis_cache |
| 188 | mkdir -p ~web2py/applications/eden/uploads/images |
| 189 | mkdir -p ~web2py/applications/eden/uploads/tracks |
| 190 | chown web2py ~web2py/applications/eden/uploads/gis_cache |
| 191 | chown web2py ~web2py/applications/eden/uploads/images |
| 192 | chown web2py ~web2py/applications/eden/uploads/tracks |
| 193 | ln -s /home/web2py/applications/eden ~ |
| 194 | |
| 195 | cat << EOF > "/usr/local/bin/backup" |
| 196 | #!/bin/sh |
| 197 | NOW=\$(date +"%Y-%m-%d") |
| 198 | mysqldump sahana > /root/backup-\$NOW.sql |
| 199 | OLD=\$(date --date='7 day ago' +"%Y-%m-%d") |
| 200 | rm -f /root/backup-\$OLD.sql |
| 201 | EOF |
| 202 | chmod +x /usr/local/bin/backup |
| 203 | cat << EOF > "/usr/local/bin/compile" |
| 204 | #!/bin/sh |
| 205 | cd ~web2py |
| 206 | python26 web2py.py -S eden -R applications/eden/static/scripts/tools/compile.py |
| 207 | service httpd restart |
| 208 | EOF |
| 209 | chmod +x /usr/local/bin/compile |
| 210 | |
| 211 | cat << EOF > "/usr/local/bin/pull" |
| 212 | #!/bin/sh |
| 213 | cd ~web2py/applications/eden |
| 214 | sed -i 's/deployment_settings.base.migrate = False/deployment_settings.base.migrate = True/g' models/000_config.py |
| 215 | git pull |
| 216 | |
| 217 | # Maintenance |
| 218 | ln -sf /etc/httpd/conf/maintenance.conf /etc/httpd/conf/vhosts.conf |
| 219 | service httpd reload |
| 220 | killall -u web2py python |
| 221 | |
| 222 | rm -rf compiled |
| 223 | cd ~web2py |
| 224 | sudo -H -u web2py python26 web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py |
| 225 | cd ~web2py/applications/eden |
| 226 | sed -i 's/deployment_settings.base.migrate = True/deployment_settings.base.migrate = False/g' models/000_config.py |
| 227 | |
| 228 | cd ~web2py |
| 229 | python26 web2py.py -S eden -R applications/eden/static/scripts/tools/compile.py |
| 230 | ln -sf /etc/httpd/conf/production.conf /etc/httpd/conf/vhosts.conf |
| 231 | cd ~web2py && sudo -H -u web2py python web2py.py -K eden -Q >/dev/null 2>&1 & |
| 232 | service httpd reload |
| 233 | EOF |
| 234 | chmod +x /usr/local/bin/pull |
| 235 | |
| 236 | # Change the value of prepopulate, if-necessary |
| 237 | cat << EOF2 > "/usr/local/bin/clean" |
| 238 | #!/bin/sh |
| 239 | # Maintenance |
| 240 | ln -sf /etc/httpd/conf/maintenance.conf /etc/httpd/conf/vhosts.conf |
| 241 | service httpd reload |
| 242 | killall -u web2py python |
| 243 | |
| 244 | cd ~web2py/applications/eden |
| 245 | rm -f databases/* |
| 246 | rm -f errors/* |
| 247 | rm -f sessions/* |
| 248 | rm -rf uploads/* |
| 249 | sed -i 's/deployment_settings.base.migrate = False/deployment_settings.base.migrate = True/g' models/000_config.py |
| 250 | sed -i 's/deployment_settings.base.prepopulate = 0/deployment_settings.base.prepopulate = 1/g' models/000_config.py |
| 251 | rm -rf compiled |
| 252 | mysqladmin -f drop sahana |
| 253 | mysqladmin create sahana |
| 254 | cd ~web2py |
| 255 | sudo -H -u web2py python26 web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py |
| 256 | cd ~web2py/applications/eden |
| 257 | sed -i 's/deployment_settings.base.migrate = True/deployment_settings.base.migrate = False/g' models/000_config.py |
| 258 | sed -i 's/deployment_settings.base.prepopulate = 1/deployment_settings.base.prepopulate = 0/g' models/000_config.py |
| 259 | |
| 260 | cd ~web2py |
| 261 | python26 web2py.py -S eden -R applications/eden/static/scripts/tools/compile.py |
| 262 | ln -sf /etc/httpd/conf/production.conf /etc/httpd/conf/vhosts.conf |
| 263 | cd ~web2py && sudo -H -u web2py python web2py.py -K eden -Q >/dev/null 2>&1 & |
| 264 | service httpd reload |
| 265 | EOF2 |
| 266 | chmod +x /usr/local/bin/clean |
| 267 | |
| 268 | cat << EOF > "/usr/local/bin/w2p" |
| 269 | #!/bin/sh |
| 270 | cd ~web2py |
| 271 | python26 web2py.py -S eden -M |
| 272 | EOF |
| 273 | chmod +x /usr/local/bin/w2p |
| 274 | }}} |
| 275 | |
| 276 | {{{ |
| 277 | #!/bin/sh |
| 278 | # Script to configure an Eden server |
| 279 | # - assumes that install-eden-apache-mysql.sh has been run |
| 280 | echo -e "What domain name should we use? : \c " |
| 281 | read DOMAIN |
| 282 | echo -e "What host name should we use? : \c " |
| 283 | read hostname |
| 284 | sitename=$hostname".$DOMAIN" |
| 285 | echo -e "What is the current root MySQL password: \c " |
| 286 | read rootpw |
| 287 | # @ToDo: Generate a random password |
| 288 | echo -e "What should be the MySQL password for user 'sahana': \c " |
| 289 | read password |
| 290 | echo "Now reconfiguring system to use the hostname: $hostname" |
| 291 | cd /etc |
| 292 | filename="hosts" |
| 293 | sed -i "s|localdomain localhost|localdomain localhost $hostname|" $filename |
| 294 | cd /etc |
| 295 | filename="hostname" |
| 296 | echo $hostname > $filename |
| 297 | cd /etc |
| 298 | filename="mailname" |
| 299 | echo $sitename > $filename |
| 300 | # ----------------------------------------------------------------------------- |
| 301 | # Update system |
| 302 | # in case run at a much later time than the install script |
| 303 | # ----------------------------------------------------------------------------- |
| 304 | yum update |
| 305 | # If using the bleeding edge Web2py: |
| 306 | cd ~web2py |
| 307 | git pull |
| 308 | cd ~web2py/applications/eden |
| 309 | git pull |
| 310 | # ----------------------------------------------------------------------------- |
| 311 | # Email |
| 312 | # ----------------------------------------------------------------------------- |
| 313 | #echo configure for Internet mail delivery |
| 314 | #dpkg-reconfigure exim4-config |
| 315 | # ----------------------------------------------------------------------------- |
| 316 | # Apache Web server |
| 317 | # ----------------------------------------------------------------------------- |
| 318 | echo "Setting up Web server" |
| 319 | sed -i 's|#NameVirtualHost \*:80|NameVirtualHost \*:80|' /etc/httpd/conf/httpd.conf |
| 320 | cat << EOF >> "/etc/httpd/conf/httpd.conf" |
| 321 | Include conf/vhosts.conf |
| 322 | EOF |
| 323 | cat << EOF > "/etc/httpd/conf/production.conf" |
| 324 | <VirtualHost *:80> |
| 325 | ServerName $hostname.$DOMAIN |
| 326 | ServerAdmin webmaster@$DOMAIN |
| 327 | DocumentRoot /var/www/web2py/applications |
| 328 | WSGIScriptAlias / /var/www/web2py/wsgihandler.py |
| 329 | ## Edit the process and the maximum-requests to reflect your RAM |
| 330 | WSGIDaemonProcess web2py user=web2py group=web2py home=/var/www/web2py processes=4 maximum-requests=100 |
| 331 | RewriteEngine On |
| 332 | # Stop GoogleBot from slowing us down |
| 333 | RewriteRule .*robots\.txt$ /eden/static/robots.txt [L] |
| 334 | # extract desired cookie value from multiple-cookie HTTP header |
| 335 | #RewriteCond %{HTTP_COOKIE} registered=([^;]+) |
| 336 | # check that cookie value is correct |
| 337 | #RewriteCond %1 ^yes$ |
| 338 | #RewriteRule ^/$ /eden/ [R,L] |
| 339 | #RewriteRule ^/$ /eden/static/index.html [R,L] |
| 340 | RewriteCond %{REQUEST_URI} !/phpmyadmin(.*) |
| 341 | RewriteCond %{REQUEST_URI} !/eden/(.*) |
| 342 | RewriteRule /(.*) /eden/$1 [R] |
| 343 | ### static files do not need WSGI |
| 344 | <LocationMatch "^(/[\w_]*/static/.*)"> |
| 345 | Order Allow,Deny |
| 346 | Allow from all |
| 347 | SetOutputFilter DEFLATE |
| 348 | BrowserMatch ^Mozilla/4 gzip-only-text/html |
| 349 | BrowserMatch ^Mozilla/4\.0[678] no-gzip |
| 350 | BrowserMatch \bMSIE !no-gzip !gzip-only-text/html |
| 351 | SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary |
| 352 | Header append Vary User-Agent env=!dont-vary |
| 353 | ExpiresActive On |
| 354 | ExpiresByType text/html "access plus 1 day" |
| 355 | ExpiresByType text/javascript "access plus 1 week" |
| 356 | ExpiresByType text/css "access plus 2 weeks" |
| 357 | ExpiresByType image/ico "access plus 1 month" |
| 358 | ExpiresByType image/gif "access plus 1 month" |
| 359 | ExpiresByType image/jpeg "access plus 1 month" |
| 360 | ExpiresByType image/jpg "access plus 1 month" |
| 361 | ExpiresByType image/png "access plus 1 month" |
| 362 | ExpiresByType application/x-shockwave-flash "access plus 1 month" |
| 363 | </LocationMatch> |
| 364 | ### everything else goes over WSGI |
| 365 | <Location "/"> |
| 366 | Order deny,allow |
| 367 | Allow from all |
| 368 | WSGIProcessGroup web2py |
| 369 | </Location> |
| 370 | ErrorLog /var/log/httpd/$hostname_error.log |
| 371 | LogLevel warn |
| 372 | CustomLog /var/log/httpd/$hostname_access.log combined |
| 373 | </VirtualHost> |
| 374 | EOF |
| 375 | ln -sf /etc/httpd/conf/production.conf /etc/httpd/conf/vhosts.conf |
| 376 | service httpd restart |
| 377 | cat << EOF > "/etc/httpd/conf/maintenance.conf" |
| 378 | <VirtualHost *:80> |
| 379 | ServerName $hostname.$DOMAIN |
| 380 | ServerAdmin webmaster@$DOMAIN |
| 381 | DocumentRoot /var/www |
| 382 | RewriteEngine On |
| 383 | RewriteCond %{REQUEST_URI} !/phpmyadmin(.*) |
| 384 | RewriteRule ^/(.*) /maintenance.html |
| 385 | <Location "/"> |
| 386 | Order deny,allow |
| 387 | Allow from all |
| 388 | </Location> |
| 389 | ErrorLog /var/log/httpd/maintenance_error.log |
| 390 | LogLevel warn |
| 391 | CustomLog /var/log/httpd/maintenance_access.log combined |
| 392 | </VirtualHost> |
| 393 | EOF |
| 394 | # ----------------------------------------------------------------------------- |
| 395 | # MySQL Database |
| 396 | # ----------------------------------------------------------------------------- |
| 397 | echo "Setting up Database" |
| 398 | # Allow root user to access database without entering password |
| 399 | cat << EOF > "/root/.my.cnf" |
| 400 | [client] |
| 401 | user=root |
| 402 | EOF |
| 403 | echo "password='$rootpw'" >> "/root/.my.cnf" |
| 404 | # Create database |
| 405 | mysqladmin create sahana |
| 406 | # Create user for Sahana application |
| 407 | echo "CREATE USER 'sahana'@'localhost' IDENTIFIED BY '$password';" > "/tmp/mypass" |
| 408 | echo "GRANT ALL PRIVILEGES ON *.* TO 'sahana'@'localhost' WITH GRANT OPTION;" >> "/tmp/mypass" |
| 409 | mysql < /tmp/mypass |
| 410 | rm -f /tmp/mypass |
| 411 | # Schedule backups for 02:01 daily |
| 412 | echo "1 2 * * * * root /usr/local/bin/backup" >> "/etc/crontab" |
| 413 | # ----------------------------------------------------------------------------- |
| 414 | # Sahana Eden |
| 415 | # ----------------------------------------------------------------------------- |
| 416 | echo "Setting up Sahana" |
| 417 | # Copy Templates |
| 418 | cp ~web2py/applications/eden/private/templates/000_config.py ~web2py/applications/eden/models |
| 419 | sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' ~web2py/applications/eden/models/000_config.py |
| 420 | sed -i "s|akeytochange|$sitename$password|" ~web2py/applications/eden/models/000_config.py |
| 421 | sed -i "s|127.0.0.1:8000|$sitename|" ~web2py/applications/eden/models/000_config.py |
| 422 | sed -i 's|base.cdn = False|base.cdn = True|' ~web2py/applications/eden/models/000_config.py |
| 423 | # Configure Database |
| 424 | sed -i 's|#settings.database.db_type = "mysql"|settings.database.db_type = "mysql"|' ~web2py/applications/eden/models/000_config.py |
| 425 | sed -i "s|#settings.database.password = \"password\"|settings.database.password = \"$password\"|" ~web2py/applications/eden/models/000_config.py |
| 426 | # Create the Tables & Populate with base data |
| 427 | sed -i 's|settings.base.prepopulate = 0|settings.base.prepopulate = 1|' ~web2py/applications/eden/models/000_config.py |
| 428 | sed -i 's|settings.base.migrate = False|settings.base.migrate = True|' ~web2py/applications/eden/models/000_config.py |
| 429 | cd ~web2py |
| 430 | sudo -H -u web2py python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py |
| 431 | # Configure for Production |
| 432 | sed -i 's|settings.base.prepopulate = 1|settings.base.prepopulate = 0|' ~web2py/applications/eden/models/000_config.py |
| 433 | sed -i 's|settings.base.migrate = True|settings.base.migrate = False|' ~web2py/applications/eden/models/000_config.py |
| 434 | cd ~web2py |
| 435 | sudo -H -u web2py python web2py.py -S eden -R applications/eden/static/scripts/tools/compile.py |
| 436 | # Add Scheduler |
| 437 | sed -i 's|exit 0|cd ~web2py \&\& python26 web2py.py -K eden -Q >/dev/null 2>\&1 \&|' /etc/rc.local |
| 438 | echo "exit 0" >> /etc/rc.local |
| 439 | #read -p "Press any key to Reboot..." |
| 440 | echo "Now rebooting.." |
| 441 | reboot |
| 442 | # END |
| 443 | }}} |
| 444 | |
| 445 | @ToDo: matplotlib config (/etc/matplotlibrc not found) |
| 446 | |
| 447 | === CentOS alternate options === |
| 448 | These are notes on some possible alternate options |
| 449 | |
| 450 | Install a local version of Python27: |
| 451 | {{{ |
| 452 | mkdir -p /opt/python2.7 |
| 453 | wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 |
| 454 | tar -jxvf Python-2.7.3.tar.bz2 |
| 455 | cd Python-2.7.3 |
| 456 | ./configure --prefix=/opt/python2.7 --with-threads --enable-shared |
| 457 | make && make install |
| 458 | cd .. |
| 459 | ln -s /opt/python2.7/lib/libpython2.7.so /usr/lib |
| 460 | ln -s /opt/python2.7/lib/libpython2.7.so.1.0 /usr/lib |
| 461 | ln -s /opt/python2.7/bin/python /usr/local/bin/python |
| 462 | ln -s /opt/python2.7/bin/python /usr/bin/python2.7 |
| 463 | ln -s /opt/python2.7/lib/python2.7.so /opt/python2.6/lib/python2.7/config/ |
| 464 | /sbin/ldconfig |
| 465 | |
| 466 | wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz |
| 467 | tar -xzf mod_wsgi-3.3.tar.gz |
| 468 | cd mod_wsgi-3.3 |
| 469 | ./configure --with-python=/usr/local/bin/python |
| 470 | make && make install |
| 471 | cd .. |
| 472 | echo "LoadModule wsgi_module modules/mod_wsgi.so" > /etc/httpd/conf.d/wsgi.conf |
| 473 | |
| 474 | Use: |
| 475 | /opt/python2.7/bin/python |
| 476 | |
| 477 | wget http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz |
| 478 | tar zxvf MySQL-python-1.2.3.tar.gz |
| 479 | cd MySQL-python-1.2.3 |
| 480 | /opt/python2.7/bin/python setup.py install |
| 481 | cd .. |
| 482 | |
| 483 | # PostgreSQL 8.1.x in CentOS 5! Better to use MySQL |
| 484 | #wget http://pkgs.repoforge.org/proj/proj-4.7.0-1.el5.rf.i386.rpm |
| 485 | #wget http://pkgs.repoforge.org/postgis/postgis-1.3.6-1.el5.rf.i386.rpm |
| 486 | #rpm -ivh proj-4.7.0-1.el5.rf.i386.rpm |
| 487 | #rpm -ivh postgis-1.3.6-1.el5.rf.i386.rpm |
| 488 | #yum install postgresql postgresql-server postgresql-devel |
| 489 | #wget http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.2.tar.gz |
| 490 | #tar zxvf psycopg2-2.4.2.tar.gz |
| 491 | #cd psycopg2-2.4.2 |
| 492 | #/opt/python2.6/bin/python setup.py install |
| 493 | #cd .. |
| 494 | #/etc/init.d/postgresql start |
| 495 | }}} |