Installing Java-8

Ref: install-oracle-jdk-in-ubuntu

StepAction

1) Update and Upgrade OS
and get Oracle JDK

Java version

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

JDK 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/

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

sudo mkdir /usr/lib/jvm

3) Extracting JDK

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


sudo vi /etc/environment
/etc/environnement
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.

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.


update-alternatives --list java
update-alternatives --list javac

7) Validate

Restart

Test the installation

java -version

# Sample answer
java 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

sudo apt-get update

2) Download Maven

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

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.

sudo vi /etc/profile.d/maven.sh
/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}
sudo chmod +x /etc/profile.d/maven.sh

5) Configuring environment variables


sudo vi /etc/environment
/etc/environnement
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

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

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"

3- Installing Solr

Ref: Apache installing-solr et Installing+VIVO 1.11.0 - section Install Solr

StepAction

1) Download Solr and unzipping

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

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

3) Installing the program

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

sudo vi /etc/systemd/system/solr.service

/etc/systemd/system/solr.service
[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

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
sudo systemctl enable solr
sudo reboot -f
http://x.x.x.x.x:8983/solr/


4- Installing GIT

StepAction

1) Installing GIT

sudo apt update
sudo apt install git

2) Verify the installation

git --version
# output
git version 2.17.1

Next

You can now proceed to the next process

  • No labels