Before starting, please check to see if there is a latest version available to download. Visit http://flex.sourceforge.net/ to find out about the available versions. IMPORTANT: See "Configuring Ubuntu Linux After Installation" to install the development tools required to compile and install flex from source code.
Steps to download, compile, and install are as follows. Note: Replace 2.5.33 with your version number:
- Downloading Flex (The fast lexical analyzer):Run the command below,- wget http://prdownloads.sourceforge.net/flex/flex-2.5.33.tar.gz?download 
- Extracting files from the downloaded package:- tar -xvzf flex-2.5.33.tar.gz Now, enter the directory where the package is extracted.- cd flex-2.5.33 
- Configuring flex before installation:If you haven't installed m4 yet then please do so. Run the commands below to include m4 in your PATH variable.- PATH=$PATH:/usr/local/m4/bin/ NOTE: Replace '/usr/local/m4/bin' with the location of m4 binary. Now, configure the source code before installation.- ./configure --prefix=/usr/local/flex Replace "/usr/local/flex" above with the directory path where you want to copy the files and folders. Note: check for any error message.
- Compiling flex:- make Note: check for any error message.
- Installing flex:
- As root (for privileges on destination directory), run the following.With sudo,sudo make install Without sudo,make install Note: check for any error messages.
That’s it. Flex has been successfully installed.


 

Install flex on ubuntu