How to install Firefox 4, Firefox 5 on CentOS 5, Centos 5.5, Centos 5.6

http://wiki.centos.org/TipsAndTricks/Firefox4onCentOS5

Update: the same goes to firefox 5

Firefox 4 and Firefox 5 on CentOS 5 ( reemplace firefox4 for firefox5 and all its the same)

With the release of Firefox 4 by mozilla.com, the version of libstdc++ in CentOS 5.x does not meet the requirements to run this version of Firefox. The error that you will get if you do a normal Firefox install is this:

<path_to>/firefox-bin: <path_to>/libstdc++.so.6: version GLIBCXX_3.4.9 not found (required by <path_to>/libxul.so)

This issue is described in this mozillazine forum entry (Firefox 4.0b9 and CentOS 5.5). The fixes below will work for Version 4.0 of Firefox and CentOS 5.6 as well.

Mozilla has decided that they will not fix issue as noted in their bugzilla (Bug 621704).

The way around this is to put a version of libstdc++.so.6 from a Fedora version which will run on CentOS-5 and meet the requirements of Firefox-4 in the Firefox-4 directory along with the other Firefox libraries. Since you will be using an unsupported version of libstdc++.so.6, it is very important that you ONLY put this library in Firefox directory and not in a normal system location as this will make it available to other programs.

The following packages are required to be installed as prerequisites to run Firefox 4 from the mozilla.com website:

  • alsa-lib
  • atk
  • cairo
  • dbus-libs
  • expat
  • fontconfig
  • freetype
  • glib2
  • glibc
  • gtk2
  • libcap
  • libgcc
  • libICE
  • libjpeg
  • libpng
  • libSM
  • libX11
  • libXau
  • libXcursor
  • libXdmcp
  • libXext
  • libXfixes
  • libXi
  • libXinerama
  • libXrandr
  • libXrender
  • libXt
  • pango
  • xulrunner
  • zlib

You can install them with the following command:

yum install alsa-lib atk cairo dbus-libs expat fontconfig freetype glib2 glibc gtk2 libcap libgcc libICE libjpeg libpng libSM libX11 libXau libXcursor libXdmcp libXext libXfixes libXi libXinerama libXrandr libXrender libXt pango xulrunner zlib

 

i386 Install

You will want to get the latest version of Firefox 4 from the Mozilla website (Note, this is the latest 4.0 install for en-US. For other languages or versions you can navigate the site from the link below. The current tarball name is firefox-4.0.tar.bz2):

Firefox 4.0 i686

You will also want to download an appropriate version of libstdc++.so.6, in this case the version from Fedora 9 i386 will work:

libstdc++-4.3.0-8.i386.rpm

Once you have both packages, you will extract them into a directory like this:

mkdir firefox4
mv firefox-4.0.tar.bz2 libstdc++-4.3.0-8.i386.rpm firefox4
cd firefox4
tar xvjf firefox-4.0.tar.bz2

The above will leave you with a firefox directory at this level. Now we need to extract the libstdc++ rpm and copy the libstdc++.so file to that firefox directory:

mkdir libstdc
cd libstdc
rpm2cpio ../libstdc++-4.3.0-8.i386.rpm | cpio -idv
cp usr/lib/libstdc++.so.6.0.10 ../firefox/libstdc++.so.6
cd ..

Now you should be back into your firefox4 directory and you should have copied the library into the firefox directory. This command should show you that you have it in the correct place:

ls firefox/libstdc++.so.6

The result should be:

firefox/libstdc++.so.6

You are now ready to deploy the firefox directory where ever you want to run it from. I normally put it in /usr/lib/firefox-4. First I get root like this:

su

Then I change the owner to root and copy the files this this:

chown -R root.root firefox
cp -a firefox /usr/lib/firefox-4

Now you can exit the root shell and run firefox with the command:

/usr/lib/firefox-4/firefox

 

x86_64 Install

You will want to get the latest version of Firefox 4 from the Mozilla website (Note, this is the latest 4.0 install for en-US. For other languages or versions you can navigate the site from the link below. The current tarball name is firefox-4.0.tar.bz2):

Firefox 4.0 x86_64

You will also want to download an appropriate version of libstdc++.so.6, in this case the version from Fedora 9 x86_64 will work:

libstdc++-4.3.0-8.x86_64.rpm

Once you have both packages, you will extract them into a directory like this:

mkdir firefox4
mv firefox-4.0.tar.bz2 libstdc++-4.3.0-8.x86_64.rpm firefox4
cd firefox4
tar xvjf firefox-4.0.tar.bz2

The above will leave you with a firefox directory at this level. Now we need to extract the libstdc++ rpm and copy the libstdc++.so file to that firefox directory:

mkdir libstdc
cd libstdc
rpm2cpio ../libstdc++-4.3.0-8.x86_64.rpm | cpio -idv
cp usr/lib64/libstdc++.so.6.0.10 ../firefox/libstdc++.so.6
cd ..

Now you should be back into your firefox4 directory and you should have copied the library into the firefox directory. This command should show you that you have it in the correct place:

ls firefox/libstdc++.so.6

The result should be:

firefox/libstdc++.so.6

You are now ready to deploy the firefox directory where ever you want to run it from. I normally put it in /usr/lib64/firefox-4. First I get root like this:

su

Then I change the owner to root and copy the files this this:

chown -R root.root firefox
cp -a firefox /usr/lib64/firefox-4

Now you can exit the root shell and run firefox with the command:

/usr/lib64/firefox-4/firefox