Preparing the Development Environment

Environment Requirements

  • If physical machines (PMs) are used, the minimum hardware specifications of the development environment are listed in Table 1.

    Table 1 Minimum hardware specifications

    Component

    Minimum Hardware Specifications

    Description

    Architecture

    • AArch64
    • x86_64
    • 64-bit Arm architecture
    • 64-bit Intel x86 architecture

    CPU

    • Huawei Kunpeng 920 series
    • Intel® Xeon® processor

    -

    Memory

    ≥ 4 GB (8 GB or higher is recommended for better experience.)

    -

    Hard drive

    ≥ 120 GB (for better user experience)

    IDE, SATA, and SAS hard drives

  • If virtual machines (VMs) are used, the minimum virtualization space required by the development environment is listed in Table 2.

    Table 2 Minimum virtualization space specifications

    Component

    Minimum Virtualization Space

    Description

    Architecture

    • AArch64
    • x86_64

    -

    CPU

    2 x CPU

    -

    Memory

    ≥ 4 GB (8 GB or higher is recommended for better experience.)

    -

    Hard drive

    ≥ 32 GB (120 GB or higher is recommended for better user experience.)

    -

OS Requirements

The openEuler OS is required.

For details about how to install the openEuler OS, see the Installation Guide. On the SOFTWARE SELECTION page, select Development Tools in the Add-Ons for Selected Environment area.

Configuring the openEuler Yum Source

To configure an online Yum source, you can obtain the online openEuler repo source. To configure a local Yum source, you can mount an ISO file and create a local openEuler repo source.

Configuring an Online Yum Source by Obtaining the Online openEuler Repo Source

NOTE:
openEuler provides multiple repo sources for users to use online. For details about the repo sources, see OS Installation. This section uses the OS repo source of the AArch64 architecture as an example to describe how to configure it as a Yum source.

  1. Go to the Yum source directory and view the .repo configuration file in the directory.

    $ cd /etc/yum.repos.d
    $ ls
    openEuler.repo
    
  2. Edit the openEuler.repo file as the root user and configure the online openEuler repo source as the Yum source.

    # vi openEuler.repo
    

    Edit the openEuler.repo file as follows:

    [osrepo]
    name=osrepo
    baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/OS/aarch64/
    enabled=1
    
    gpgcheck=1
    gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/OS/aarch64/RPM-GPG-KEY-openEuler
    

    NOTE:

    • repoid indicates the ID of the software repository. repoid in all .repo configuration files must be unique. In the example, repoid is set to osrepo.
    • name indicates the character string of the software repository description.
    • baseurl indicates the address of the software repository.
    • enabled indicates whether to enable the software source repository. The value can be 1 or 0. The default value is 1, indicating that the software source repository is enabled.
    • gpgcheck can be set to 1 or 0. Value 1 indicates that the GNU Private Guard (GPG) check is enabled, while value 0 indicates that the GPG check is disabled. gpgcheck checks whether the source of the RPM package is valid and secure. If this option is not specified, the GPG check is enabled by default.
    • gpgkey indicates the public key used to verify the signature.

Configuring a Local Yum Source by Mounting an ISO File

NOTE:
openEuler provides multiple ISO release packages. For details about the ISO release packages, see OS Installation. This section uses the openEuler-22.03-LTS-SP1-aarch64-dvd.iso release package and openEuler-22.03-LTS-SP1-aarch64-dvd.iso.sha256sum verification file as examples. Modify them based on the actual requirements.

  1. Download the ISO release package.

    • Download an ISO image using a cross-platform file transfer tool.

      1. Log in to the openEuler community.

      2. Choose Download > Software Packages.

      3. Locate the target version, for example, openEuler 22.03-LTS-SP1. Then, click Download. The download list is displayed.

      4. Click ISO. The ISO download list is displayed.

        • aarch64: ISO of the AArch64 architecture.
        • x86_64: ISO of the x86_64 architecture.
        • source: ISO of openEuler source code.
      5. Click aarch64.

      6. Click openEuler-22.03-LTS-SP1-aarch64-dvd.iso to download the openEuler release package to the local host.

      7. Click openEuler-22.03-LTS-SP1-aarch64-dvd.iso.sha256sum to download the openEuler verification file to the local host.

      8. Log in to the openEuler OS and create a directory for storing the release package and verification file, for example, ~/iso.

        $ mkdir ~/iso
        
      9. Use a cross-platform file transfer tool (such as WinSCP) to upload the local openEuler release package and verification file to the openEuler OS.

    • Run the wget command to download the ISO image.

      1. Log in to the openEuler community.

      2. Choose Download > Software Packages.

      3. Locate the target version, for example, openEuler 22.03-LTS-SP1. Then, click Download. The download list is displayed.

      4. Click ISO. The ISO download list is displayed.

        • aarch64: ISO of the AArch64 architecture.
        • x86_64: ISO of the x86_64 architecture.
        • source: ISO of openEuler source code.
      5. Click aarch64.

      6. Right-click openEuler-22.03-LTS-SP1-aarch64-dvd.iso and choose Copy link address from the shortcut menu to copy the address of the openEuler release package.

      7. Right-click openEuler-22.03-LTS-SP1-aarch64-dvd.iso.sha256sum and choose Copy link address from the shortcut menu to copy the address of the openEuler verification file.

      8. Log in to the openEuler OS, create a directory for storing the release package and verification file, for example, ~/iso. Then switch to the directory.

        $ mkdir ~/iso
        $ cd ~/iso
        
      9. Run the wget command to remotely download the release package and verification file. In the command, replace ipaddriso and ipaddrisosum with the addresses copied in 6 and 7.

        $ wget ipaddriso
        $ wget ipaddrisosum
        
  2. Verify the integrity of the release package.

    1. Obtain the verification value in the verification file.

      $ cat openEuler-22.03-LTS-SP1-aarch64-dvd.iso.sha256sum
      
    2. Calculate the SHA256 verification value of the openEuler release package.

      $ sha256sum openEuler-22.03-LTS-SP1-aarch64-dvd.iso 
      

      After the command is executed, the verification value is displayed.

    3. Check whether the verification values calculated in step 1 and step 2 are the same.

      If the verification values are the same, the integrity of the ISO file is not damaged. If the verification values are different, the integrity of the ISO file is damaged and you need to obtain the ISO file again.

  3. Mount the ISO file and create a repo source.

    Run the mount command to mount the image file as the root user.

    Example:

    # mount /home/iso/openEuler-22.03-LTS-SP1-aarch64-dvd.iso /mnt/
    

    The structure of the mounted /mnt directory is as follows:

    .
    │── boot.catalog
    │── docs
    │── EFI
    │── images
    │── Packages
    │── repodata
    │── TRANS.TBL
    └── RPM-GPG-KEY-openEuler
    

    In the directory, Packages indicates the directory where the RPM package is stored, repodata indicates the directory where the repo source metadata is stored, and RPM-GPG-KEY-openEuler indicates the public key for signing openEuler.

  4. Go to the Yum source directory and view the .repo configuration file in the directory.

    $ cd /etc/yum.repos.d
    $ ls
    openEuler.repo
    
  5. Edit the openEuler.repo file as the root user. Configure the local openEuler repo source created in step 3 as the local Yum source.

    # vi openEuler.repo
    

    Edit the openEuler.repo file as follows:

    [localosrepo]
    name=localosrepo
    baseurl=file:///mnt
    enabled=1
    gpgcheck=1
    gpgkey=file:///mnt/RPM-GPG-KEY-openEuler
    

Installing Software Packages

Install the software required for development. The software required varies in different development environments, but the installation methods are the same. This section describes how to install common software packages (JDK and rpm-build). Some development software, such as GCC and GNU make, is provided by the openEuler OS by default.

Installing the JDK Software Package

  1. Run the dnf list installed | grep jdk command to check whether JDK has been installed.

    $ dnf list installed | grep jdk
    

    Check the command output. If the command output contains jdk, the software has been installed and does not need to be installed again. If no information is displayed, the software is not installed.

  2. Clear the cache.

    $ dnf clean all
    
  3. Create a cache.

    $ dnf makecache
    
  4. Query the JDK software packages that can be installed.

    $ dnf search jdk | grep jdk
    

    View the command output and install the java-x.x.x-openjdk-devel.aarch64 software package. x.x.x indicates the version number.

  5. Install the JDK software package as the root user. The following uses the java-1.8.0-openjdk-devel software package as an example.

    # dnf install java-1.8.0-openjdk-devel.aarch64
    
  6. Query the JDK version.

    $ java -version
    

    If the command output contains openjdk version "1.8.0_232", JDK has been correctly installed. 1.8.0_232 indicates the JDK version.

Installing the rpm-build Software Package

  1. Run the dnf list installed | grep rpm-build command to check whether the rpm-build software has been installed.

    $ dnf list installed | grep rpm-build
    

    Check the command output. If the command output contains rpm-build, the software has been installed and does not need to be installed again. If no information is displayed, the software is not installed.

  2. Clear the cache.

    $ dnf clean all
    
  3. Create a cache.

    $ dnf makecache
    
  4. Install the rpm-build software package as the root user.

    # dnf install rpm-build
    
  5. Query the rpm-build version.

    $ rpmbuild --version
    

Using the IDE for Java Development

For small-sized Java applications, you can directly use JDK to compile them to run Java applications. However, for medium- and large-sized Java applications, this method cannot meet developers' requirements. You can perform the following operations to install and use the development environment (IDE) to facilitate Java development on the openEuler OS.

Overview

IntelliJ IDEA is a popular Java IDE. You can download and use the community edition of IntelliJ IDEA free of charge. Currently, openEuler supports Java program development using the IntelliJ IDEA, which improves the work efficiency of developers.

Logging In to the Server Using MobaXterm

MobaXterm is an excellent SSH client. It has a built-in X Server and can easily solve the remote GUI display problems.

You need to download and install MobaXterm in advance, start it, log in to your server in SSH mode, and perform the following operations.

Setting the JDK Environment

Before setting JAVA_HOME, you need to find the JDK installation path. If you have not installed JDK, install it by referring to the preceding section "Installing the JDK Software Package."

Run the following commands to view the Java path:

$ which java
/usr/bin/java

Run the following commands to check the directory to which the soft link points:

$ ls -la /usr/bin/java
lrwxrwxrwx. 1 root root  22 Mar 6 20:28 /usr/bin/java -> /etc/alternatives/java
$ ls -la /etc/alternatives/java
lrwxrwxrwx. 1 root root  83 Mar 6 20:28 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-1.h2.aarch64/jre/bin/java

The actual path of JDK is /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-1.h2.aarch64. Run the following commands to set JAVA_HOME and PATH:

$ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-1.h2.aarch64
$ export PATH=$JAVA_HOME/bin:$PATH

Downloading and Installing the GTK Library

Run the following command:

$ dnf list installed | grep gtk

If gtk2 or gtk3 is displayed, the GTK library has been installed. In this case, skip this step. Otherwise, run the following command as the root user to automatically download and install the GTK library:

# dnf -y install gtk2 libXtst libXrender  xauth

Setting X11 Forwarding

Switch to the SSHD configuration directory.

$ cd ~/.ssh

If the directory does not exist, run the following command to create it and then switch to it:

$ mkdir ~/.ssh

Edit the config file in the .ssh directory and save the file.

  1. Run the vim command to open the config file.

    $ vim config
    
  2. Add the following content to the end of the file and save the file:

    Host *
    		  ForwardAgent yes
    		  ForwardX11 yes
    

Downloading and Running IntelliJ IDEA

After performing the preceding environment configuration, you can download and use IntelliJ IDEA. The latest IntelliJ IDEA is incompatible with openEuler in some functions. You are advised to download the Linux package of the 2018 version. Move the downloaded package to the directory where you want to install the software and decompress the package.

$ tar xf ideaIC-2018.3.tar.gz

Decompress the package, switch to the IntelliJ IDEA directory, and run IntelliJ IDEA.

$ cd ./idea-IC-183.4284.148
$ bin/idea.sh &

Bug Catching

Buggy Content

Bug Description

Submit As Issue

It's a little complicated....

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Bug Type
Specifications and Common Mistakes

● Misspellings or punctuation mistakes;

● Incorrect links, empty cells, or wrong formats;

● Chinese characters in English context;

● Minor inconsistencies between the UI and descriptions;

● Low writing fluency that does not affect understanding;

● Incorrect version numbers, including software package names and version numbers on the UI.

Usability

● Incorrect or missing key steps;

● Missing prerequisites or precautions;

● Ambiguous figures, tables, or texts;

● Unclear logic, such as missing classifications, items, and steps.

Correctness

● Technical principles, function descriptions, or specifications inconsistent with those of the software;

● Incorrect schematic or architecture diagrams;

● Incorrect commands or command parameters;

● Incorrect code;

● Commands inconsistent with the functions;

● Wrong screenshots.

Risk Warnings

● Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

● Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions;

● Copyright infringement.

How satisfied are you with this document

Not satisfied at all
Very satisfied
Submit
Click to create an issue. An issue template will be automatically generated based on your feedback.