Red Hat Training

A Red Hat training course is available for RHEL 8

Chapter 1. Setting up a development workstation

Red Hat Enterprise Linux 8 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. Enabling debug and source repositories

A standard installation of Red Hat Enterprise Linux does not enable the debug and source repositories. These repositories contain information needed to debug the system components and measure their performance.

Procedure

  • Enable the source and debug information package channels:

    # subscription-manager repos --enable rhel-8-for-$(uname -i)-baseos-debug-rpms
    # subscription-manager repos --enable rhel-8-for-$(uname -i)-baseos-source-rpms
    # subscription-manager repos --enable rhel-8-for-$(uname -i)-appstream-debug-rpms
    # subscription-manager repos --enable rhel-8-for-$(uname -i)-appstream-source-rpms

    The $(uname -i) part is automatically replaced 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

    64-bit IBM Z

    s390x

1.3. Setting up to manage application versions

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

Procedure

  1. Install the git package:

    # yum install git
  2. Optional: 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@example.com"

    Replace Full Name and email@example.com with your actual name and email address.

  3. Optional: 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. As an example see git-commit(1).

  • 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.4. Setting up to develop applications using C and C++

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

Prerequisites

  • The debug and source repositories must be enabled.

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. Install the LLVM-based toolchain including the clang compiler and lldb debugger:

    # yum install llvm-toolset
  3. Optional: For Fortran dependencies, install the GNU Fortran compiler:

    # yum install gcc-gfortran

1.5. Setting up to debug applications

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

Prerequisites

  • The debug and source repositories must be enabled.

Procedure

  1. Install the tools useful for debugging:

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

    # yum install yum-utils
  3. Run a SystemTap helper script for setting up the environment.

    # stap-prep

    Note that stap-prep installs packages relevant to the currently running kernel, which might not be the same as the actually installed kernel(s). To ensure stap-prep installs the correct kernel-debuginfo and kernel-headers packages, double-check the current kernel version by using the uname -r command and reboot your system if necessary.

  4. Make sure SELinux policies allow the relevant applications to run not only normally, but in the debugging situations, too. For more information, see Using SELinux.

1.6. 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.

Prerequisites

  • The debug and source repositories must be enabled.

Procedure

  1. Install the tools for performance measurement:

    # yum install perf papi pcp-zeroconf valgrind strace sysstat systemtap
  2. Run a SystemTap helper script for setting up the environment.

    # stap-prep

    Note that stap-prep installs packages relevant to the currently running kernel, which might not be the same as the actually installed kernel(s). To ensure stap-prep installs the correct kernel-debuginfo and kernel-headers packages, double-check the current kernel version by using the uname -r command and reboot your system if necessary.

  3. Enable and start the Performance Co-Pilot (PCP) collector service:

    # systemctl enable pmcd && systemctl start pmcd