Install Firefox on Amazon Linux x86_64 Compiling GTK+

Amazon Linux doesn’t offer the Gimp Tool Kit (GTK+) so if you want to run Firefox on an Amazon Linux system, say for Selenium testing, you are left having to compile the system yourself.  Luckily you have found this post.  Create the script below, run it as root and it will build all the components needed for GTK+ and its dependencies for Firefox to run just fine on the system.

vi ./gtk-firefox
chmod 755 ./gtk-firefox
sudo ./gtk-firefox

After you have built the packages, add the /usr/local/bin to your path by updating your .bashrc file.

cat << EOF >> ~/.bashrc
PATH=/usr/local/bin:\$PATH
export PATH
EOF

Here is the gtk-firefox file for your pleasure.

If you are running OSX Mountain Lion or above and cannot get Firefox to run via the SSH -X command, make sure you have XQuartz installed as Apple removed X11 by default.

Edited to make Firefox latest release more reliable. Updated with Gist.

Edit 11/21/2012: Added dbus-glib dependency to gist. Added notes about running on OSX

About these ads

21 thoughts on “Install Firefox on Amazon Linux x86_64 Compiling GTK+

  1. For the firefox tarbal, i think it’s better to use this URL: http://download.mozilla.org/?product=firefox-13.0.1&os=linux&lang=en-US

    Current one yields 404

  2. BTW, what missing on my machine was libstdc++, and libXRender. Installable via yum. Maybe other reader may face the same issue.

  3. [...] Install Firefox on Amazon Linux X86_64 Compiling GTK+ is not something I have had to do. But then again, I haven’t tried. [...]

  4. Why not simply do “yum install firefox” instead?

    • joekiller says:

      Because as the first sentence in the article states, “Amazon Linux doesn’t offer the Gimp Tool Kit (GTK+) so if you want to run Firefox on an Amazon Linux system, say for Selenium testing, you are left having to compile the system yourself.”

      Have you tried yum install firefox on Amazon linux? It doesn’t work.

      [ec2-user@ip-10-4-178-74 ~]$ uname -r
      3.2.30-49.59.amzn1.x86_64
      [ec2-user@ip-10-4-178-74 ~]$ sudo yum install firefox
      Loaded plugins: priorities, security, update-motd, upgrade-helper
      amzn-main | 2.1 kB 00:00
      amzn-updates | 2.3 kB 00:00
      Setting up Install Process
      No package firefox available.
      Error: Nothing to do

  5. Hey @joekiller, your solution is the only one which worked for me, thanks a lot for the contribution.

    I created a gist to keep it updated! ;)

    https://gist.github.com/4121839

    • joekiller says:

      Thanks Pablo. I had the same idea but never posted it. I got lost while considering how to implement a version that would at at least pull the “LATEST” links from the gnome.org sources. Another idea was to just make a continuous build of the packages for everyone so no more compilation. I’ll use your gist but here was mine: https://gist.github.com/3991486

  6. bin wang says:

    Can you tell me after this set up, where is the .mozilla folder located? I want to use the default file… thanks for your effort to write this up!

    • joekiller says:

      Bin,

      By default the .mozilla folder should end up in the user’s home directory that is running firefox. Try looking at your home directory with the command “ls -alt ~”.

      You can also specify a profile location by running “firefox -profile ” where profile path is a directory that you want the profile to be stored in such as ~/mozilla-profile.

      Finally you can also run the profile manager with “firefox -p”. If that doesn’t work or it crashes, try “firefox -p -safe-mode”.

  7. Hi joekiller,

    Thank you for your post. I have followed step to install firefox on AWS EC2 Linux AMI. The installation is success. But, I get this error when I want to run

    XPCOMGlueLoad error for file /usr/local/firefox/libxpcom.so:
    libdbus-glib-1.so.2: cannot open shared object file: No such file or directory
    Couldn’t load XPCOM.

    What should I do?

    Thank you

    • joekiller says:

      Normally that dependency is taken care of by dbus-glib. Can you confirm it is installed? Try an “apt-get install dbus-glib” to fix the issue.

      • Hi joe,

        Thanks for reply. You are correct. I need to install dbus-glib. But, after that it shows another “lib” error. I tried to install pango-devel to solve libpangoft. It shows libgtk error then. Anyway, I use Amazon Linux AMI which means I use Redhat 4.4.

      • joekiller says:

        First of all, make sure you are on a 64-bit machine. These instructions are for 64-bit only. That aside if you are 64-bit, try rerunning the script and looking for compilation errors.

  8. Do you install the firefox on non-gui machine? Sorry, I haven’t told you that I need to install firefox on non-gui machine in purpose to run selenium headless

  9. Petry Sianipar says:

    Thank you so much :D

  10. Jack C says:

    Got linux firefox window to show up on Mountain Lion (XQuartz) Display. Everything looks great, but it does not take mouse or key board inputs, any ideas what are missing? Thanks.

  11. Joe, you rock. For real.

    I was trying to set a Selenium headless server for 4 days, almost giving up. Thx, dude. I owe you a beer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: