-
Notifications
You must be signed in to change notification settings - Fork 0
How to Install CKAN 1.6 on Windows XP Professional
davidread edited this page Mar 8, 2013
·
2 revisions
This is an example of installing CKAN on Windows, as a guide for Window server installs. It uses CKAN 1.6 and a Windows XP Professional machine.
Contact: David Read on the ckan-dev mailing list
- Install Python: http://www.python.org/ftp/python/2.6.6/ e.g. http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
- Install Setuptools http://pypi.python.org/pypi/setuptools#files e.g. http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11.win32-py2.6.exe#md5=1509752c3c2e64b5d0f9589aafe053dc
- Install psycopg2
- install from http://www.stickpeople.com/projects/python/win-psycopg/index.2.0.13.html (this is the version we want rather than latest, and is compatible with Python only up to 2.6)
- Install Git: http://code.google.com/p/msysgit/downloads/list e.g. http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.9-preview20120201.exe&can=2&q=
- Ensure when it asks about "Adjusting your PATH environment" you select: "Run Git from the Windows Command Prompt".
- Install Subversion http://subversion.apache.org/packages.html#windows e.g. http://www.sliksvn.com/pub/Slik-Subversion-1.7.2-win32.msi
- Mercurial from http://mercurial.selenic.com/wiki/Download#Windows e.g. https://bitbucket.org/tortoisehg/thg-winbuild/downloads/mercurial-2.1.0-x86.msi
- Install Postgres from http://www.enterprisedb.com/products-services-training/pgdownload#windows 9.1.2-1
- Asks: superuser password, port (5432), default locale (default)
- Stack Builder - no need for any of that
C:\> \python26\Scripts\easy_install.exe virtualenv <code>Searching for virtualenv Reading http://pypi.python.org/simple/virtualenv/ Reading http://www.virtualenv.org Reading http://virtualenv.openplans.org Best match: virtualenv 1.7 Downloading http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.tar.gz Best match: virtualenv 1.7 Processing virtualenv-1.7-py2.6.egg virtualenv 1.7 is already the active version in easy-install.pth Installing virtualenv-script.py script to C:\python26\Scripts Installing virtualenv.exe script to C:\python26\Scripts Installing virtualenv.exe.manifest script to C:\python26\Scripts Using c:\python26\lib\site-packages\virtualenv-1.7-py2.6.egg Processing dependencies for virtualenv Finished processing dependencies for virtualenv
C:\> \python26\Scripts\virtualenv.exe --system-site-packages \pyenv Overwriting \pyenv\lib\site.py with new content Overwriting \pyenv\lib\orig-prefix.txt with new content New python executable in \pyenv\Scripts\python.exe Installing setuptools.................done. Installing pip....................done. Overwriting \pyenv\Scripts\activate_this.py with new content
C:\> \pyenv\Scripts\activate.bat (pyenv) C:\> pip install -e git+https://github.com/okfn/ckan.git#egg=ckan Obtaining ckan from git+https://github.com/okfn/ckan.git#egg=ckan Updating c:\pyenv\src\ckan clone Running setup.py egg_info for package ckan WARNING: ckanext.stats is a namespace package, but its __init__.py does not declare_namespace(); setuptools 0.7 will REQUIRE this! (See the setuptools manual under "Namespace Packages" for details.) warning: no files found matching '*' under directory 'ckanext\**\i18n' no previously-included directories found matching '.git' Installing collected packages: ckan Running setup.py develop for ckan WARNING: ckanext.stats is a namespace package, but its __init__.py does not declare_namespace(); setuptools 0.7 will REQUIRE this! (See the setuptools manual under "Namespace Packages" for details.) warning: no files found matching '*' under directory 'ckanext\**\i18n' no previously-included directories found matching '.git' Creating c:\pyenv\lib\site-packages\ckan.egg-link (link to .) ckan 1.6.1a is already the active version in easy-install.pth Installing ckan-admin-script.py script to C:\pyenv\Scripts Installing ckan-admin.exe script to C:\pyenv\Scripts Installing ckan-admin.exe.manifest script to C:\pyenv\Scripts Installed c:\pyenv\src\ckan Successfully installed ckan Cleaning up...
- Install pyutilib manually:
(pyenv) C:\>pip install pyutilib.component.core==4.1 Downloading/unpacking pyutilib.component.core==4.1 Downloading pyutilib.component.core-4.1.tar.gz Running setup.py egg_info for package pyutilib.component.core Installing collected packages: pyutilib.component.core Running setup.py install for pyutilib.component.core Skipping installation of C:\pyenv\Lib\site-packages\pyutilib\__init__.py (na mespace package) Skipping installation of C:\pyenv\Lib\site-packages\pyutilib\component\__ini t__.py (namespace package) Installing C:\pyenv\Lib\site-packages\pyutilib.component.core-4.1-py2.6-nspk g.pth Successfully installed pyutilib.component.core Cleaning up...
- Install flup manually:
(pyenv) C:\> pip install hg+http://hg.saddi.com/flup@301a58656bfb#egg=flup
- Install lxml manually:
(pyenv) C:\> easy_install --allow-hosts=lxml.de,*.python.org lxml==2.2.4 Processing dependencies for lxml==2.2.4 Finished processing dependencies for lxml==2.2.4
- Comment out the "pyutilib" and "flup" lines in c:\pyenv\src\ckan\requires\lucid_missing.txt. i.e.:
#-e svn+https://software.sandia.gov/svn/public/pyutilib/pyutilib.component.core/trunk@1972#egg=pyutilib.component.core
...
#-e hg+http://hg.saddi.com/flup@301a58656bfb#egg=flup
(pyenv) C:\> pip install -r pyenv/src/ckan/requires/lucid_missing.txt -r pyenv/src/ckan/requires/lucid_conflict.txt
(pyenv) C:\> pip install -r \pyenv\src\ckan\requires\lucid_present.txt
- Run PGAdmin III (Start, Programs, Postgres 9.1, PGAdmin III)
- click in "Object browser" on Postgres 9.1 and enter password previously set.
- Right click on "Login roles" and select "New Login Role..."
- Role name is "ckanuser", set a password, default privileges. Click Ok.
- Right click on "Databases" and select "New Database..."
- Name is "ckantest" and Owner is "ckanuser". Encoding should be UTF8. Click Ok.
- Create the config file
(pyenv) C:\>cd \pyenv\src\ckan (pyenv) C:\pyenv\src\ckan>paster make-config ckan development.ini Now you should edit the config files development.ini
- Edit \pyenv\src\ckan\development.ini for sqlalchemy.url & search options (I used simple_search)
- Initialise database
(pyenv) C:\pyenv\src\ckan>paster db init C:\pyenv\lib\site-packages\formalchemy\forms.py:49: SADeprecationWarning: compil e_mappers() is renamed to configure_mappers() compile_mappers() # initializes InstrumentedAttributes Initialising DB: SUCCESS
- Create some test data (optional)
(pyenv) C:\pyenv\src\ckan>paster create-test-data C:\pyenv\lib\site-packages\formalchemy\forms.py:49: SADeprecationWarning: compil e_mappers() is renamed to configure_mappers() compile_mappers() # initializes InstrumentedAttributes Running setup_config() from ckan.websetup 2012-02-21 11:19:41,398 INFO [ckan.websetup] Creating tables: SUCCESS Creating basic test data
- symbolic link to who.ini will cause problems, so remove and simply copy who.ini:
(pyenv) C:\pyenv\src\ckan>del who.ini (pyenv) C:\pyenv\src\ckan>copy ckan\config\who.ini .\ 1 file(s) copied.
- Start CKAN using the basic paster server:
(pyenv) C:\pyenv\src\ckan>paster serve --reload development.ini Starting subprocess with file monitor 2012-02-21 11:14:31,602 WARNI [vdm] Skipping adding property Package.package_tag _all to revisioned object 2012-02-21 11:14:31,614 WARNI [vdm] Skipping adding property Package.all_revisio ns_unordered to revisioned object 2012-02-21 11:14:31,684 WARNI [vdm] Skipping adding property PackageTag.all_revi sions_unordered to revisioned object 2012-02-21 11:14:31,733 WARNI [vdm] Skipping adding property Group.all_revisions _unordered to revisioned object 2012-02-21 11:14:31,743 WARNI [vdm] Skipping adding property Member.all_revision s_unordered to revisioned object 2012-02-21 11:14:31,763 WARNI [vdm] Skipping adding property GroupExtra.all_revi sions_unordered to revisioned object 2012-02-21 11:14:31,834 WARNI [vdm] Skipping adding property PackageExtra.all_re visions_unordered to revisioned object 2012-02-21 11:14:31,884 WARNI [vdm] Skipping adding property Resource.all_revisi ons_unordered to revisioned object 2012-02-21 11:14:31,894 WARNI [vdm] Skipping adding property ResourceGroup.resou rces_all to revisioned object 2012-02-21 11:14:31,894 WARNI [vdm] Skipping adding property ResourceGroup.all_r evisions_unordered to revisioned object 2012-02-21 11:14:31,924 WARNI [vdm] Skipping adding property PackageRelationship .all_revisions_unordered to revisioned object C:\pyenv\lib\site-packages\formalchemy\forms.py:49: SADeprecationWarning: compil e_mappers() is renamed to configure_mappers() compile_mappers() # initializes InstrumentedAttributes Starting server in PID 2300. serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
- Use browser to check CKAN runs at http://127.0.0.1:5000
- Install Apache
- http://httpd.apache.org/download.cgi
- e.g. http://mirror.ox.ac.uk/sites/rsync.apache.org//httpd/binaries/win32/httpd-2.2.22-win32-x86-no_ssl.msi
- install as a service
- I don't have DNS setup for my machine, so I said the network domain for it is "test.com", server name "www.test.com" and have added this line to my hosts file (C:\WINDOWS\system32\drivers\etc\hosts):
127.0.0.1 test.com
- Install modwsgi (an Apache module)
- Download the so file from here: http://code.google.com/p/modwsgi/wiki/DownloadTheSoftware?tm=2#Windows_Binary_Downloads e.g. http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py26-3.3.so
- Copy the file to your Apache install and rename it to mod_wsgi.so e.g.:
(pyenv) C:\pyenv\src\ckan>copy "C:\Documents and Settings\David Read\My Document
s\Downloads\mod_wsgi-win32-ap22py26-3.3.so" "C:\Program Files\Apache Software Fo undation\Apache2.2\modules\mod_wsgi.so"
- Add this line to the C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf:
LoadModule wsgi_module modules/mod_wsgi.so
- Configure the Apache vhost
- In the Apache config (C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf) add a reference to a CKAN vhost file:
Include conf/extra/httpd-vhosts-ckan.conf
- Now create this file C:\Program Files\Apache Software Foundation\Apache2.2\conf/extra/httpd-vhosts-ckan.conf with the following content:
NameVirtualHost *:80 <VirtualHost *:80> ServerName www.test.com ServerAlias test.com DocumentRoot "C:/pyenv" <Directory /> AllowOverride None Order Deny,Allow </directory> WSGIScriptAlias / /pyenv/Scripts/test.com.py # pass authorization info on (needed for rest api) WSGIPassAuthorization On ErrorLog "logs/test.com-error.log" CustomLog "logs/test.com-access.log" common </virtualhost>
- Now create the WSGI script it refers to C:\pyenv\Scripts\test.com.py as follows:
import os pyenv_dir = '\pyenv' config_file = 'development.ini' pyenv_bin_dir = os.path.join(pyenv_dir, 'Scripts') activate_this = os.path.join(pyenv_bin_dir, 'activate_this.py') execfile(activate_this, dict(__file__=activate_this)) from paste.deploy import loadapp config_filepath = os.path.join(pyenv_dir, 'src', 'ckan', config_file) from paste.script.util.logging_config import fileConfig fileConfig(config_filepath) application = loadapp('config:%s' % config_filepath)
- Use the Apache service icon in the task bar to restart Apache, browse to test.com and see CKAN running.
- If there is a problem, check the logs in C:\Program Files\Apache Software Foundation\Apache2.2\logs\