How To Install flex on CentOS 8
Introduction
In this tutorial we learn how to install flex
on CentOS 8.
What is flex
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
or dnf
to install flex
on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install flex.
Install flex on CentOS 8 Using dnf
Update yum database with dnf
using the following command.
sudo dnf makecache --refresh
The output should look something like this:
CentOS Linux 8 - AppStream 43 kB/s | 4.3 kB 00:00
CentOS Linux 8 - BaseOS 65 kB/s | 3.9 kB 00:00
CentOS Linux 8 - ContinuousRelease 43 kB/s | 3.0 kB 00:00
CentOS Linux 8 - Extras 23 kB/s | 1.5 kB 00:00
CentOS Linux 8 - FastTrack 40 kB/s | 3.0 kB 00:00
CentOS Linux 8 - HighAvailability 36 kB/s | 3.9 kB 00:00
CentOS Linux 8 - Plus 24 kB/s | 1.5 kB 00:00
CentOS Linux 8 - PowerTools 50 kB/s | 4.3 kB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 13 kB/s | 9.2 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 24 kB/s | 8.5 kB 00:00
Metadata cache created.
After updating yum database, We can install flex
using dnf
by running the following command:
sudo dnf -y install flex
Install flex on CentOS 8 Using yum
Update yum database with yum
using the following command.
sudo yum makecache --refresh
The output should look something like this:
CentOS Linux 8 - AppStream 43 kB/s | 4.3 kB 00:00
CentOS Linux 8 - BaseOS 65 kB/s | 3.9 kB 00:00
CentOS Linux 8 - ContinuousRelease 43 kB/s | 3.0 kB 00:00
CentOS Linux 8 - Extras 23 kB/s | 1.5 kB 00:00
CentOS Linux 8 - FastTrack 40 kB/s | 3.0 kB 00:00
CentOS Linux 8 - HighAvailability 36 kB/s | 3.9 kB 00:00
CentOS Linux 8 - Plus 24 kB/s | 1.5 kB 00:00
CentOS Linux 8 - PowerTools 50 kB/s | 4.3 kB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 13 kB/s | 9.2 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 24 kB/s | 8.5 kB 00:00
Metadata cache created.
After updating yum database, We can install flex
using yum
by running the following command:
sudo yum -y install flex
How To Uninstall flex on CentOS 8
To uninstall only the flex
package we can use the following command:
sudo dnf remove flex
flex Package Contents on CentOS 8
/usr/bin/flex
/usr/bin/flex++
/usr/bin/lex
/usr/include/FlexLexer.h
/usr/lib/.build-id
/usr/lib/.build-id/84
/usr/lib/.build-id/84/a8994b9d460ef2b6ced012f0cd441ddb6ceb3c
/usr/share/doc/flex
/usr/share/doc/flex/NEWS
/usr/share/doc/flex/README
/usr/share/info/flex.info-1.gz
/usr/share/info/flex.info-2.gz
/usr/share/info/flex.info.gz
/usr/share/licenses/flex
/usr/share/licenses/flex/COPYING
/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/en@boldquot/LC_MESSAGES/flex.mo
/usr/share/locale/en@quot/LC_MESSAGES/flex.mo
/usr/share/locale/eo/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/hr/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/sr/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/locale/zh_TW/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
on CentOS 8 using yum and dnf.