Install OpenJDK
Check for any pre-installed Java packages:
rpm -qa | grep -E 'java|jdk|gcj'
If found, remove them forcefully:
rpm -qa | grep java | xargs sudo rpm -e --nodeps
List available OpenJDK 8 packages in the yum repository:
yum list java-1.8*
Install OpenJDK 8:
sudo yum install java-1.8.0-openjdk -y
Set environment variables by editing /etc/profile:
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH
Apply the changes:
source /etc/profile
Verify the installation:
echo $JAVA_HOME
java -version
Configure Hostname and Domain Mapping
Set the system hostname (e.g., consul) in /etc/hostname:
echo consul | sudo tee /etc/hostname
Add a entry to /etc/hosts to map the IP address to the hostname:
echo "192.168.0.101 consul" | sudo tee -a /etc/hosts
Install Python and pip
Enable the EPEL repository and install Python pip:
sudo yum install epel-release -y
sudo yum install python-pip -y
Install Apache Maven
Download and extract Maven:
curl -O https://archive.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
sudo tar -zxvf apache-maven-3.6.2-bin.tar.gz -C /usr/local/
Configure Maven enviroment variables in /etc/profile:
MAVEN_HOME=/usr/local/apache-maven-3.6.2
export MAVEN_HOME
export PATH=$PATH:$MAVEN_HOME/bin
Reload the profile and verify:
source /etc/profile
mvn -version
Create a local repository directory and set permissions:
sudo mkdir -p /usr/local/apache-maven-3.6.2/repository
sudo chmod -R 777 /usr/local/apache-maven-3.6.2/repository
Update settings.xml to use the custom repository path:
<localRepository>/usr/local/apache-maven-3.6.2/repository</localRepository>