Vous êtes sur la page 1sur 7

=================== Geonode on Ubuntu 10.04 =================== Useful resources ============= http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#ubuntudebian http://stackoverflow.com/questions/1918699/install-maven2-on-karmic http://projects.opengeo.org/CAPRA/wiki/DeployingGeoNode http://geoserver.org/display/GEOSDOC/1.1.4+CentOS+(Red+Hat)+5.

1+Install HW and OS Setup ========== Ubuntu 10.04 LTS a 64 Bits RAM: 4 GB HDD: 144 GB ( / -> 20GB , /home -> 20GB, /var -> 100GB, swap -> 4GB) Instalation procedure =============== # May or may not be needed depending on your base installation sudo apt-get install python-software-properties #Add ubuntu partner repo to get Java 6 from sun (Oracle) sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" # Update your package repositories sudo apt-get update #Main dependencies sudo apt-get install subversion git-core git-svn mercurial binutils build-essent ial libgdal1-1.6.0 postgresql-8.4-postgis postgresql-server-dev-8.4 python-psyco pg2 python-setuptools libgeoip1 gdal-bin python-gdal sun-java6-jdk nginx pythonimaging python-reportlab unzip #By default maven2 installs way too many additional packages in Ubuntu # so the safe route is to install manually. sudo su cd /opt wget http://mirror.cloudera.com/apache/maven/binaries/apache-maven-2.2.1-bin.tar .gz tar -xvzf apache-maven-2.2.1-bin.tar.gz ln -s ./apache-maven-2.2.1 ./maven #Add the following three lines to the bottom of /etc/bash.bashrc export JAVA_HOME=/usr/lib/jvm/java-6-sun export M2_HOME=/opt/maven export PATH=$PATH:$M2_HOME/bin source /etc/bash.bashrc #sudo apt-get install tomcat6 cd /opt wget http://mirrors.ecvps.com/apache/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6 .0.26.tar.gz useradd -m tomcat

sudo su postgres POSTGIS_SQL_PATH=/usr/share/postgresql/8.4/contrib/ createdb -E UTF8 template_postgis # Create the template spatial database. createlang -d template_postgis plpgsql # Adding PLPGSQL language support. psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname=' template_postgis';" psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql # Loading the PostGIS SQL routines psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enablin g users to alter spatial tables. psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" createuser #Shall the #Shall the #Shall the geonode new role be a superuser? (y/n) n new role be allowed to create databases? (y/n) y new role be allowed to create more new roles? (y/n) n

psql ALTER ROLE geonode WITH password 'xxxx'; \q exit # good bye postgres user sudo adduser geonode sudo su - geonode Should probably add geonode to group admin for sudo privs createdb geonode -T template_postgis svn co http://svn.opengeo.org/CAPRA/GeoNode/trunk geonode-trunk #Error validating server certificate for 'https://svn.opengeo.org:443': #.... #(R)eject, accept (t)emporarily or accept (p)ermanently? p cd geonode-trunk #Add the following line after line 153 in pavement.py sh('%s install -r %s' %(pip, path("shared/core-libs.txt"))) It should look like this: pip = path(options.config.bin) / "pip" sh('%s install -r %s' %(pip, path("shared/core-libs.txt"))) sh('%s install -e %s' %(pip, path("src/GeoNodePy"))) #Comment out PIL and Reportlab from shared/core-libs.txt #Comment out the following in src/GeoNodePy/setup.py install_requires = [ # "gsconfig.py", "OWSLib>0.3.1", "Django>=1.1", # "ReportLab",

"PIL", "simplejson", "django-extensions", "httplib2" ],

python bootstrap.py #Enable the reportlab and PIL that we had installed systemwide: ln -s /usr/lib/python2.6/dist-packages/P ~/lib/python2.6/site-packages/ ln -s /usr/lib/python2.6/dist-packages/PIL ~/lib/python2.6/site-packages/ #Also enable the postgis adapter and the mx.Datetime package ln -s /usr/lib/python2.6/dist-packages/psycopg2 ~/lib/python2.6/site-packages/ ln -s /usr/lib/python2.6/dist-packages/mx ~/lib/python2.6/site-packages/ source bin/activate paver build paver make_release The two files you are interested in, are: shared/GeoNode-1.0.1rev1115.tar.gz shared/geonode-geoserver-data.zip Let's relocate them to avoid making a mess cd ~ mkdir deploy cd deploy tar -zxvf ~/geonode-trunk/shared/GeoNode-*.tar.gz cd .. mkdir data cd data unzip ~/geonode-trunk/shared/geonode-geoserver-data.zip chmod -R 775 ~/data Add tomcat6 to the geonode group, to avoid permissions problems by editing the / etc/group file: sudo vim /etc/group Look for the line that starts with geonode and add tomcat6 at the end, like this : geonode:x:1001:tomcat6 Move the geoserver war to the tomcat webapps dir sudo mv ~/deploy/geoserver-geonode-dev.war /var/lib/tomcat6/webapps/geoserver.wa r Restart tomcat sudo /etc/init.d/tomcat6 restart cat /etc/apache2/sites-available/geonode WSGIDaemonProcess geonode user=geonode group=geonode threads=10 python-path=/hom e/geonode/lib/python2.6/site-packages <VirtualHost *:81> ServerName geonode WSGIProcessGroup geonode WSGIScriptAlias / /home/geonode/conf/capra.wsgi

<Directory "/home/geonode/conf/"> Allow from all </Directory> ErrorLog /var/log/geonode/apache_error.log LogLevel warn CustomLog /var/log/geonode/apache_access.log common ServerSignature On </VirtualHost> cat /etc/apache2/ports.conf Listen 81 <IfModule mod_ssl.c> Listen 443 </IfModule> cat /etc/nginx/nginx.conf user geonode; worker_processes 1; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; server_names_hash_bucket_size 64; access_log /var/log/nginx/access.log; sendfile tcp_nopush on; on;

#keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on; gzip on; gzip_http_version 1.0; gzip_comp_level 6; gzip_proxied any; gzip_types text/plain text/css application/json application/x-javascript tex t/xml application/xml application/xml+rss text/javascript; # make sure gzip does not lose large gzipped js or css files # see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl gzip_buffers 16 8k; include /etc/nginx/sites-enabled/*; } cat /etc/nginx/proxy.conf proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m;

client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; cat /etc/nginx/sites-available/geonode server { listen 80; server_name geonode.worldbank.org; access_log /var/log/geonode/nginx_access.log; error_log /var/log/geonode/nginx_error.log; root /home/geonode/static; location / { if (!-f $request_filename) { proxy_pass http://localhost:81; break; } include /etc/nginx/proxy.conf; # auth_basic "Restricted"; # auth_basic_user_file /home/geonode/htpasswd; } location /geoserver{ if (!-f $request_filename) { proxy_pass http://localhost:8080; break; } include /etc/nginx/proxy.conf; } location /client { auth_basic off; expires max; } location /capra { auth_basic off; expires max; } location /admin_media { expires max; } } cd /etc/nginx/sites-enabled sudo ln -s ../sites-available/geonode . sudo rm /etc/nginx/sites-available/default sudo rm /etc/nginx/sites-enabled/default sudo mkdir /var/log/geonode

sudo chown -R geonode:geonode /var/log/geonode sudo /etc/init.d/nginx restart cd ~ cp deploy/geonode-webapp.pybundle . cp deploy/bootstrap.py . python bootstrap.py #Don't worry if it says post_bootstrap is unknown source bin/activate pip install geonode-webapp.pybundle #Do some cleanup rm geonode-webapp.pybundle bootstrap.py #Create static dir and put client files there mkdir ~/static cd static unzip ../deploy/geonode-client.zip mv geonode-client client mv capra-client client/capra mkdir ~/conf cd ~/conf vim capra.wsgi import os, site os.environ['DJANGO_SETTINGS_MODULE'] = 'capra.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() sudo a2dissite default sudo a2ensite geonode sudo /etc/init.d/apache2 restart In ~/src/GeoNodePy/capra/settings.py add the following lines: DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'post gresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'geonode' # Or path to database file if using sqlite 3. DATABASE_USER = 'geonode' # Not used with sqlite3. DATABASE_PASSWORD = 'YOUR_PASS' # Not used with sqlite3. GEOSERVER_BASE_URL="/geoserver" GEONODE_CLIENT_LOCATION="/client/" MEDIA_LOCATIONS = { "ext_base": GEONODE_CLIENT_LOCATION + "/ext/", "ol_theme": GEONODE_CLIENT_LOCATION + "/ol/theme/default/style.css", "ol_script": GEONODE_CLIENT_LOCATION + "/ol/OpenLayers.js", "gx_themes": GEONODE_CLIENT_LOCATION + "/gx/theme/", "gx_script": GEONODE_CLIENT_LOCATION + "/gx/GeoExt.js", "PrintPreview_script": GEONODE_CLIENT_LOCATION + "/PrintPreview/PrintPre view.js", "PrintPreview_themes": GEONODE_CLIENT_LOCATION + "/PrintPreview/theme/", "gxp_script": GEONODE_CLIENT_LOCATION + "/gxp/gxp.js", "gxp_theme": GEONODE_CLIENT_LOCATION + "/gxp/theme/all.css", "app_themes": GEONODE_CLIENT_LOCATION + "/gn/theme/app/", "app_script": GEONODE_CLIENT_LOCATION + "/gn/GeoNode.js",

"ux_script": GEONODE_CLIENT_LOCATION + "/gn/ux.js", "capra_script": GEONODE_CLIENT_LOCATION + "/capra/CAPRA.js", } GOOGLE_MAPS_API_KEY="(go find one at http://code.google.com/apis/maps/signup.htm l)" GOOGLE_API_KEY=GOOGLE_MAPS_API_KEY EOF Add the following line to the bottom of ~/.bashrc in order to have the virtual e nv activated everytime you login as geonode. source ~/bin/activate <have to relink to the new virtualenv> cd ~/src/GeoNodePy/capra python manage.py syncdb --noinput Fix the occurrences of localhost:8000 and localhost:8001 in src/GeoNodePy/geonod e/settings.py, change them to your IP address or a valid DNS.

Vous aimerez peut-être aussi