Questo contenuto non è disponibile nella lingua selezionata.
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 Copia collegamentoCollegamento copiato negli appunti!
- The system must be installed, including a graphical environment, and subscribed.
1.2. Enabling debug and source repositories Copia collegamentoCollegamento copiato negli appunti!
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
# 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-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
$(uname -i)part is automatically replaced with a matching value for architecture of your system:Expand Architecture name Value 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 Copia collegamentoCollegamento copiato negli appunti!
Effective version control is essential to all multi-developer projects. Red Hat Enterprise Linux is shipped with Git, a distributed version control system.
Procedure
Install the git package:
yum install git
# yum install gitCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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"
$ git config --global user.name "Full Name" $ git config --global user.email "email@example.com"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace Full Name and email@example.com with your actual name and email address.
Optional: To change the default text editor started by Git, set value of the
core.editorconfiguration option:git config --global core.editor command
$ git config --global core.editor commandCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace command with the command to be used to start the selected text editor.
1.4. Setting up to develop applications using C and C++ Copia collegamentoCollegamento copiato negli appunti!
Red Hat Enterprise Linux includes tools for creating C and C++ applications.
Prerequisites
- The debug and source repositories must be enabled.
Procedure
Install the Development Tools package group including GNU Compiler Collection (GCC), GNU Debugger (GDB), and other development tools:
yum group install "Development Tools"
# yum group install "Development Tools"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the LLVM-based toolchain including the
clangcompiler andlldbdebugger:yum install llvm-toolset
# yum install llvm-toolsetCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: For Fortran dependencies, install the GNU Fortran compiler:
yum install gcc-gfortran
# yum install gcc-gfortranCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.5. Setting up to debug applications Copia collegamentoCollegamento copiato negli appunti!
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
Install the tools useful for debugging:
yum install gdb valgrind systemtap ltrace strace
# yum install gdb valgrind systemtap ltrace straceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the yum-utils package in order to use the
debuginfo-installtool:yum install yum-utils
# yum install yum-utilsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run a SystemTap helper script for setting up the environment.
stap-prep
# stap-prepCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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 -rcommand and reboot your system if necessary.-
Make sure
SELinuxpolicies allow the relevant applications to run not only normally, but in the debugging situations, too. For more information, see Using SELinux.
Additional resources
1.6. Setting up to measure performance of applications Copia collegamentoCollegamento copiato negli appunti!
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
Install the tools for performance measurement:
yum install perf papi pcp-zeroconf valgrind strace sysstat systemtap
# yum install perf papi pcp-zeroconf valgrind strace sysstat systemtapCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run a SystemTap helper script for setting up the environment.
stap-prep
# stap-prepCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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 -rcommand and reboot your system if necessary.Enable and start the Performance Co-Pilot (PCP) collector service:
systemctl enable pmcd && systemctl start pmcd
# systemctl enable pmcd && systemctl start pmcdCopy to Clipboard Copied! Toggle word wrap Toggle overflow