Installing on Ubuntu

This guide details the prerequisites and steps to install SearchBlox on Ubuntu

To install SearchBlox on Ubuntu, follow the steps below to set up the prerequisites and configure the system for optimal performance. This guide assumes you are using an EC2 instance or a similar Ubuntu environment.

Prerequisites

🖥️

Note

Recommended EC2 instance type is t3a.xlarge.

  1. Install OpenJDK 21:
    SearchBlox requires Java to run. Install OpenJDK 21 using the following commands:

    sudo apt install openjdk-21-jdk
    

    Verify the Installation:

    java -version
    

    Ensure the output shows OpenJDK 21.

  2. Install wget:
    wget is required to download files from the internet. Install it using:

    sudo apt-get update
    sudo apt-get install wget
    
  3. Install Dependencies for Dynamic Auto Collection Crawler:
    Install the following libraries:

    sudo apt-get install libxkbcommon0 libgbm1
    
  4. Set vm.max_map_count:
    Edit the /etc/sysctl.conf file to set the vm.max_map_count value:

    sudo vi /etc/sysctl.conf
    

    Add the following line:

    vm.max_map_count=262144
    

    Apply the changes:

    sudo sysctl -p
    
  5. Increase File Descriptor Limit:
    Edit the /etc/sysctl.conf file to increase the file descriptor limit

    sudo vi /etc/sysctl.conf
    

    Add the following line:

    fs.file-max=100000
    

    Apply the changes:

    sudo sysctl -p
    

  1. Set ulimit Values:
    Edit the /etc/security/limits.conf file to set soft and hard limits:
    sudo vi /etc/security/limits.conf
    
    Add the following lines
    *          soft      nofile     100000
    *          hard      nofile     100000
    

  2. Enable pam_limits
    Edit the /etc/pam.d/common-session file:
    sudo vi /etc/pam.d/common-session
    
    Add the following line
    session required pam_limits.so
    


  1. Reboot the Server:
    Reboot the server to apply all changes:
    sudo reboot
    
  2. Verify ulimit Settings:
    After rebooting, verify the ulimit settings:
    ulimit -a
    ulimit -Sn  # Check soft limit
    ulimit -Hn  # Check hard limit
    

SearchBlox Installation

  1. Login as Root:
    If you are not the root user, switch to the root user

    sudo su
    
  2. Create a SearchBlox User:
    Create a dedicated user for SearchBlox. Follow the prompts to set a password and provide necessary details.

    sudo adduser searchblox
    
  3. Navigate to the /opt Directory:
    SearchBlox must be installed in the /opt folder. Change to the /opt directory:

    cd /opt
    
  4. Download the SearchBlox Debian Package:
    Download the SearchBlox Debian package using wget:

    sudo wget https://d2fco3ozzrfhhd.cloudfront.net/v11.0.3/searchblox_11.0.3-0_all.deb
    
  5. Install the Debian Package:
    Install the downloaded package using dpkg:

    sudo dpkg -i searchblox_11.0.3-0_all.deb
    

  6. Set Permissions:
    Change ownership and permissions for the SearchBlox directories:

    sudo chown -R searchblox:searchblox /opt/searchblox
    sudo chmod -R 755 /opt/searchblox/bin
    sudo chmod -R 755 /opt/searchblox/opensearch/
    sudo chmod -R 755 /opt/searchblox/logs
    sudo chmod -R 755 /opt/searchblox/connectors
    
  7. Install and Run SearchAI PrivateLLM:
    Follow the instructions in the SearchAI PrivateLLM documentation to install and run the SearchAI PrivateLLM and ollama.service.

  8. Start the SearchBlox Service:
    Start the SearchBlox service using systemctl:

    systemctl start searchblox
    
  9. To stop SearchBlox service, use

    systemctl stop searchblox
    

    To Check the Status of the SearchBlox Service:

    systemctl status searchblox
    

Troubleshooting

  1. Installation Errors:
    If the dpkg installation fails due to missing dependencies, run:sudo apt-get install -f
    Then retry the installation:
    sudo apt-get install -f
    sudo dpkg -i searchblox_11.0.3-0_all.deb
    

  2. Service Not Starting:
    Check the logs for errors:
    journalctl -u searchblox
    
    Ensure all prerequisites (e.g., Java, file permissions) are correctly configured.
  3. Port Conflicts:
    Ensure port 8443 is not being used by another application. You can check using:
    sudo netstat -tuln | grep 8443
    


Verify Installation

  1. Access the SearchBlox Admin Console:
    Wait for 30-60 seconds after starting the SearchBlox service.
    Open a web browser and navigate to:
https://localhost:8443/console

If accessing remotely, replace localhost with the server's IP address or hostname:

https://<server-ip>:8443/console
  1. Log in to the Admin Console:
    Use the default credentials (usually admin for both username and password).
    If you’ve changed the credentials, use the updated username and password.
  2. Verify the Service Status:
    If the Admin Console loads successfully, the SearchBlox service is running correctly.

Check the Status Log File

  1. Navigate to the Logs Directory:
    The status log file is located at:
/opt/searchblox/webapps/ROOT/logs/status.log
  1. View the Log File:
    Use the following command to view the log:
cat /opt/searchblox/webapps/ROOT/logs/status.log
  1. Confirm Successful Startup:
    Look for the message:
SearchBlox Started
  1. Troubleshoot Errors:
    If the service fails to start, the status.log file will contain error messages or warnings that can help identify the issue.
    Common issues include:
    • Port conflicts (ensure port 8443 is free).
    • Incorrect file permissions (verify permissions for /opt/searchblox).
      Verify that the /opt/searchblox directory and its subdirectories have the correct permissions:
      sudo chown -R searchblox:searchblox /opt/searchblox
      sudo chmod -R 755 /opt/searchblox
      
    • Missing dependencies (ensure Java and other prerequisites are installed).

Additional Resources

🚧

SearchBlox Admin Console Access using IP Address or Domain Name

  1. Using IP Address:
    Replace localhost with your server's IP address in the URL:
    https://<your-server-ip>:8443/console
    
  2. Using Domain Name:
    If a domain name is mapped to your server's IP address, use the domain name in the URL:
    https://exampledomain:8443/console
    

Important Notes

  • Port Number: By default, SearchBlox uses port 8443. Ensure this port is open and accessible in your firewall or security group (if using a cloud instance like AWS EC2).
  • HTTPS: SearchBlox uses HTTPS for secure communication. Ensure your browser trusts the SSL certificate (self-signed certificates may require manual approval).
  • Domain Configuration: If using a domain name, ensure the DNS records are correctly configured to point to your server's IP address

Steps to Install and Run SearchAI PrivateLLM

To install and run SearchAI PrivateLLM after completing the SearchBlox installation, follow the steps below. This process involves downloading the PrivateLLM Models, setting up the ollama.service, and starting the service.

  1. Download the Models Folder:
    Download the PrivateLLM Models from the provided link:
    SearchAI PrivateLLM Models
    Extract the downloaded models folder.
  2. Replace the Models Folder:
    Navigate to the /opt/searchblox/ollama/models directory and replace the existing models folder with the downloaded one.
    cd /opt/searchblox/ollama/models
    
  3. Create the ollama.service File:
    1. Navigate to the /etc/systemd/system/ directory:
    cd /etc/systemd/system/
    
    1. Create a new service file named ollama.service:
    sudo vi /etc/systemd/system/ollama.service
    

Add the following script to the ollama.service file:

[Unit]
Description=Ollama Service
After=network-online.target
[Service]
WorkingDirectory=/opt/searchblox/ollama/bin
ExecStart=/opt/searchblox/ollama/bin/ollama serve
User=root
Group=root
Restart=always
RestartSec=3
Environment="OLLAMA_MODELS=/opt/searchblox/ollama/models/"
[Install]
WantedBy=default.target

Then save and exit the file.

  1. Set Execute Permissions:
    Provide execute permissions for the ollama.service file:
    sudo chmod 755 /etc/systemd/system/ollama.service
    
    Also, set execute permissions for the ollama binary:
    sudo chmod 755 /opt/searchblox/ollama/bin/ollama
    

  2. Reload Systemd Daemon:
    Reload the systemd daemon to apply the new service file:
    sudo systemctl daemon-reload
    
  3. Start the Ollama Service:
    sudo systemctl start ollama
    
  4. Verify the Models:
    Check the list of available models by running:
    ./opt/searchblox/ollama/bin/ollama list
    
  5. Download the Model:
    Download the model using the command below:
    ./opt/searchblox/ollama/bin/ollama pull qwen2.5
    
  6. Stop the Ollama Service (Optional):
    To stop the ollama service, use:
    sudo systemctl stop ollama
    
  7. Enable Auto-Start on Reboot:
    To ensure the ollama service starts automatically on system reboot, enable it:
    sudo systemctl enable ollama
    

Change SearchBlox Server Port

To change the SearchBlox Server port from the default 8443 to a different port (e.g., 443), follow the steps below. This process involves editing the configuration file and restarting the SearchBlox service.

  1. Stop the SearchBlox Service:

    sudo systemctl stop searchblox
    
  2. Edit the https.ini File:
    Open the https.ini file located in the /opt/searchblox/start.d/ directory:

    sudo vi /opt/searchblox/start.d/https.ini
    
  3. Set the New Port Number:
    Add or update the following line in the https.ini file to specify the new port number. Replace 443 with your desired port number.

    jetty.ssl.port=443
    
  4. Start the SearchBlox Service:

    sudo systemctl start searchblox
    
  5. Verify the New Port:
    Wait for 30-60 seconds, then access the SearchBlox Admin Console using the new port:

    https://<your-server-ip>:443/console
    

    Replace 443 with the port number you configured.

Important Notes

Secure Ports: Ensure the new port is a secure port (e.g., 443 for HTTPS). Refer to the Secure Ports used by SearchBlox section for more details.

Firewall Configuration: If using a firewall or cloud security group, ensure the new port is open for inbound traffic.

Port Conflicts: Verify that the new port is not already in use by another application. You can check using:

sudo netstat -tuln | grep <port-number>

🚧

Port Update

Fix the permission denied error while using searchblox service on less than ports 1024, run the below commands:
Check the Java Path

readlink -f $(which java)

Set the capability to bind low ports for non-root searchblox user.

setcap cap_net_bind_service+ep <javapath>

Uninstall

  1. First Stop the SearchBlox, by running the command:
    systemctl stop searchblox

  2. Run the following command to uninstall or remove SearchBlox:
    apt-get remove searchblox

  3. To remove the user, run the command;
    userdel searchblox

  4. Reboot the server:
    reboot

Note: For clean SearchBlox uninstallation, it is required to remove searchblox directory i.e., /opt/searchblox manually by running the following command:
rm -rf /opt/searchblox

Disk Encryption

🚧

Additional Disk is required for disk encryption

  1. Installation of cryptsetup for Ubuntu:
    sudo apt-get install cryptsetup

  2. LUKS Format disk
    Note: while formatting the disk we have to give some password
    cryptsetup luksFormat /dev/sdb

WARNING!
========
This will overwrite data on /dev/sdb irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
  1. Luks open
    Note: We have to use the password created earlier while formatting the disk.
    cryptsetup luksOpen /dev/sda data
Enter passphrase for /dev/sdb:
  1. Create a filesystem
    mkfs -t ext4 /dev/mapper/data
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 52428288 4k blocks and 13107200 inodes
Filesystem UUID: 1c71b0f4-f95d-46d6-93e0-cbd19cb95edb
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
  1. Mounting the new file system at /opt
    mount /dev/mapper/data /opt
  2. To get UUID
    blkid /dev/mapper/data
/dev/mapper/data: UUID="0a228c13-06d8-4739-99c3-f596c2dcce8e" TYPE="ext4"
  1. We need to add the UUID into /etc/fstab like this and save it
    Note: We need to add the UUID into etc/fstab file
LABEL=cloudimg-rootfs   /        ext4   defaults,discard        0 0
UID="4539b70d-66ab-4c07-b2a2-d4583f461a2f"   /secret   ext4 defaults 0 0
UID="4539b70d-66ab-4c07-b2a2-d4583f461a2f"   /opt      ext4 defaults 0 0
UUID="0a228c13-06d8-4739-99c3-f596c2dcce8e"   /opt  ext4  defaults 0  0
===================================================
  • To close encryption
    cryptsetup luksClose /dev/mapper/data
  • To open encryption
    cryptsetup luksOpen /dev/mapper/data

📘

NOTE:

If you face any trouble in starting opensearch and in logs if you find the error as Opensearch status RED follow the steps given here:

  • Set the OPENSEARCH_JAVA_HOME by running the following command:
  • If you have installed java from Prerequisites section, use the below command:
  • export OPENSEARCH_JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
  • If java is installed in different path, change the value.
  • export OPENSEARCH_JAVA_HOME=<java installation path>