How to install flex?
Assuming you are using Ubuntu, you should usually not attempt to install packages with yum
. It is provided for very special circumstances only. Usually you should install software with Ubuntu's package manager, APT (using apt-get
, or the alternative, aptitude
), or with one of its graphical frontends (like the Ubuntu Software Center or the Synaptic Package Manager).
yum
is primarily used on Red Hat based systems (including Fedora, Red Hat Enterprise Linux, and derivatives of those). The above commands are what you'd use instead. The lower-level tool on Red Hat based systems, for installing a package from a specific package file, isrpm
.dpkg
(or its graphical frontend,gdebi
) should be used to for this purpose on Ubuntu.dpkg
installs.deb
packages--if you find you actually need to install an.rpm
package, you should usealien
to make a.deb
package from it and install that.See Installing Software for more information.
In this particular situation, you may be able to install flex
by clicking here:
Or you can install it by running these commands:
sudo apt-get update
sudo apt-get install flex
The first command updates information about what packages are available in what versions and from what software sources. It's advisable to run that before installing or upgrading packages from the command line. Whereas yum
will always fetch this information before attempting an installation (which is handy, but which also makes it take a lot longer than necessary if you run a number of yum
commands in a short time), sudo apt-get install ...
does not fetch this information.
If you don't run sudo apt-get update
first, and you haven't run it in a while, you may be getting an old version of the package, attempting to fetch a version so old it's no longer available, or getting a version that doesn't work right with the other packages you have installed.
You can try installing Aptitude by typing sudo apt-get install aptitude
(if you don't already have it) and then type sudo aptitude search flex
.
If it locates the package do sudo aptitude install flex
.
This way is a bit drawn out from imwrng's way, but this allows you to browse other available packages for flex.
You are(in accordance to my comment which came before iwrng's answer) using commands for the wrong Linux distro. Ubuntu, like Debian uses apt
(Advanced Package Tool) to install and manage applications. Please use sudo apt-get update
, followed by sudo apt-get install flex
, and use sudo apt-get install
packagename
for all other installation steps in your guide.
you should have to type as sudo apt-get install flex
to install it . or If you want graphical approach using Software Center