Preparation
Configuring the Development Environment
The minimum hardware requirements for physical machines (PMs) are described in Table 1.
Table 1 Minimum hardware requirements
- AArch64
- x86_64
- 64-bit Arm architecture
- 64-bit Intel x86 architecture
≥ 4 GB (8 GB or higher recommended for better user experience)
The minimum virtualization space requirements for virtual machines (VMs) are described in Table 2.
Table 2 Minimum virtualization space requirements
- AArch64
- x86_64
≥ 4 GB (8 GB or higher recommended for better user experience)
≥ 32 GB (120 GB or higher recommended for better user experience)
OS Requirements
The openEuler OS is required.
For details about how to install the openEuler OS, see the openEuler 20.03 LTS SP3 Installation Guide. On the SOFTWARE SELECTION page, select Development Tools in the Add-Ons for Selected Environment area.
Configuring a Repo Source
Configure an online Yum source using the online openEuler repo source. Alternatively, configure a local Yum source by mounting an ISO file and creating a local openEuler repo source.
Configuring an Online Repo Source Using the openEuler Repo Source
NOTE: openEuler provides multiple online repo sources. For details about the repo sources, see Installing the OS. This section uses the openEuler_aarch64.repo file as an example to describe how to configure the openEuler repo source as the Yum source.
Go to the Yum source directory and check the .repo configuration file in the directory.
$ cd /etc/yum.repos.d $ ls openEuler_aarch64.repo
Edit the openEuler_aarch64.repo file as the root user. Set the online openEuler repo source as the Yum source.
vi openEuler_aarch64.repo
Edit the openEuler_aarch64.repo file as follows:
[osrepo] name=osrepo baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP3/OS/aarch64/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP3/OS/aarch64/RPM-GPG-KEY-openEuler
NOTE:
- [repoid] indicates the ID of the software repository. The ID of each repository in all .repo configuration files must be unique. In this example, repoid is set to osrepo.
- name indicates the description about the software repository.
- 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 indicates whether verify the validity and security of RPM packages using GNU privacy guard (GPG) signatures. 1 indicates that the GPG check is enabled. 0 indicates that the GPG check is disabled. If this option is not specified, the GPG check is enabled by default.
- gpgkey is the public key used to verify the signature.
Configuring a Local Repo Source by Mounting an openEuler ISO File
NOTE:
openEuler provides multiple ISO release packages. For details about each ISO release package, see Installing the OS. This section uses the openEuler-20.03-LTS-SP3-aarch64-dvd.iso file and the sha256 verification file as examples. Modify them based on the actual requirements.
Download the ISO release package.
Download an ISO image using a cross-platform file transfer tool.
Visit the openEuler community.
Choose Downloads > Community Editions.
Locate the target version, for example, openEuler 22.03 LTS SP3. Then, click Download. The download list is displayed.
The download list includes the following architectures and scenarios: Architectures:
- AArch64: ISO of the AArch64 architecture.
- x86_64: ISO of the x86_64 architecture.
Click AArch64.
Choose Offline Standard ISO and click Download to download the openEuler release package to the local host.
Click SHA256 to copy the checksum. Save the checksum as a local verification file.
Log in to the openEuler OS and create a directory for storing the release package and verification file, for example, ~/iso.
mkdir ~/iso
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.
Visit the openEuler community.
Choose Downloads > Community Editions.
Locate the target version, for example, openEuler 22.03 LTS SP3. Then, click Download. The download list is displayed.
The download list includes the following architectures and scenarios: Architectures:
- AArch64: ISO of the AArch64 architecture.
- x86_64: ISO of the x86_64 architecture.
Click AArch64.
Choose Offline Standard ISO, right-click Download, and copy the link address.
Right-click SHA256 and copy the link address.
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
Run the wget command to remotely download the release package and verification file. In the command, replace ipaddriso with the address copied in steps 7.
wget ipaddriso
Check the integrity of the release package
Calculate the SHA256 verification value of the openEuler release package.
sha256sum openEuler-20.03-LTS-SP3-aarch64-dvd.iso
After the command is run, the verification value is displayed.
Check whether the calculated value is the same as that of the saved SHA256 value.
If the verification values are the same, the ISO image file is not damaged. If they are not the same, the file is damaged and you need to obtain the file again.
Mount the ISO file and configure it as a repo source.
Run the
mount
command as the root user to mount the image file.The following is an example:
mount /home/iso/openEuler-20.03-LTS-SP3-aarch64-dvd.iso /mnt/
The mounted mnt directory is as follows:
. │── boot.catalog │── docs │── EFI │── images │── Packages │── repodata │── TRANS.TBL └── RPM-GPG-KEY-openEuler
In the mnt directory, Packages is the directory where the RPM package is stored, repodata is the directory where the repo source metadata is stored, and RPM-GPG-KEY-openEuler is the public key of the openEuler signature.
Go to the Yum source directory and check the .repo configuration file in the directory.
$ cd /etc/yum.repos.d $ ls openEuler_aarch64.repo
Edit the openEuler_aarch64.repo file as the root user. Configure the local openEuler repo source created in step 3 as the Yum source.
vi openEuler_aarch64.repo
Edit the openEuler_aarch64.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 required software varies in different development environments. However, the installation method is the same. This section describes how to install common software packages (such as JDK and rpm-build). Some development software, such as GCC and GNU make, is installed the openEuler OS by default.
Installing the JDK Software Package
Run the
dnf list installed | grep jdk
command to check whether the JDK software is installed.dnf list installed | grep jdk
If the command output contains jdk, JDK has been installed. If no such information is displayed, the software is not installed.
Clear the cache.
dnf clean all
Create a cache.
dnf makecache
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. OpenJDK 1.8, OpenJDK 11, and the latest OpenJDK are supported.
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
Query the version of JDK.
java -version
If the command output contains openjdk version "1.8.0_232", the JDK has been correctly installed. 1.8.0_232 indicates the JDK version.
Installing the rpm-build Software Package
Run the
dnf list installed | grep rpm-build
command to check whether the rpm-build software is installed.dnf list installed | grep rpm-build
If the command output contains rpm-build, the software has been installed. If no such information is displayed, the software is not installed.
Clear the cache.
dnf clean all
Create a cache.
dnf makecache
Install the rpm-build package as the root user.
dnf install rpm-build
Query the version of rpm-build.
rpmbuild --version
Using an IDE for Java Development
You can directly use JDK to compile small-sized Java applications. However, this method cannot meet the requirements for developing medium- to large-sized Java applications. You can perform the following steps to install and use an integrated development environment (IDE) to facilitate Java development on the openEuler OS.
Overview
IntelliJ IDEA is a popular Java IDE. You can download its community edition for free. openEuler supports Java development using IntelliJ IDEA, improving work efficiency.
Logging In to the Server Using MobaXterm
MobaXterm is an excellent SSH client with a built-in X server for displaying the GUI.
You need to download, install, and start MobaXterm in advance, and then log in to your server using SSH to perform the following operations.
Setting the JDK Environment
Before setting the JAVA_HOME variable, you need to find the installation path of JDK. If you have not installed JDK, install it by referring to Installing the JDK Software Package.
Run the following command to view the Java path:
$ which java
/usr/bin/java
Run the following command to check the directory to which the symbolic 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 is /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-1.h2.aarch64. Run the following command 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 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 the directory and then switch to the directory:
mkdir ~/.ssh
Edit the configuration file in the .ssh directory and save the file.
Use Vim to open the configuration file.
vim config
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 the preceding environment configuration is complete, you can download and run IntelliJ IDEA. The latest version of IntelliJ IDEA is incompatible with openEuler in some functions. You are advised to download a package of version 2018.* for Linux here. 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
Switch to the IntelliJ IDEA directory, and run IntelliJ IDEA.
cd ./idea-IC-183.4284.148
bin/idea.sh &