Apache Solr is an open source search platform written on Java. Solr provides full-text search, spell suggestions, custom document ordering and ranking, Snippet generation and highlighting. This tutorial will help you to install Apache Solr 8.5 on Ubuntu 19.10, 18.04, 17.10, 16.04, 14.04 systems. Install Apache Solr on CentOS, RedHat. Installing CKAN from package¶ This section describes how to install CKAN from package. This is the quickest and easiest way to install CKAN, but it requires Ubuntu 18.04 (Python 2) or 20.04 (Python 3 or Python 2) 64-bit.
Apache Solr is an open source search platform written on Java. Solr provides full-text search, spell suggestions, custom document ordering and ranking, Snippet generation and highlighting. This tutorial will help you to install Apache Solr 8.5 on Ubuntu 19.10, 18.04, 17.10, 16.04, 14.04 systems.
Step 1 – Install Java
Apache Solr 7 required Java 8 or greater to run. Make sure your system fulfill Java requirements of Apache Solr. If you don’t have java installed on your system visit below articles.
Verify active Java version:
You can also follow this tutorial to install Java on Ubuntu Linux.
Step 2 – Install Apache Solr on Ubuntu
Now download the required Solr version from its official site or mirrors. Or simply use the following command to download Apache Solr 8.5.2.
Now extract Apache Solr service installer shell script from the downloaded Solr archive file and run the installer using the following commands.
Step 3 – Start / Stop Solr Service
Solr is configured as a service on your system. You can simply use the following commands to Start, Stop and check the status of Solr service.
Step 4 – Create First Solr Collection
After the successful installation of Solr on your system. Create the first collection in Apache Solr using the following command.
Sample output:
Step 5 – Access Solr Admin Panel
Default Solr runs on port 8983. You can access Solr port in your web browser using server IP or domain name pointed to that server and you will get Solr dashboard.
Now, select “MyCol1” under core selector drop down in left sidebar
Here you can view statics of created collection in previous steps named “mycol1”. Click on “Core Selector” on the left sidebar and select created collection.
This section describes how to install CKAN from package. This is the quickestand easiest way to install CKAN, but it requires Ubuntu 18.04 (Python 2) or 20.04 (Python 3 or Python 2) 64-bit. Ifyou’re not using any of these Ubuntu versions, or if you’re installing CKAN fordevelopment, you should follow Installing CKAN from source instead.
At the end of the installation process you will end up with two running webapplications, CKAN itself and the DataPusher, a separate service for automaticallyimporting data to CKAN’s DataStore extension. Additionally, there will be a process running the worker for running Background jobs. All these processes will be managed by Supervisor.
For Python 3 installations, the minimum Python version required is 3.6.
- Ubuntu 20.04 includes Python 3.8 as part of its distribution
- Ubuntu 18.04 includes Python 3.6 as part of its distribution
Host ports requirements:
Service | Port | Used for |
---|---|---|
NGINX | 80 | Proxy |
uWSGI | 8080 | Web Server |
uWSGI | 8800 | DataPusher |
Solr/Jetty | 8983 | Search |
PostgreSQL | 5432 | Database |
Redis | 6379 | Search |
1. Install the CKAN package¶
On your Ubuntu system, open a terminal and run these commands to installCKAN:
Update Ubuntu’s package index:
Install the Ubuntu packages that CKAN requires (and ‘git’, to enable you to install CKAN extensions):
Note
If you want to install CKAN 2.9 running on Python 2 for backwards compatibility, you need to also install the Python 2 libraries:
Download the CKAN package:
On Ubuntu 18.04:
On Ubuntu 20.04, for Python 3 (recommended):
On Ubuntu 20.04, for Python 2:
Install the CKAN package:
On Ubuntu 18.04:
On Ubuntu 20.04, for Python 3:
On Ubuntu 20.04, for Python 2:
2. Install and configure PostgreSQL¶
Tip
You can install PostgreSQL and CKAN on different servers. Justchange the sqlalchemy.url setting in your/etc/ckan/default/ckan.ini file to reference your PostgreSQL server.
Note
The commands mentioned below are tested for Ubuntu system
Install PostgreSQL, running this command in a terminal:
orphan: |
---|
Note
If you are facing a problem in case postgresql is not running,execute the command sudoservicepostgresqlstart
Check that PostgreSQL was installed correctly by listing the existing databases:
Check that the encoding of databases is UTF8
, if not you might find issues lateron with internationalisation. Since changing the encoding of PostgreSQL may meandeleting existing databases, it is suggested that this is fixed before continuing withthe CKAN install.
Next you’ll need to create a database user if one doesn’t already exist.Create a new PostgreSQL user called ckan_default, and enter apassword for the user when prompted. You’ll need this password later:
Create a new PostgreSQL database, called ckan_default, owned by thedatabase user you just created:
Note
If PostgreSQL is run on a separate server, you will need to editpostgresql.conf and pg_hba.conf. On Ubuntu, thesefiles are located in etc/postgresql/{Postgres version}/main.
Uncomment the listen_addresses parameter and specify a comma-separatedlist of IP addresses of the network interfaces PostgreSQL should listen onor ‘*’ to listen on all interfaces. For example,
listen_addresses='localhost,192.168.1.21'
Add a line similar to the line below to the bottom of pg_hba.conf toallow the machine running the web server to connect to PostgreSQL. Please changethe IP address as desired according to your network settings.
hostallall192.168.1.22/32md5
Edit the sqlalchemy.url option in your CKAN configuration file (/etc/ckan/default/ckan.ini) file andset the correct password, database and database user.
3. Install and configure Solr¶
Tip
You can install Solr and CKAN on different servers. Justchange the solr_url setting in your/etc/ckan/default/ckan.ini /etc/ckan/default/production.ini file to reference your Solr server.
Install Solr, running this command in a terminal:
orphan: |
---|
CKAN uses Solr as its search platform, and uses a customized Solr schema filethat takes into account CKAN’s specific search needs. Now that we have CKANinstalled, we need to install and configure Solr.
Note
These instructions explain how to deploy Solr using the Tomcat webserver, but CKAN doesn’t require Tomcat - you can deploy Solr to another webserver, such as Jetty, if that’s convenient on your operating system.
Change the default port Tomcat runs on (8080) to the one expected by CKAN. To do so change the following line in the
/etc/tomcat9/server.xml
file (tomcat8
in older Ubuntu versions):Note
This is not required by CKAN, you can keep the default Tomcat port or use a different one, just make sure to update the solr_url setting in your CKAN configuration file accordingly.
Replace the default
schema.xml
file with a symlink to the CKAN schemafile included in the sources.Now restart Solr (use
tomcat8
on older Ubuntu versions):Check that Solr is running by opening http://localhost:8983/solr/
Note
On Ubuntu 18.04 and older, instead of the Solr UI you may see an Internal Server Error page with a message containing:
This is caused by a bug and you need to run some extra commands to fix it:
Finally, change the solr_url setting in your CKAN configuration file (/etc/ckan/default/ckan.ini) to point to your Solr server, for example:
4. Update the configuration and initialize the database¶
Edit the CKAN configuration file (/etc/ckan/default/ckan.ini) to set up the following options:
- site_id
Each CKAN site should have a unique
site_id
, for example:- site_url
Provide the site’s URL. For example:
Initialize your CKAN database by running this command in a terminal:
Optionally, setup the DataStore and DataPusher by following theinstructions in DataStore extension.
Also optionally, you can enable file uploads by following theinstructions in FileStore and file uploads.
5. Start the Web Server and restart Nginx¶
Reload the Supervisor daemon so the new processes are picked up:
After a few seconds run the following command to check the status of the processes:
You should see three processes running without errors:
If some of the processes reports an error, make sure you’ve run all the previous steps and check the logs located in /var/log/ckan
for more details.
Restart Nginx by running this command:
6. You’re done!¶
Open http://localhost in your web browser. You should see the CKAN frontpage, which will look something like this:
You can now move on to Getting started to begin using and customizingyour CKAN site.
Install Solr Windows 10
Note
Apache Solr Vs Apache Lucene
The default authorization settings on a new install are deliberatelyrestrictive. Regular users won’t be able to create datasets or organizations.You should check the Organizations and authorization documentation, configure CKAN accordinglyand grant other users the relevant permissions using the sysadmin account.