-
Notifications
You must be signed in to change notification settings - Fork 18
Data Portal installation on Ubuntu 18.04
Tested with CKAN 2.8.3 on Ubuntu 18.04.3
- Install Python 2.7
sudo apt-get install python-dev python-pip
- Install
virtualenv
to manage your Python environments
sudo apt-get install python-virtualenv
- install Git
sudo apt-get install git-core
- Set your name (replace
Your Name
with your first and last name, e.g.,Reuben Cummings
)
git config --global user.name "Your Name"
- Set your commit email address (replace
your@email.address
with your email address, e.g.,reubano@gmail.com
).
Note: This should be the same email address you used to signup for your GitHub account
git config --global user.email "your@email.address"
- Check that both configurations have been set correctly
git config --global --list
- install
sudo apt-get install postgresql libpq-dev
- install libmagic
sudo apt-get install libmagic-dev
- In the top-right corner of the repo page, click Fork.
-
On GitHub, navigate to your fork of the data-portal repository, e.g.,
https://github.com/yourusername/data-portal
-
Under the repository name, click Clone or download
- In the Clone with HTTPs section, click the clipboard icon to copy the clone URL for the repository.
- Create a directory to hold the cloned project
mkdir -p ~/Documents/Projects
cd ~/Documents/Projects
-
Type
git clone
, and then paste the URL you copied in step 3 above. It will look likegit clone https://github.com/YOUR-USERNAME/data-portal
, but with your GitHub username instead ofYOUR-USERNAME
-
Press Enter. Your local clone will be created.
- Create and activate a virtual environment
cd data-portal
virtualenv --no-site-packages --python=python2.7 venv
source venv/bin/activate
- Install required Python libraries
pip install -r requirements.txt -r dev-requirements.txt
- Start the server
sudo service postgresql start
- Create a PostgreSQL user
sudo -u postgres createuser -U postgres ckan_default
- By default, the user will be created without a password, so you need to create one.
sudo -u postgres psql -c "ALTER USER ckan_default WITH PASSWORD 'your_password';"
- Open the
development.ini
file and edit line 47, replacingpassword
with the password you have created in step 3.
sqlalchemy.url = postgresql://ckan_default:password@localhost/ckan_default
- Create a PostgreSQL database
sudo -u postgres createdb -U postgres -O ckan_default ckan_default -E utf-8
- Create database tables
paster --plugin=ckan db init -c development.ini
You should see Initialising DB: SUCCESS
message.
- Start ckan
paster --plugin=ckan serve development.ini
You should see serving on http://127.0.0.1:5000
message.
- Open http://127.0.0.1:5000 in your browser and you should see the CKAN front page.
Reference:
Going forward, whenever you want to be able to open CKAN page in your browser you will need to have your PostgreSQL and your CKAN services to be running. This means that you will need to run the two commands from Step 1 and Step 7 in your CLI from your local data-portal
directory.
sudo service postgresql start
paster --plugin=ckan serve development.ini
(read more about how to work with CKAN CLI here)
After running these two commands keep your CLI window open for the duration of time while you are browsing the CKAN page.
When you are done browsing just close the page and if you don't need the PostgreSQL service to be up, run the command to stop the service.
sudo service postgresql stop