Developing applications in RHEL 8

Red Hat Enterprise Linux 8.0 Beta

An introduction to application development tools in Red Hat Enterprise Linux 8.0 Beta

Red Hat Customer Content Services

Abstract

This document describes the different features and utilities that make Red Hat Enterprise Linux 8.0 Beta an ideal enterprise platform for application development.

This is a beta version!

Thank you for your interest in Red Hat Enterprise Linux 8.0 Beta. Be aware that:

  • Beta code should not be used with production data or on production systems.
  • Beta does not include a guarantee of support.
  • Feedback and bug reports are welcome. Discussions with your account representative, partner contact, and Technical Account Manager (TAM) are also welcome.
  • Upgrades to or from a Beta are not supported or recommended.

Providing feedback on Red Hat documentation

We appreciate your input on our documentation. Please let us know how we could make it better. To do so:

  • For simple comments on specific passages, make sure you are viewing the documentation in the Multi-page HTML format. Highlight the part of text that you want to comment on. Then, click the Add Feedback pop-up that appears below the highlighted text, and follow the displayed instructions.
  • For submitting more complex feedback, create a Bugzilla ticket:

    1. Go to the Bugzilla website.
    2. As the Component, use Documentation.
    3. Fill in the Description field with your suggestion for improvement. Include a link to the relevant part(s) of documentation.
    4. Click Submit Bug.

Chapter 1. Setting up a development workstation

Red Hat Enterprise Linux 8.0 Beta supports development of custom applications. To allow developers to do so, the system must be set up with the required tools and utilities. This chapter lists the most common use cases for development and the items to install.

1.1. Prerequisites

  • The system must be installed, including a graphical environment, and subscribed.

1.2. Setting up to manage application versions

Effective version control is essential to all multi-developer projects. Red Hat Enterprise Linux is distributed with Git, a distributed version control system.

Procedure

  1. Install the git package from the Red Hat Enterprise Linux repositories after the system is installed.

    # yum install git
  2. Set the full name and email address associated with your Git commits:

    $ git config --global user.name "full name"
    $ git config --global user.email "email_address"

    Replace full name and email_address with your actual name and email address.

  3. To change the default text editor started by Git, set value of the core.editor configuration option:

    $ git config --global core.editor command

    Replace command with the command to be used to start the selected text editor.

Additional resources

  • Linux manual pages for Git and tutorials:

    $ man git
    $ man gittutorial
    $ man gittutorial-2

    Note that many Git commands have their own manual pages.

  • Git User’s Manual — HTML documentation for Git is located at /usr/share/doc/git/user-manual.html.
  • Pro Git — The online version of the Pro Git book provides a detailed description of Git, its concepts and its usage.
  • Reference — Online version of the Linux manual pages for Git

1.3. Setting up to develop applications using C and C++

Red Hat Enterprise Linux includes tools for creating C and C++ applications.

Procedure

  1. Install the Development Tools package group including GNU Compiler Collection (GCC), GNU Debugger (GDB), and other development tools:

    # yum group install "Development Tools"
  2. Enable the source and debug information package channels:

    # subscription-manager repos --enable rhel-8-for-architecture-baseos-beta-debug-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-baseos-beta-source-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-appstream-beta-debug-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-appstream-beta-source-rpms

    Replace architecture with a matching value for architecture of your system:

    Architecture nameValue

    64-bit Intel and AMD

    x86_64

    64-bit ARM

    aarch64

    IBM POWER

    ppc64le

    IBM Z

    s390x

  3. For graphical-based development, install the Eclipse integrated development environment:

    # yum install rh-eclipse

1.4. Setting up to debug applications

Red Hat Enterprise Linux offers multiple debugging and instrumentation tools to analyze and troubleshoot internal application behavior.

Procedure

  1. Install the tools useful for debugging:

    # yum install gdb valgrind systemtap systemtap-runtime ltrace strace
  2. Install the yum-utils package in order to use the debuginfo-install tool:

    # yum install yum-utils
  3. Enable the source and debug information package channels:

    # subscription-manager repos --enable rhel-8-for-architecture-baseos-beta-debug-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-baseos-beta-source-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-appstream-beta-debug-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-appstream-beta-source-rpms

    Replace architecture with a matching value for architecture of your system:

    Architecture nameValue

    64-bit Intel and AMD

    x86_64

    64-bit ARM

    aarch64

    IBM POWER

    ppc64le

    IBM Z

    s390x

  4. Run a SystemTap helper script for setting up the environment.

    # stap-prep
    Note

    Running this script installs very large kernel debuginfo packages.

  5. Make sure SELinux policies allow the relevant applications to run not only normally, but in the debugging situations, too. For more information, see Configuring and managing security.

1.5. Setting up to measure performance of applications

Red Hat Enterprise Linux includes several applications that can help a developer identify the causes of application performance loss.

Procedure

  1. Install the tools for performance measurement:

    # yum install perf papi pcp valgrind strace sysstat systemtap systemtap-runtime
  2. Enable the source and debug information package channels:

    # subscription-manager repos --enable rhel-8-for-architecture-baseos-beta-debug-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-baseos-beta-source-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-appstream-beta-debug-rpms
    # subscription-manager repos --enable rhel-8-for-architecture-appstream-beta-source-rpms

    Replace architecture with a matching value for architecture of your system:

    Architecture nameValue

    64-bit Intel and AMD

    x86_64

    64-bit ARM

    aarch64

    IBM POWER

    ppc64le

    IBM Z

    s390x

  3. Run a SystemTap helper script for setting up the environment.

    # stap-prep
    Note

    Running this script installs very large kernel debuginfo packages.

Chapter 2. Installing and using .NET Core

The following sections describe how to install and use .NET Core on Red Hat Enterprise Linux 8.0 Beta.

2.1. About .NET Core

.NET Core is a general purpose development platform featuring automatic memory management and modern programming languages. It allows users to build high-quality applications efficiently. .NET Core is available on Red Hat Enterprise Linux and OpenShift Container Platform via certified containers.

.NET Core offers the following features:

  • The ability to follow a microservices-based approach, where some components are built with .NET and others with Java, but all can run on a common, supported platform in Red Hat Enterprise Linux and OpenShift Container Platform.
  • The capacity to more easily develop new .NET Core workloads on Microsoft Windows. Customers can deploy and run on either Red Hat Enterprise Linux or Windows Server.
  • A heterogeneous data center, where the underlying infrastructure is capable of running .NET applications without having to rely solely on Windows Server.

.NET Core is supported on Red Hat Enterprise Linux 8.0 Beta, Red Hat Enterprise Linux 7, and Red Hat OpenShift Container Platform versions 3.3 and later.

2.2. Installing .NET Core

Complete the following steps to install .NET Core 2.1 on Red Hat Enterprise Linux 8.0 Beta. This installs the .NET Core application and all dependencies.

  1. Enter the following command to install .NET Core 2.1.

    $ sudo yum install dotnet-sdk-2.1
  2. Verify that the installation was successful.

    $ dotnet --info
    .NET Core SDK (reflecting any global.json):
     Version:   2.1.300
     Commit:    ded465c666
    
    Runtime Environment:
     OS Name:     rhel
     OS Version:  8
     OS Platform: Linux
     RID:         rhel.8-x64
     Base Path:   /usr/lib64/dotnet/sdk/2.1.403/
    
    Host (useful for support):
      Version: 2.1.0
      Commit:  N/A
    
    .NET Core SDKs installed:
     2.1.403 [/usr/lib64/dotnet/sdk]
    
    .... omitted

2.3. Creating an application

Complete the following steps to create a test .NET Core console application.

  1. Enter the following command to create a new console application in a directory named hello-world.

    $ dotnet new console -o hello-world
    The template "Console Application" was created successfully.
    
      Processing post-creation actions...
      Running 'dotnet restore' on hello-world/hello-world.csproj...
      Restoring packages for /home/<USER>/hello-world/hello-world.csproj...
      Generating MSBuild file /home/<USER>/hello-world/obj/hello-world.csproj.nuget.g.props.
      Generating MSBuild file /home/<USER>/hello-world/obj/hello-world.csproj.nuget.g.targets.
      Restore completed in 224.85 ms for /home/<USER>/hello-world/hello-world.csproj.
    
      Restore succeeded.
  2. Run the project.

    $ cd hello-world
    $ dotnet run
    Hello World!

2.4. About publishing applications

The .NET Core 2.1 applications can be published to use a shared system-wide version of .NET Core or to include .NET Core. These two deployment types are called framework-dependent deployment (FDD) and self-contained deployment (SCD), respectively.

Red Hat recommends using the FDD publishing method for Red Hat Enterprise Linux. This method ensures the application is using an up-to-date version of .NET Core, built by Red Hat, that includes a specific set of native dependencies. On the other hand, SCD uses a runtime built by Microsoft.

2.4.1. Publishing .NET Core applications

Complete the following steps to publish an application using the FDD method.

  1. Enter the following command to publish a framework-dependent application.

    $ dotnet publish -f netcoreapp2.1 -c Release
  2. Optional: If the application is only for Linux, enter the following commands to trim the dependencies needed for other Operating Systems.

    $ dotnet restore -r linux-x64
    $ dotnet publish -f netcoreapp2.1 -c Release -r linux-x64 --self-contained false
  3. Pass the application assembly name to the dotnet command to run the application on a Red Hat Enterprise Linux machine.

    $ dotnet <app>.dll

2.4.2. Publishing ASP.NET Core applications

When using the Microsoft SDK, ASP.NET Core 2.1 web applications are published with a dependency on the ASP.NET Core shared framework. This is a set of packages that are expected to be available on the runtime system.

When publishing on Red Hat Enterprise Linux, these packages are included with the application. To include the packages using the Microsoft SDK, the MicrosoftNETPlatformLibrary property must be set to Microsoft.NETCore.App in the project file as shown below.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <MicrosoftNETPlatformLibrary>Microsoft.NETCore.App</MicrosoftNETPlatformLibrary>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1" />
  </ItemGroup>
</Project>

As an alternative, this property can be set when publishing the application.

$ dotnet publish -f netcoreapp2.1 -c Release -r linux-x64 --self-contained false /p:MicrosoftNETPlatformLibrary=Microsoft.NETCore.App

2.5. Additional resources

See .NET Documentation at Microsoft for additional information about using .NET Core.

Chapter 3. Other documentation

This documentation is provided as part of the Beta release and incomplete.

For more information about topics related to development on Red Hat Enterprise Linux, you can temporarily use these resources:

Legal Notice

Copyright © 2019 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.