Deployment of pure domestic environment (Galaxy Kirin + Feiteng) JAVA program (Springboot + Mybatis + Damon database)

JAVA program deployment

preface

Operating environment: Galaxy Kirin + Feiteng CPU
Project framework: Springboot + Mybatis + Dameng database jdk1 eight

The last one wrote the source code of the project, and this one mainly wrote the deployment of the project on the domestic operating system and the installation and creation of Dameng database on the domestic operating system.

To view the source code of the project, please click the link
JAVA program construction in pure domestic environment (Springboot + Mybatis + Damon database)

Pack Project

Modify pom file: (annotate the generator plug-in and release the resources required for packaging)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>2.0.1</version>
    <name>demo</name>
    <packaging>jar</packaging>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>dm</groupId>
            <artifactId>dm.jdbc.driver</artifactId>
            <version>8.1.1</version>
        </dependency>

        <!-- druid Data source driven -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.10</version>
        </dependency>
        <!-- mybatis -->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!-- currency mapper -->
        <dependency>
            <groupId>tk.mybatis</groupId>
            <artifactId>mapper-spring-boot-starter</artifactId>
            <version>1.1.7</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>7.10.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <!--for build jar-->
                    <mainClass>com.example.DemoApplication</mainClass>
                    <layout>ZIP</layout>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <!--<plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.5</version>
                <dependencies>
                    &lt;!&ndash;for mysql&ndash;&gt;
                    &lt;!&ndash;<dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                    </dependency>&ndash;&gt;
                    &lt;!&ndash;for oracle&ndash;&gt;
                    <dependency>
                        <groupId>com.dm</groupId>
                        <artifactId>DmJdbcDriver</artifactId>
                        <version>1.8.0</version>
                        <scope>system</scope>
                        <systemPath>${project.basedir}/src/main/resources/lib/DmJdbcDriver18-8.1.1.193.jar</systemPath>
                    </dependency>
                    <dependency>
                        <groupId>tk.mybatis</groupId>
                        <artifactId>mapper</artifactId>
                        <version>3.4.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>Generate MyBatis Artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                    <configurationFile>src/main/resources/config/mybatis-generator.xml</configurationFile>
                </configuration>
            </plugin>-->
        </plugins>
        <!--pack-->
        <resources>
            <resource>
                <directory>lib</directory>
                <targetPath>BOOT-INF/lib/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.yml</include>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <targetPath>BOOT-INF/classes/</targetPath>
            </resource>
        </resources>
        <finalName>di</finalName>
    </build>

</project>

After modification, package with maven

After typing the package, the jar package is in the target directory

Verification: open the cmd page in this directory, enter the following command, run the jar package, and check whether the jar package is valid

java -jar di.jar

After the display is started successfully, open the browser and enter

localhost:8080/testUser/getUser

If the page displays normally, the jar package is OK and ready to deploy the galaxy Kirin system

Galaxy Kirin jdk installation

Since running the jar package requires the support of jdk, first install jdk in the galaxy Qilin system. The specific steps are as follows:
(learn from the article of the boss, and don't do it in detail)
Install jdk-8u45-linux-i586.0 for Ubuntu kylin tar. gz

Galaxy Kirin system Dameng database installation

First attach the installation image of Feiteng version of Dameng:
Dameng 8 installation image (Feiteng)

If the CPU version is not Feiteng, you need to download it from Dameng's official website:
Download address of Dameng official website

You need to log in here. Fill in your mobile phone number and enter a verification code

To view the computer information, right-click My computer on the desktop, and then click properties to view it. The following figure shows the information of my system:

Here, you must download the image file of Dameng database according to the information of the system and cpu!

Next, the installation steps of the database are attached:
(it's also a reference for the boss. I successfully installed it step by step according to the instructions written here)
Installation of Damon database in kylin operating system

There are several problems to pay attention to (I encountered):
1. In this article, the command operation user is root, but I use the administrator user (I don't know the root user password), so sudo needs to be added in front of each command for authorization;
2. dm7 is installed in this article. My installation package here is dm8 (I think I can use the latest one if I want to use it), so remember to change the folder name and path to dm8;
3. Step 7 during installation, you must enter the command before switching users

sudo xhost +

Then switch to dmdba user, otherwise the graphical interface cannot be opened during installation, which is very troublesome;
4. During the installation process, prompt the root user to enter the script. Be sure to enter it, otherwise the installation process will get stuck. Because I don't know the root user password, I directly open another terminal console and enter the following command:

sudo su root

The script executed after the conversion of root user;
(I just didn't execute the script at first, and then the installation process got stuck)
5. After installation, you will be prompted to initialize the database (i.e. create database, delete database, etc.). If you accidentally close this step and want to reopen the DM management assistant, you need to execute the following commands:

First enter the command: sudo xhost+
Then switch to dmdba: su dmdba
Damon Database Configuration Assistant:
Input commands: 1. cd /dm8/tool 2/ dbca.sh
Damon database management tool:
Input commands: 1. cd /dm8/tool 2/ manager

Galaxy Kirin system jar package running

This is the same as running jar package on windows.
1. Open the directory where the jar package is stored:

Right click to open the terminal console, and then enter the command:

java -jar di.jar

After running successfully, open the browser and enter:

http://localhost:8080/testUser/getUser

If the display is OK, the operation is successful
(remember to install Wanda dream database here. Create a database and create a form. My table structure is as follows)

So far, the deployment of a set of java programs in a pure domestic environment has been completed.

This article is about deployment and project construction. If you are interested, you are welcome to read it.
Attach link: Build JAVA program in pure domestic environment (Springboot + Mybatis + Damon database)

For the first time to write this kind of article, many are not detailed. Please forgive me. Thank you.

Keywords: Java Linux Database SQL Ubuntu

Added by Pezmc on Wed, 09 Feb 2022 21:50:13 +0200