How To Install flex.x86_64 on Amazon Linux 2

In this tutorial we learn how to install flex.x86_64 in Amazon Linux 2. flex.x86_64 is A tool for creating scanners (text pattern recognizers)

Introduction

In this tutorial we learn how to install flex.x86_64 on Amazon Linux 2.

What is flex.x86_64

The flex program generates scanners. Scanners are programs which can recognize lexical patterns in text. Flex takes pairs of regular expressions and C code as input and generates a C source file as output. The output file is compiled and linked with a library to produce an executable. The executable searches through its input for occurrences of the regular expressions. When a match is found, it executes the corresponding C code. Flex was designed to work with both Yacc and Bison, and is used by many programs as part of their build process. You should install flex if you are going to use your system for application development.

We can use yum to install flex.x86_64 on Amazon Linux 2. In this tutorial we discuss both methods but you only need to choose one of method to install flex.x86_64.

Install flex.x86_64 on Amazon Linux 2 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install flex.x86_64 using yum by running the following command:

sudo yum -y install flex.x86_64

How To Uninstall flex.x86_64 on Amazon Linux 2

To uninstall only the flex.x86_64 package we can use the following command:

sudo yum remove flex.x86_64

flex.x86_64 Package Contents on Amazon Linux 2

/usr/bin/flex
/usr/bin/flex++
/usr/bin/lex
/usr/include/FlexLexer.h
/usr/share/doc/flex-2.5.37
/usr/share/doc/flex-2.5.37/COPYING
/usr/share/doc/flex-2.5.37/NEWS
/usr/share/doc/flex-2.5.37/README
/usr/share/info/flex.info-1.gz
/usr/share/info/flex.info-2.gz
/usr/share/info/flex.info.gz
/usr/share/locale/ca/LC_MESSAGES/flex.mo
/usr/share/locale/da/LC_MESSAGES/flex.mo
/usr/share/locale/de/LC_MESSAGES/flex.mo
/usr/share/locale/es/LC_MESSAGES/flex.mo
/usr/share/locale/fi/LC_MESSAGES/flex.mo
/usr/share/locale/fr/LC_MESSAGES/flex.mo
/usr/share/locale/ga/LC_MESSAGES/flex.mo
/usr/share/locale/ko/LC_MESSAGES/flex.mo
/usr/share/locale/nl/LC_MESSAGES/flex.mo
/usr/share/locale/pl/LC_MESSAGES/flex.mo
/usr/share/locale/pt_BR/LC_MESSAGES/flex.mo
/usr/share/locale/ro/LC_MESSAGES/flex.mo
/usr/share/locale/ru/LC_MESSAGES/flex.mo
/usr/share/locale/sv/LC_MESSAGES/flex.mo
/usr/share/locale/tr/LC_MESSAGES/flex.mo
/usr/share/locale/vi/LC_MESSAGES/flex.mo
/usr/share/locale/zh_CN/LC_MESSAGES/flex.mo
/usr/share/man/man1/flex++.1.gz
/usr/share/man/man1/flex.1.gz
/usr/share/man/man1/lex.1.gz

References

Summary

In this tutorial we learn how to install flex.x86_64 on Amazon Linux 2 using yum.