Issues installing Teamcity on RHEL 7

I am preparing a new Teamcity server on RHEL 7. I am having trouble starting the Teamcity server with an error thrown by the agent.sh. The error is "./agent.sh: line 176: /bin/java/bin/java: Not a directory". When I inspect line 176 of the agent.sh I see the below code. I see no reason for the error whatsoever. If I ignore the error Teamcity never starts. I have tried a few tricks to work around this but with no prevail.

There appears to be something for a Linux installation to make Teamcity work that is missing from the instructions. I understand it is bundled with Tomcat so all I should need is Java. Why the installation is doubling the  /bin/java/bin/java directory in code when performing ./runAll.sh start is curious but as to the cause I cannot determine.

 

Line 176 from agent.sh

176         "$JRE_HOME/bin/java" $TEAMCITY_LAUNCHER_OPTS_ACTUAL -cp $TEAMCITY_LAUNCHER_CLASSPATH jetbrains.buildS        erver.agent.Check $TEAMCITY_AGENT_OPTS_ACTUAL jetbrains.buildServer.agent.AgentMain -file $CONFIG_FILE

 

How I am starting Teamcity with error shown

[root@teamcity bin]# ./runAll.sh start
Using CATALINA_BASE: /bin/TeamCity
Using CATALINA_HOME: /bin/TeamCity
Using CATALINA_TMPDIR: /bin/TeamCity/temp
Using JRE_HOME: /bin/java
Using CLASSPATH: /bin/TeamCity/bin/bootstrap.jar:/bin/TeamCity/bin/tomcat-juli.jar
Using CATALINA_PID: ../logs/teamcity.pid
Existing PID file found during start.
Removing/clearing stale PID file.
Tomcat started.
Starting TeamCity build agent...
Java executable is found in '/bin/java'.
./agent.sh: line 176: /bin/java/bin/java: Not a directory

 

Installation steps for RHEL

Step 1: Install Java and wget.
[root@teamcity ~]# yum install -y java-openjdk wget

Step 2: Check Java version
[root@teamcity ~]# java -version
openjdk version "1.8.0_144"
OpenJDK Runtime Environment (build 1.8.0_144-b01)
OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)

Step 3: Edit the default profile and append the file with the belo.
<pre>[root@teamcity /]# vi /etc/profile

export JAVA_HOME="/bin/java"</pre>

Step 4: Run the command to apply these changes immediately.
[root@teamcity /]# source /etc/profile

Step 5: Check the current Java home and verify the relevant Java path is referenced.
[root@teamcity tmp]# echo $JAVA_HOME
/bin/java

Step 6: Move to the tmp directory and download Teamcity.
[root@teamcity /]# cd /tmp/
[root@teamcity /]# wget https://download.jetbrains.com/teamcity/TeamCity-2017.1.4.tar.gz

Step 7: Extract Teamcity to /bin/ and make a logs directory.
[root@teamcity /]# tar -xf TeamCity-2017.1.4.tar.gz -C /bin/
[root@teamcity /]# mkdir /bin/TeamCity/logs

Step 8: Move to the bin folder in the TeamCity directory and start Teamcity.
[root@teamcity tmp]# cd /bin/TeamCity/bin/
[root@teamcity bin]# ./runAll.sh start

Step 9: Visit http://IP:8111 to use Teamcity.

0
1 comment

Hi,

$JAVA_HOME shouldn't contain the path to the java executable, but the path to the folder where java is installed (which is usually not /bin, there there's usually a symlink to the actual folder). bin is a subfolder of java's installation path, not /bin, and the java executable is found within this bin subfolder. That's why the $JAVA_HOME/bin/java resolves to /bin/java, because you have defined $JAVA_HOME as /bin/java. Obviously, this path doesn't exist.

Please, fix your $JAVA_HOME and try running it again.

0

Please sign in to leave a comment.