Adding Solr config zip (ie. solr_8.x_config.zip) to your remote server. In this instance I'll be adding Solr config to a AWS EC2 server.
Log in to your remote server, then as you need to work as root type:
sudo su
Go to your solr directory:
cd /var/solr/
If you don't know the location of your solr directory run:
find / -name solr -type d
You can find more information about how to search on Terminal Commands Find.
Access your solr config directory through:
cd data/{dir}/conf or /var/solr/data/{dir}/conf
In this instance, the {dir} is related to the directory where the site is located. For example, the one I'm working on is staging /var/www/staging. At this location I'm running Drupal 9.
Before you upload the solr config.zip, remove all of the files in this directory.
Location: /var/solr/data/staging/conf
rm -rf ./*
Options, there are several ways you can tackle the next step. I will go through two options.
Option 1 : copy command
Upload the solr_8.x_config.zip to your server. You will most likely upload it to your site directory (for me /var/www/staging). Create a new temporary directory called solr-tmp. Upload/transfer the solr_8.x_config.zip to this directory and unzip it.
Current directory: /var/www/staging/solr-tmp
unzip solr_8.x_config.zip
Now you can copy the files to the /var/solr/data/{dir}/conf directory, while you are within the solr-tmp directory
sudo cp ./* {destination_dir}
In this instance the destination_dir is /var/solr/data/staging/conf
sudo cp ./* /var/solr/data/staging/conf
Go across to your destination directory and check the files have been copied across.
cd /var/solr/data/staging/conf
Check by using the list command
ls -al
Option 2 : Unzip in destination directory
Upload the solr_8.x_config.zip to your server. You will most likely upload it to your site directory (for me /var/www/staging). Upload/transfer the solr_8.x_config.zip to this directory. Move the zip file to the destination directory.
Current directory: /var/www/staging
Destination directory: /var/solr/data/staging/conf
mv {file} {destination_dir} File : solr_8.x_config.zip mv "solr_8.x_config.zip" /var/solr/data/staging/conf
Unzip the file
unzip solr_8.x_config.zip
Check by using the list command
ls -al
Whether you have used option one or two, when you run the list command the owner will be root. The owner needs to be changed to solr. Do this by running:
sudo chown solr:solr ./*
Reload Solr
You have uploaded the Solr config file. Now you need to reload Solr. You can do this inside Drupal. Or easier, using the site IP address:
{ip_address:8983}
sample IP address: 12.345.67.890
12.345.67.890:8983
This action will load the Solr page. Click on Core Admin, select your environment, then click Reload.
Check current has changed from a cross to a tick... meaning Solr is good to go.