Install OpenJDK 21
Download the JDK binary:
wget https://mirrors.huaweicloud.com/openjdk/21/openjdk-21_linux-x64_bin.tar.gz
Extract and relocate to /usr/local:
sudo tar -xzf openjdk-21_linux-x64_bin.tar.gz -C /usr/local/
ls /usr/local/jdk-21/
Update system-wide environment variables by editing /etc/profile:
export JAVA_HOME=/usr/local/jdk-21
export PATH=$JAVA_HOME/bin:$PATH
Apply chenges and verify installation:
source /etc/profile
java --version
Configure Apache Maven 3.9.10
Download and extract Maven:
wget https://dlcdn.apache.org/maven/maven-3/3.9.10/binaries/apache-maven-3.9.10-bin.tar.gz
sudo tar -xzf apache-maven-3.9.10-bin.tar.gz -C /usr/local/
Add Maven to your environment in /etc/profile:
export MAVEN_HOME=/usr/local/apache-maven-3.9.10
export PATH=$PATH:$MAVEN_HOME/bin
Customize Maven settings by editing $MAVEN_HOME/conf/settings.xml:
<localRepository>/usr/local/mvn-repo</localRepository>
<mirror>
<id>aliyun-central</id>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
Reload profile and test:
source /etc/profile
mvn --version
Compile and Install Git 2.28 from Source
Remove any outdated version:
sudo yum remove git -y
Install build dependencies:
sudo yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Download and compile Git:
wget https://www.kernel.org/pub/software/scm/git/git-2.28.0.tar.xz
tar -xf git-2.28.0.tar.xz
cd git-2.28.0
make prefix=/usr/local all
sudo make prefix=/usr/local install
Update PATH and verify:
echo 'export PATH="/usr/local/bin:$PATH"' >> /etc/profile
source /etc/profile
git --version
Deploy Jenkins via Docker
Pull the official Jenkins image:
docker pull jenkins/jenkins:lts
Create persistent volume directory:
sudo mkdir -p /var/jenkins_data
sudo chmod 777 /var/jenkins_data
Launch container with port mapping and volume mounts:
docker run -d \
--name ci-server \
-p 8080:8080 \
-p 50000:50000 \
-v /var/jenkins_data:/var/jenkins_home \
-v /etc/localtime:/etc/localtime:ro \
jenkins/jenkins:lts
Verify container status and view startup logs:
docker ps
docker logs ci-server
Access Jenkins at http://<server-ip>:8080 after retrieving the initial admin password from logs.