Create a gist now

Instantly share code, notes, and snippets.

INSTALL FIREFOX ON AMAZON LINUX X86_64 COMPILING GTK+
#!/bin/bash
# GTK+ and Firefox for Amazon Linux
# Written by Joseph Lawson 2012-06-03
# http://joekiller.com
# http://joekiller.com/2012/06/03/install-firefox-on-amazon-linux-x86_64-compiling-gtk/
# chmod 755 ./gtk-firefox.sh
# sudo ./gtk-firefox.sh
TARGET=/usr/local
function init()
{
export installroot=$TARGET/src
export workpath=$TARGET
yum --assumeyes install make libjpeg-devel libpng-devel \
libtiff-devel gcc libffi-devel gettext-devel libmpc-devel \
libstdc++46-devel xauth gcc-c++ libtool libX11-devel \
libXext-devel libXinerama-devel libXi-devel libxml2-devel \
libXrender-devel libXrandr-devel libXt dbus-glib \
libXdamage libXcomposite
mkdir -p $workpath
mkdir -p $installroot
cd $installroot
PKG_CONFIG_PATH="$workpath/lib/pkgconfig"
PATH=$workpath/bin:$PATH
export PKG_CONFIG_PATH PATH
bash -c "
cat << EOF > /etc/ld.so.conf.d/firefox.conf
$workpath/lib
$workpath/firefox
EOF
ldconfig
"
}
function finish()
{
cd $workpath
wget -r --no-parent --reject "index.html*" -nH --cut-dirs=7 http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
tar xvf firefox*
cd bin
ln -s ../firefox/firefox
ldconfig
}
function install()
{
wget $1
FILE=`basename $1`
if [ ${FILE: -3} == ".xz" ]
then tar xvfJ $FILE
else tar xvf $FILE
fi
SHORT=${FILE:0:4}*
cd $SHORT
./configure --prefix=$workpath
make
make install
ldconfig
cd ..
}
init
install ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
install http://download.savannah.gnu.org/releases/freetype/freetype-2.4.9.tar.gz
install http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.9.0.tar.gz
install http://ftp.gnome.org/pub/gnome/sources/glib/2.32/glib-2.32.3.tar.xz
install http://cairographics.org/releases/pixman-0.26.0.tar.gz
install http://cairographics.org/releases/cairo-1.12.2.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/pango/1.30/pango-1.30.0.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/atk/2.4/atk-2.4.0.tar.xz
install http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.26/gdk-pixbuf-2.26.1.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.10.tar.xz
finish
# adds the /usr/local/bin to your path by updating your .bashrc file.
cat << EOF >> ~/.bashrc
PATH=/usr/local/bin:\$PATH
export PATH
EOF
@joekiller
Owner

updated with dbus-glib requirement

@MasseGuillaume

much faster with

# make no job = no processor * 1.5
make -j$((`cat /proc/cpuinfo | grep processor | wc -l`*1.5))
@neofreko

That firefox url no longer works as Mozilla had moved the file to CDNs.

Updating the url to https://download.mozilla.org/?product=firefox-23.0.1&os=linux&lang=en-US might (not) work. I opted to manually "executing" the finish routine.

Thx a bunch bro!

UPDATE:
new url: http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/firefox-23.0.1.tar.bz2

@michaelus1976

Hello,

Note: I'm using an EC2 with the Amazon AMI.

I've run the provided gtk-firefox.sh file which apparently finished successfully extracting the firefox[XX].tar.bz2 compressed file.

After executing - yum install Xvfb and Xvfb :1 -screen 0 1280x768x24 & - commands I tried to start firefox:

find / -name firefox
cd /usr/local/bin/
./firefox

But I get:

XPCOMGlueLoad error for file /usr/local/firefox/libxul.so:
libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

I've tried to find that dependency searching in Google with no luck.

1.- I tried to install it through a .rpm file:

wget ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/updates/16/x86_64/gtk2-2.24.8-3.fc16.x86_64.rpm

2.- I tried to install it through 'yum install' following a few packages I've found in some sites, but when I'm still getting the same error message when I try to start firefox:

- yum install gtk2.i686 libXt.i686 gtk2-engines.i686 libcanberra-gtk2.i686 PackageKit-gtk-module.i686
- yum -y install gtk2

Anyone can please tell me if I'm missing something or I'm doing something wrong?
I'd really appreciate.

Thank you.

@martinbernemann

Hi michaelus1976,

I had the same issue, also using EC2.

sudo yum install libXdamage.x86_64
sudo yum install libXcomposite.x86_64

solved it for me.

Regards

@eprouty
eprouty commented Nov 26, 2014

I am getting this error when I try to run this script... any ideas? The link listed to the atk package seems to still be active.

configure: error: Package requirements (glib-2.0 >= 2.27.3    atk >= 1.29.2    pango >= 1.20    cairo >= 1.6    gdk-pixbuf-2.0 >= 2.21.0) were not met:

No package 'atk' found
No package 'gdk-pixbuf-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables BASE_DEPENDENCIES_CFLAGS
and BASE_DEPENDENCIES_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.
 EOF >> ~/.bashrc
PATH=/usr/local/bin:$PATH
export PATH
@ozhogin
ozhogin commented Jan 29, 2015

The whole setup worked perfectly for me, however after a recent update I'm getting following error on AWS EC2 Linux:
Xvfb: symbol lookup error: Xvfb: undefined symbol: pixman_glyph_cache_create
Any ideas on how to fix this?
Thank you!

@amastov
amastov commented Feb 10, 2015

I'm getting the same error on the same environment as ozhogin. Seems to be a recent problem with xvfb.

@vorbster

It is trying to load wrong pixman so. Delete /usr/local/lib/libpixman-1.so.0 and try again, it will make Xvfb use distribution pixman library which has this symbol.

@jalarto
jalarto commented Apr 17, 2015

Having the following error and can't find a way around it:

XPCOMGlueLoad error for file /usr/local/firefox/libxul.so:
libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

martinbernemann's fix yielded no success :(

@lxp149
lxp149 commented Jun 22, 2015

Worked for me just now on an Amazon Linux ami. I needed to test out my site on the east coast from the west coast. After I installed Firefox, I did ssh -X into the ec2 instance and launched Firefox, there were a couple of warnings but basically it started up fine. Thanks for the script!

@gramanathaiah

I have the same error as Eric Prouty. Any luck in resolving that?

configure: error: Package requirements (glib-2.0 >= 2.27.3 atk >= 1.29.2 pango >= 1.20 cairo >= 1.6 gdk-pixbuf-2.0 >= 2.21.0) were not met:

No package 'atk' found
No package 'gdk-pixbuf-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables BASE_DEPENDENCIES_CFLAGS
and BASE_DEPENDENCIES_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
EOF >> ~/.bashrc
PATH=/usr/local/bin:$PATH
export PATH

@silverprize

@joekiller thank you very much for this script.
How to upgrade latest firefox?

@Ema-Mu
Ema-Mu commented Jan 6, 2016

After installing on AWS EC2 Linux server using

https://ftp.mozilla.org/pub/firefox/releases/23.0.1/linux-x86_64/en-US/firefox-23.0.1.tar.bz2

I can't connect through SSL anymore i.e. I get this error after running curl -v https://www.google.com (was working fine before I run sudo ./gtk-firefox.sh, alredy tried on a new "clean" instance)
Here the verbose response

  • Rebuilt URL to: https://www.google.com/
  • Trying 216.58.210.196...
  • Connected to www.google.com (216.58.210.196) port 443 (#0)
  • Initializing NSS with certpath: sql:/etc/pki/nssdb
  • NSS error -12168 (SSL_ERROR_INVALID_VERSION_RANGE)
  • SSL version range is not valid.
  • Closing connection 0
    curl: (35) SSL version range is not valid.

I had this error also on a previous instance while installing firefox 18.

Moreover I get "No package available for libstdc++46-devel" at the beginnign of the installation.

No luck with sudo yum update.

Any clue on how to restore the right SSL version range or about what is going on?

@radusuceveanu

The only difference is that the link for download firefox is:
http://download.cdn.mozilla.net/pub/firefox/releases/43.0/linux-x86_64/en-US/

In the rest, everything is up to date and functional

@rameshmimit

XPCOMGlueLoad error for file /opt/firefox-38.0/libxul.so:
libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

RPM for libgtk-x11-2.0.so.0 library is gtk2-2.24.23-6.el6.i686, which is not present on Amazon Linux. Its present on CentOS base repo.

I am still not able to fix it... any help much appreciated.

@basilmusa

Out-dated. Dont use the script, use Amazon Linux firefox-compat package instead:

Installing the EPLL yum repository:
https://lambda-linux.io/#getting-started

Installing Firefox on Amazon Linux:
https://lambda-linux.io/blog/2015/01/28/announcing-firefox-browser-support-for-amazon-linux/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment