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
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
Ah, I guess I need to retract that comment. It probably a 32bit link. You just need to update the link to http://releases.mozilla.org/pub/mozilla.org/firefox/releases/13.0.1/linux-x86_64/en-US/firefox-13.0.1.tar.bz2
Thanks
Thanks for the comment. I wanted to include the download.mozilla.org link but as you found it isn’t very reliable. Further, for me at least, it always downloaded a Windows client even though I specified Linux. I changed the wget command to be a little more reliable and current. It now points to the latest and recursively gets anything in there ignoring indexes and parent links.
Note that on the wget command the trailing slash is important otherwise you start getting stuff in the parent directory and end up with whatever language is last that it downloads.
BTW, what missing on my machine was libstdc++, and libXRender. Installable via yum. Maybe other reader may face the same issue.
I’ll double check these dependencies. Thanks!
[...] Install Firefox on Amazon Linux X86_64 Compiling GTK+ is not something I have had to do. But then again, I haven’t tried. [...]
Why not simply do “yum install firefox” instead?
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.
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
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
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!
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”.
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
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.
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.
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
Thank you so much
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.
I think this has to do with SSH meta key mappings. Check out this article here: http://stackoverflow.com/questions/12190349/alt-key-not-working-in-emacs-sshing-x11
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.