Opennms compilation in Linux
1.1 source code compilation 1.1.1 get source code
You can obtain the source code of the corresponding version from the official website or Github. download the latest stable version 14.0.3 as needed. We recommend that you download this version. The details are as follows.
Website |
URL |
OpenNMS Official Website |
Http://sourceforge.net/projects/opennms/files/OpenNMS-Source/old/opennms-source-14.0.3-1.tar.gz |
GitHub |
Https: // github.com/OpenNMS/opennms |
After the download is complete, copy it to the opt directory and decompress it with the following command.
Tar-zxvf opennms-source-14.0.3-1.tar.gz |
Then go to the opennms root directory and modify pennms-14.0.3-1 permissions. As follows.
Chmod-R 777/opt/opennms-14.0.3-1 /* |
1.1.2 uninstall OpenJDK in the compiling environment 1.1.2.1
Since Sun's jdk is recommended for OpenNMS, You Need To uninstall the built-in OpenJDK as follows.
1. First, you need to check which version of OpenJdk is currently installed, and enter java-version, as shown below.
# Java-version Java version "1.6.0 _ 45" Java (TM) SE Runtime Environment (build 1.6.0 _ 45-b06) Java HotSpot (TM) 64-Bit Server VM (build pipeline 45-b01, mixed mode) |
2. Uninstall OpenJdk and enter the following command.
#rpm -qa|grep jdk # Rpm-e -- nodeps java-1.6.0-openjdk-1.6.0.0-1.62.1.11.11.90.el6_4.x86 _ 64 #Rpm-e -- nodepsJava-1.7.0-openjdk-1.7.0.25-2.3.10.4.el6_4.x86_64 #Rpm-e -- nodepsTzdata-java-2013c-2.el6.noarch. |
3. Enter Java-version again. If this command is not displayed, it indicates that it has been uninstalled.
1.1.2.2 install Sun Jdk
.
1. First, run the command in the/usr/java directory to decompress the jdk installation package.
Tar-zxvf jdk-7u55-linux-x64.tar.gz |
2. Open the/etc/profile file and add the content to configure jdk environment variables.
Export JAVA_HOME =/usr/java/jdk1.7.0 _ 55 ExportCLASSPATH =.: $ JAVA_HOME/jre/lib/rt. jar: $ JAVA_HOME/lib/ Dt. jar: $ JAVA_HOME/lib/tools. jar Export PATH = $ PATH: $ JAVA_HOME/bin |
3. Save the preceding changes and exit. immediately execute the source/etc/profile command to make the changes take effect.
4. Run the java-version command to check whether jdk is successfully installed.
1.1.2.3 configure Maven
Because OpenNMS already comes with the Maven environment, it is used directly by default in the opennms root directory.
1. The following command configures the Maven path to the system environment variables;
Export M2_HOME =/opt/opennms-14.0.3-1/maven Export PATH = $ PATH: $ JAVA_HOME/bin: $ M2_HOME/bin |
2. after the above configuration is complete, if you need to put the address (/root /. m2), you can enter the/opt/opennms-14.0.3-1/maven/conf settings. in the xml file, the red part is the default address, as shown below;
3. Save the preceding changes and exit. immediately execute the source/etc/profile command to make the changes take effect.
4. Run the mvn-version command to check whether Maven is successfully installed. If version information is displayed, the installation is successful. If no version information is displayed, check the specific configuration information.
1.1.3 compile the project
1. First, clear the built-in compilation cache in the source code, enter the source code root directory, and execute the./clean. pl Command.
2. The red part indicates that the image is successfully cleared.
3. If the command line does not show the above information, it indicates that the Clean operation fails. Modify the information as prompted, and then run the Clean command again until the prompt is successful.
4. After step 3 is complete, run the./compile. pl Command to compile the file.
5. If the red part appears, the compilation is successful.
6. if the compilation fails, it is generally because the dependent package cannot be downloaded. You can re-compile the package, or manually download the dependent package and put it into the corresponding directory of the maven repository. The package is compiled multiple times until it is successful.
7. After the compilation is complete, you need to package the compiled files. Run the following command:
./Assemble. pl-Dopennms. home =/opt/opennms Note:/opt/opennms is the directory for deployment. |
8. If the red part appears, the project is successfully packaged.
Note: There are differences between the red version and the actual version.
9. According to the above prompt, find opennms-14.0.3.tar.gz in the root directory of opennms/target, which is an installable file.