Author: Jyun-Yao Huang (Allen; allen501pc@gmail.com)
System Environment: Ubuntu Linux 14.04 LTS (64bits)
1. Update the metadata of packages
$ sudo apt-get update |
2. Install apache2, nginx, apache’s module wsgi and the library of postgres- libpq5.
$ sudo apt-get install -y nginx apache2 libapache2-mod-wsgi libpq5 |
3. Download deb-package of python-ckan.
There are two ways to get CKAN deb package.
First, here you can download my provided deb package in the cloud storage. URL: https://drive.google.com/file/d/0B6PKt2-xNai_QlNfdEZfY05JRlE/view?usp=sharing
Or, download it from CKAN official site.
$ wget http://packaging.ckan.org/python-ckan_2.5-trusty_amd64.deb |
4. Install the package.
$ sudo dpkg -i python-ckan_2.5-trusty_amd64.deb |
5. Install postgresql.
$ sudo apt-get install postgresql |
6. Check the encoding format of Postgresql is UTF-8.
$ sudo -u postgres psql -l |
7. Create the database account and the corresponding database. In this case, the account is ckan_default and the database is also called ckan_default.
Please remember your password of your database account.
$ sudo -u postgres createuser -S -D -R -P ckan_default |
8. Edit the file at /etc/ckan/default/production.ini with super user’s permission. Check the settings below:
sqlalchemy.url = postgresql://ckan_default:pass@localhost/ckan_default |
9. Create the fold for CKAN storage. Type the following command to create storage.
$ sudo mkdir /var/lib/ckan |
10. Edit the file at /etc/ckan/default/production.ini with super user’s permission. Check the settings below:
ckan.storage_path = /var/lib/ckan |
11. Download Solr 5.4.1
Warning: Form the CKAN official guide, if you install solr-jetty in Ubuntu 14.04, the JSP of Solr will not be supported. We have to install Solr.
There are two ways to get Solr package.
First, here you can download my provided Solr package in the cloud storage. URL: https://drive.google.com/open?id=0B6PKt2-xNai_Tm9sSnJoZmx1VW8
Or download it from Solr's site.
$ wget http://apache.mirror1.spango.com/lucene/solr/5.4.1/solr-5.4.1.tg |
12. Install Solr 5.4.1
$ tar xzf solr-5.4.1.tgz solr-5.4.1/bin/install_solr_service.sh --strip-components=2 |
13. Prepare the CKAN’s schema for Solr
In this case, we prepare a core named ckan for Solr.
$ sudo su |
14. [Support of Chinese Segmentation] Download the libraries for supporting Chinese segmentation in Solr. There are two packages: mmseg4j-core-x.y.z.jar and mmseg4j-lang-x.y.z.jar to be downloaded. I’ve prepared the zipped file – mmseg4j.zip at https://drive.google.com/open?id=0B6PKt2-xNai_a1luR20wQ0JtenM.
15. [Support of Chinese Segmentation] After downloading mmseg4j.zip and unzipping it into mmseg4j-core-1.10.0.jar and mmseg4j-solr-2.3.0.jar, upload JARs under the folder - /opt/solr/server/solr-webapp/webapp/WEB-INF/lib.
16. [Support of Chinese Segmentation]Modify the schema file at /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml to let Solr support Chinese segmentation.
<fieldType name="text" class="solr.TextField" positionIncrementGap="100"> |
17. Restart Solr.
$ sudo service solr restart |
18. Serve the following URL to create the core called ckan via your browser.
http://127.0.0.1:8983/solr/admin/cores?action=CREATE&name=ckan&configSet=ckan
19. Edit the file at /etc/ckan/default/production.ini with super user’s permission. Check the setting for Solr below:
solr_url = http://127.0.0.1:8983/solr/ckan |
20. Initialize your database. We have to use VirtualEnv which is a virtual environment written in Python. Here, (virtualEnv) is the mark for denoting you are in VirtualEnv.
$ . /usr/lib/ckan/default/bin/activate |
21. Create Administrator for CKAN.
$ . /usr/lib/ckan/default/bin/activate |
22. Restart apache2 and nginx.
$ sudo service apache2 restart |
After that, you will get the following CKAN site.
Support of SSL
With the support of SSL, we can enhance the security of CKAN.
First, we have to apply for an SSL certificate. For freelancers, we can request the SSL certificate from Let’s Encrypt. The method of applying such certificate has been introduced in the official site of Let’s Encrypt. Interested readers can refers to its documents.
After getting an SSL certificate, please following the instructions in the post: Setting up CKAN with SSL.
REFERENCE
- CKAN, “Installing CKAN from Package,” CKAN. [Online]. Available: http://docs.ckan.org/en/latest/maintaining/installing/install-from-package.html
- CKAN, “Installing CKAN from Source,” CKAN. [Online]. Available: http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html
- Koen Vlasinkel, “How to Install Solr 5.2.1 on Ubuntu 14.04,” Digital Ocean Community. [Online]. Available: https://www.digitalocean.com/community/tutorials/how-to-install-solr-5-2-1-on-ubuntu-14-04
- Hvwaldow, “How to Upgrade to SOLR 5.3.1 on Debian Jessie for Use with CKAN,” CKAN. [Online]. Available: https://gist.github.com/hvwaldow/67fecf80a9790b5c9153#filesolr-upgrade-md
- CKAN2 安裝教學. URL: http://ckan-docs-tw.readthedocs.io/zh_TW/2.4/install.html
- CKAN, “Setting up CKAN with SSL,”. [Online]. Available: https://github.com/ckan/ckan/wiki/SSL
沒有留言:
張貼留言