Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

StepAction

1) Update and Upgrade OS
and get Oracle JDK

Warning
titleJava version

The current version of java-8 may vary. Please adapt the following settings to the current version


Info
titleJDK Alternative to Oracle JDK

Although it has not been tested with this solution, but you can probably use OpenJDK-8. If that is your choice, you can install Java with this command: "sudo apt install openjdk-8-jdk". You can check this page for more instructions: https://linuxize.com/post/install-java-on-ubuntu-18-04/



Code Block
languagebash
sudo apt update
sudo apt upgrade
sudo reboot -p -f

download Oracle JDK  (Example filename jdk-8u241-linux-x64.tar.gz) and upload the file /opt/Download

2) Creating workspace


Code Block
languagebash
sudo mkdir /usr/lib/jvm


3) Extracting JDK


Code Block
languagebash
cd /usr/lib/jvm
sudo tar xzf /opt/Download/jdk-8u241-linux-x64.tar.gz
sudo ln -s jdk1.8.0_241 current
sudo chown -R root:root jdk1.8.0_241


3) Setting up environment variables





Code Block
languagebash
sudo vi /etc/environment


Code Block
languagebash
title/etc/environnement
linenumberstrue
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/current/bin:/usr/lib/jvm/current/db/bin:/usr/lib/jvm/current/jre/bin"
J2SDKDIR="/usr/lib/jvm/current"
J2REDIR="/usr/lib/jvm/current/jre"
JAVA_HOME="/usr/lib/jvm/current"


5) Configuring the Java location

Enter the following commands to inform the system of the Java location.


Code Block
languagebash
linenumberstrue
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/current/bin/java" 0
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/current/bin/javac" 0
sudo update-alternatives --set java /usr/lib/jvm/current/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/current/bin/javac


6) To check the setup,

enter the following commands and make sure they indicate the location of java and javac as shown in the previous step.


Code Block
languagebash
linenumberstrue
update-alternatives --list java
update-alternatives --list javac

7) Validate

Restart

Test the installation


Code Block
languagebash
java -version

# Sample answer
java version -version"1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)


sudo reboot -f


2- Installing Maven

StepAction

1) Updating the OS


Code Block
languagebash
sudo apt-get update


2) Download Maven


Code Block
languagebash
sudo wget https://www-us.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /opt/Download
cd /opt/Download


3) Unzip Maven


Code Block
languagebash
sudo tar xvzf apache-maven-3.6.3-bin.tar.gz -C /opt
sudo chown -R root:root /opt/apache-maven-3.6.3


4) Configuring the Maven environment

To make sure that Maven works properly, you need to set a few environment variables, including JAVA_HOME, M3_HOME, MAVEN_HOME, and PATH.

To make this change, create a file named maven.sh in the /etc/profile.d/ directory.



Code Block
languagebash
sudo vi /etc/profile.d/maven.sh


Code Block
languagebash
title/etc/profile.d/maven.sh
export JAVA_HOME=/usr/lib/jvm/current
export M3_HOME=/opt/apache-maven-3.6.3
export MAVEN_HOME=/opt/apache-maven-3.6.3
export PATH=${M3_HOME}/bin:${PATH}


Code Block
languagebash
sudo chmod +x /etc/profile.d/maven.sh


5) Configuring environment variables




Code Block
languagebash
sudo vi /etc/environment


Code Block
languagebash
title/etc/environnement
linenumberstrue
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/current/bin:/usr/lib/jvm/current/db/bin:/usr/lib/jvm/current/jre/bin:/opt/apache-maven-3.6.3/bin"
J2SDKDIR="/usr/lib/jvm/current"
J2REDIR="/usr/lib/jvm/current/jre"
JAVA_HOME="/usr/lib/jvm/current"
MAVEN_HOME="/opt/apache-maven-3.6.3"


5) Check the installation

Info

If there is a problem, make shure that "/opt/apache-maven-3.6.3" is in $PATH of /etc/environment



Code Block
languagebash
source /etc/profile.d/maven.sh
mvn -version

# Sample answer
Maven home: /opt/apache-maven-3.6.3
Java version: 1.8.0_241, vendor: Oracle Corporation, runtime: /usr/lib/jvm/current/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.0.0-1027-azure", arch: "amd64", family: "unix"


...

StepAction

1) Download Solr and unzipping


Code Block
languagebash
cd /opt/Download
sudo wget https://archive.apache.org/dist/lucene/solr/7.7.2/solr-7.7.2.tgz -P /opt/Download


2) Create solr user


Code Block
languagebash
sudo mkdir -p /opt/solr
sudo groupadd solr
sudo useradd -s /bin/bash -g solr -d /opt/solr solr


3) Installing the program


Code Block
languagebash
sudo tar xzf solr-7.7.2.tgz -C /opt
sudo mv /opt/solr-7.7.2/* /opt/solr
sudo chown -R solr:solr /opt/solr


4) Installing solr as a service


Code Block
languagebash
sudo vi /etc/systemd/system/solr.service

Code Block
languagebash
title/etc/systemd/system/solr.service
linenumberstrue
[Unit]
Description=Solr 7.7.2 services
After=network.target

[Service]
Type=forking
User=solr
Group=solr

Environment="SOLR_HOME=/opt/solr/server/solr"

ExecStart=/opt/solr/bin/solr start -force
ExecStop=/opt/solr/bin/solr stop

[Install]
WantedBy=multi-user.target


5) Validate the solr service


Code Block
languagebash
sudo ufw allow 8983/tcp
sudo systemctl daemon-reload
sudo systemctl start solr
sudo systemctl status solr

# Sample answer
● solr.service - Solr 7.7.2 services
   Loaded: loaded (/etc/systemd/system/solr.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-11-28 12:23:23 UTC; 8s ago
  Process: 116789 ExecStart=/opt/solr/bin/solr start -force (code=exited, status=0/SUCCESS)
 Main PID: 116850 (java)
    Tasks: 41 (limit: 9246)
   CGroup: /system.slice/solr.service
           └─116850 java -server -Xms512m -Xmx512m -XX:NewRatio=3 -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=8 -XX

nov. 28 12:23:19 vivo-uqam solr[116789]: *** [WARN] *** Your open file limit is currently 1024.
nov. 28 12:23:19 vivo-uqam solr[116789]:  It should be set to 65000 to avoid operational disruption.
nov. 28 12:23:19 vivo-uqam solr[116789]:  If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in
nov. 28 12:23:19 vivo-uqam solr[116789]: *** [WARN] ***  Your Max Processes Limit is currently 30823.
nov. 28 12:23:19 vivo-uqam solr[116789]:  It should be set to 65000 to avoid operational disruption.
nov. 28 12:23:19 vivo-uqam solr[116789]:  If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in
nov. 28 12:23:23 vivo-uqam solr[116789]: [146B blob data]
nov. 28 12:23:23 vivo-uqam solr[116789]: Started Solr server on port 8983 (pid=116850). Happy searching!
nov. 28 12:23:23 vivo-uqam solr[116789]: [14B blob data]
nov. 28 12:23:23 vivo-uqam systemd[1]: Started Solr 7.7.2 services.
lines 1-19/19 (END)


6) Test the installation

http://x.x.x.x.x:8983 is the host server address of solr



Code Block
languagexml
sudo systemctl enable solr
sudo reboot -f
http://x.x.x.x.x:8983/solr/


...