Skip to content

Data Portal installation on Windows 10

sschueth edited this page Aug 10, 2019 · 21 revisions

Tested with CKAN 2.8.3 on Windows 10

Prerequisites

Open the PowerShell

  1. Click the windows button in the lower-left corner of the screen
  2. Type "power" into the search field
  3. When the selection says "PowerShell", press Enter

Install required software

Python 2 (the CKAN data portal does not yet support Python 3)

  1. Install Python 2.7 (python-2.7.16.msi / python-2.7.16.amd64.msi)

  2. Add the Python27 directory to your PATH so your system has access to the Python commands by typing the following command in powershell:

[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\;C:\Python27\Scripts\", "User")

Open the Command Prompt

  1. Click the windows button in the lower-left corner of the screen

  2. Type "cmd" into the search field

  3. When the selection says "Command Prompt", press Enter

  4. Install virtualenv to manage your Python environments by typing the following command in the Command Prompt:

pip install virtualenv

Git (distributed version control software)

  1. install Git (Git-2.22.0-32-bit.exe / Git-2.22.0-64-bit.exe)

  2. Open the Git Bash desktop icon. The following steps must be completed by typing the commands in the Git Bash.

  3. Set your name (replace Your Name with your first and last name, e.g., Reuben Cummings):

git config --global user.name "Your Name"
  1. Set your commit email address (replace [email protected] with your email address, e.g., [email protected]):

Note: This should be the same email address you used to signup for your GitHub account

git config --global user.email "[email protected]"
  1. Check that both configurations have been set correctly:
git config --global --list

PostgreSQL (relational database)

  1. install pgadmin4-4.11-x86.exe

Git and GitHub

Fork the openpeoria/data-portal repo

  1. In the top-right corner of the repo page, click Fork.

fork button

Clone your forked repo

  1. On GitHub, navigate to your fork of the data-portal repository, e.g., https://github.com/yourusername/data-portal

  2. Under the repository name, click Clone or download

clone repo

  1. In the Clone with HTTPs section, click the clipboard icon to copy the clone URL for the repository.

https clone

  1. Create a directory to hold the cloned project by typing the following commands in the Git Bash:
mkdir Projects
cd Projects
  1. Type git clone, and then paste the URL you copied in step 3 above. It will look like git clone https://github.com/YOUR-USERNAME/data-portal, but with your GitHub username instead of YOUR-USERNAME.

  2. Press Enter. Your local clone will be created.

Portal Setup

Python environment setup

The following steps must be completed by typing the commands in the Command Prompt.

  1. Create and activate a virtual environment:
cd %USERPROFILE%\Projects\data-portal
virtualenv --no-site-packages --python=C:\Python27\python.exe venv
venv\Scripts\activate
  1. Install required Python libraries
pip install -r requirements.txt -r dev-requirements.txt python-magic-bin

Fanstatic setup

  1. Patch the fanstatic_resources.py file to work with Windows directories by typing the following command in the Git Bash.
mv fanstatic_resources.py venv/src/ckan/ckan/lib/fanstatic_resources.py

PostgreSQL setup

  • Download and install PostgreSQL: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

  • Choose version 11.5 Windows x86-64

  • You will need to select a superuser password. Remember it.

  • Other than that, though, you can follow all of the defaults (especially port, don't change the port).

  • When the installation is finished uncheck 'Launch Stack Builder at exit"

  • If you do launch Stack Builder, just exit without adding any additional components.

Start the pgAdmin tool

  1. The installation will have created a new program group called "PostgreSQL 11". Within that program group, launch "pgAdmin 4". This will launch the admin tool in your browser. It will ask for a master password. The password you remembered from earlier may not work, so you may need to reset the master password.

Create a PostgreSQL user

  1. Navigate to Servers -> Databases -> Login/Group Roles from the left-hand side tree control

  2. Right click on Login/Group Roles, select Create, and click on **Login/Group Roles… **

  3. In the dialog box, type ckan_default in Name field

  4. Click on the Definition tab and enter a user password

  1. Click on Privileges tab and enable the permission for Can login?

  1. Click Save

Create a PostgreSQL database

  1. Right click on Databases, select Create, and click Database…

  2. In the dialog box, type ckan_default in Database field

  3. In the dialog box, select ckan_default as the Owner

PostgreSQL initialization

The following steps must be completed by typing the commands in the Command Prompt.

  1. Open the development.ini file and edit line 47

sqlalchemy.url = postgresql://ckan_default:password@localhost/ckan_default

to replace password with the password you chose in step 3 above.

Notepad development.ini
  1. Create database tables
paster --plugin=ckan db init -c development.ini

You should see Initialising DB: SUCCESS

  1. Start ckan
paster --plugin=ckan serve development.ini

You should see serving on http://127.0.0.1:5000

  1. Open http://localhost:5000, and you should see the CKAN front page.

Reference: