-
Notifications
You must be signed in to change notification settings - Fork 2k
How to Install CKAN 2.5.2 on Windows 7
This manual are based on the CKAN official installation manual: http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html and adopted from https://github.com/ckan/ckan/wiki/How-to-Install-CKAN-1.8-on-Windows
- Python 2.7.11
- PostgreSQL-9.5.3-1
- solr-4.9.1 (it does not work with later versions)
- ckan-2.5.2
- Install Python 2.7.11 for Windows: https://www.python.org/downloads/
- Add
C:\Python27\Scripts;C:\Python27;
to the Windows path - Open a new DOS prompt and run
-
easy_install pip
(if pip was not installed)
-
- Install the Windows distribution of psycopg2 for Python 2.7: http://www.stickpeople.com/projects/python/win-psycopg/ This is the Python library for PostgreSQL (tested on sep 2017 and it worked using the latest version of package via pip:
pip install psycopg2
no need to download the exe --- actually not sure about that) - Run
pip install virtualenv
- Install virtualenvwrapper-win https://github.com/davidmarble/virtualenvwrapper-win
- Install the latest version of PostgreSQL for windows
- Run pgAdmin III (Start > Programs > PostgreSQL 9.5 (x86) > pgAdmin III)
- click in "Object browser" on PostgreSQL 9.5 (x86) and enter password previously set.
- Right click on "Login roles" and select "New Login Role..."
- Role name is "ckan_default", set a password, default privileges. Click Ok.
- Right click on "Databases" and select "New Database..."
- Name is "ckan_default" and Owner is "ckan_default". Encoding should be UTF8. Click Ok.
- Install the latest version of PostgreSQL for windows
- Run pgAdmin 4 (Start > Programs > PostgreSQL 9.6 > pgAdmin 4)
- Open the database on the sidebar on PostgreSQL 9.6 and enter password set during setup.
- Open the Logins/Roles tree, right click on it and select create
- Role name is "ckan_default", set a password on the second tab. On the privileges tab allow for table creation. Click Ok.
- Open the Databases tree, right click and select create.
- Name is "ckan_default" and Owner is "ckan_default". Encoding should be UTF8. Click Ok.
- Download the latest version of solr
- Copy schema.xml from C:\src\ckan\config\solr to C:\solr-4.9.1\example\solr\collection1\conf
- Open a new DOS prompt in C:\solr-4.9.1\example
- Run java -jar start.jar
- solr_url = http://127.0.0.1:8983/solr
-
Clone CKAN
C:\src>git clone https://github.com/ckan/ckan.git
-
Run
C:\src>cd ckan
-
Run
C:\src\ckan>git tag -l
-
Run
C:\src\ckan>git checkout tags/ckan-2.5.2
-
Create new virtual environment
mkvirtualenv --system-site-packages ckan
-
Activate your virtual environment
workon ckan
-
Edit file
C:\src\ckan\requirements.txt
by commenting out the line#psycopg2==2.4.5
-
Edit
C:\src\ckan\ckan\lib\fanstatic_resources.py
-
Change line
resource = Resource(library, path, **kw)
toresource = Resource(library, path.replace('\\', '/'), **kw)
-
Change line
setattr(module, fanstatic_name, resource)
tosetattr(module, fanstatic_name.replace('\\', '/'), resource)
-
Add the following line of code inside the for loop after line 193
resource_name = resource_name.replace('/', '\\')
The updated for loop should be as follows ` # order resource_list so that resources are created in the correct order` `for resource_name in reversed(order):` `resource_name = resource_name.replace('/', '\\')` `if resource_name in resource_list:` `resource_list.remove(resource_name)` `resource_list.insert(0, resource_name)`
-
-
Install the Python modules that CKAN requires into your virtualenv:
(ckan) C:\src\ckan>pip install -r requirements.txt
-
Create the CKAN config file: -
(ckan) C:\src\ckan>paster make-config ckan development.ini
-
Edit file
C:\src\ckan\development.ini
. Plese change DB password accordingly
-sqlalchemy.url = postgresql://ckan_default:[password]@localhost/ckan_default
-ckan.site_url = http://localhost
-solr_url = http://127.0.0.1:8983/solr
-
Upgrade bleach running the command - pip install --upgrade bleach
-
Create database tables -
(ckan) C:\src\ckan>paster db init -c development.ini
-
Copy
who.ini
fromC:\src\ckan\ckan\config
toC:\src\ckan\
-
Run the server: -
(ckan) C:\workspace\STB\ckan>paster serve development.ini
-
Access http://127.0.0.1:5000/
Extensions such as datapusher and datastore need to be activated in development.ini. For datastore follow install instructions here: http://docs.ckan.org/en/latest/maintaining/datastore.html
Other extensions and themes need to be installed in the virtualenv. From the folder of the extension, and with the virtualenv activated, run C:\src\ckan\ckanext\ckanext-theme\> python setup.py install