• How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7


    How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7

    The problem

    Google developers seem to think that Red Hat Enterprise Linux 6 - aka RHEL 6 - and its free equivalents (e.g. CentOS 6 and Scientific Linux 6) are no longer worth supporting at all w.r.t. their Google Chrome browser from version 28 onwards. This is mainly because Google are using very recent Linux build systems which produce backwards-incompatible binaries. This really isn't a wise move when you're shipping closed source binaries.

    It seems Google missed the fact that RHEL/CentOS 6 are both fully supported by their respective maintainers until November 2020. Sadly, Mozilla Firefox 46+ has gone the same way - it has system requirements that RHEL/CentOS 6 no longer meets. Unfortunately, I've failed find a solution - the switch to GTK+3 with Firefox is just too difficult to workaround.

    I've built Chromium from regularly pulled source code in the past for CentOS 5 and it's a tough job on that platform and I didn't want to do it again for CentOS 6. Note that RHEL/CentOS 7 users are also catered for, so please keep reading if you're on that platform. Also please note that 32-bit Google Chrome for Linux is no longer supported by Google and is no longer available for download.

    The solution

    By using a later libstdc++ library and putting it in a tree exclusively picked up by Google Chrome, you can indeed run the latest 64-bit Google Chrome on 64-bit RHEL/CentOS 6.6 or later. CentOS 6 systems need libstdc++ from a gcc 6.1.0 build (I supply a 339K download of that library from this site - if you are concerned about this, please read this explanation). There is also a small patch to the libgnome-keyring library required to resolve a missing symbol.

    The download

    It's strongly recommended that you run "yum update" as root (and reboot if this installs a new kernel) before you download and run the script below. This will often fix previously known issues when running Google Chrome.

    install_chrome.sh 7.31 (15th May 2016 - wget is now installed/updated early on, added dbus and selinux-policy as new dependencies, out-of-date dependencies are now updated)

    It's a bash shell script, so you download and run it as root as follows:

    wget http://chrome.richardlloyd.org.uk/install_chrome.sh
    chmod u+x install_chrome.sh
    ./install_chrome.sh
    

    The script has optional command line arguments - here's the output of "./install_chrome.sh -h":

    Syntax: ./install_chrome.sh [-b] [-d] [-f [-f [-f]]] [-h] [-n] [-q] [-s]
            [-t tmpdir] [-u] [-U]
    
    -b (or --beta) will switch to beta versions (google-chrome-beta).
    -d (or --delete) will delete the temporary directory used for downloads
       if an installation was successful.
    -f (or --force) forces an automatic "y" for any interactive prompting
       except for OS mismatch/OS upgrade/reboot prompts. Specify -f twice to force
       it for OS mismatches or OS upgrades as well and three times for reboots
       on top of that.
    -h (or -? or --help) will display this syntax message.
    -n (or --dryrun) will show what actions the script will take,
       but it won't actually perform those actions.
    -q (or --quiet) will switch to "quiet mode" where minimal info is displayed.
       Specify -q twice to go completely silent except for errors.
    -s (or --stable) will switch to stable versions (google-chrome-stable),
       which is the default if -b or -U haven't previously been specified.
    -t tmpdir (or --tmpdir tmpdir) will use tmpdir as the temporary directory
       parent tree rather than $TMPDIR (if set) or /tmp.
    -u performs an uninstallation of Google Chrome and chrome-deps rather the
       default action of an installation.
    -U (or --unstable) will switch to unstable versions (google-chrome-unstable).
    

    I would recommend you read the comments at the top of the script and inspect the code carefully since you need to run it as root. It will perform a fair number of downloads to obtain what it needs and if it finishes successfully, you should be able to run the "google-chrome" command (or select it from the Internet category in your GNOME main menu) as a non-root user.

    The support banner displayed by RHEL/CentOS 6 Google Chrome 48+

    Google Chrome 48 onwards now checks the glibc version and will display a beige banner on startup that the environment is not supported if glibc is less than version 2.17 (which it is in RHEL/CentOS 6). Despite the banner, RHEL/CentOS 6 still runs the latest Google Chrome OK, but this may not be the case with future releases.

    The dropping of NPAPI support for plug-ins (especially Java)

    In a stunningly stupid move, Linux Google Chrome 35 onwards no longer supports the NPAPI plug-in protocol used by almost all browser plug-ins, instead preferring the PPAPI protocol. The biggest impact this has is to disable Java applets inside the browser, so if you need to use Java applets regularly, I'm afraid I'd have to recommend switching browsers (e.g. to Mozilla Firefox) until there's a Linux Java implementation that supports PPAPI.

    The changelog

    • Version 7.40 (15th May 2016):
      If wget isn't installed (e.g. it's a minimal CentOS 6 install) or it's out-of-date, download and install it. dbus and selinux-policy (if SELinux is enabled) dependencies have been added, which may help minimal installs. Note that if dbus isn't running on CentOS 6, it's now started and also enabled via chkconfig for future reboots. If any of the main dependencies are out-of-date, they will now be updated (this is particularly critical for nss and selinux-policy, which won't work on an unpatched 6.7 install).
    • Version 7.31 (29th April 2016):
      The Google Chrome binary seems to dynamically load libexif.so.12 at runtime which caused me to miss libexif off the dependencies list, so it's finally been added in. A new gcc 6.1.0 release triggered an update to this script because a new matching libstdc++ library has been built for download. Updated the library build instructions (a little bit more than the usual gcc/library version number edits).
    • Version 7.30 (5th March 2016):
      Google completely removed the 32-bit Linux Google Chrome repository a few days ago, so I have similarly removed 32-bit support from my script. Out-of-date kernels may have slipped through with a warning, so definitely enforce an error for them now.
    • Version 7.24 (13th February 2016):
      Adjusted year references to 2016 - belated Happy New Year! Removed last mentions of LD_PRELOAD, though it could come back in a future release (oh no, the kittens...). Added 32-bit deprecation warning - it's likely the next script version will no longer support 32-bit platforms. Use CentOS 7.2.1511 for 32-bit libstdc++ with 7.1.503 as a fallback.
    • Version 7.23 (15th December 2015):
      Forgot to bump the chrome-deps version with the 7.22 release, so it's been changed to version 3.12 (thanks to Steve Mowbray for spotting this). wget now uses the --no-cache option to bypass cached versions of files to avoid a cached version.dat screwing things up during script upgrades (yep, this happened in a big way with the 7.22 release). If you run a kernel older than 2.6.32-431.el6 and refuse (or fail) to upgrade it or refuse to reboot after such an upgrade, this is now considered a fatal error.
    • Version 7.22 (12th December 2015):
      gcc 5.3.0 was released this month, so time to update libstdc++ again. A few users had noticed that I'd been letting pre-RHEL/CentOS 6.6 users continue with just a warning about Google Chrome not working on their OS. This very predictably caused problems later on, so this release now makes RHEL/CentOS 6.6 a mandatory minimum.
    • Version 7.21 (23rd July 2015):
      The recent gcc 5.2.0 release has meant that the downloadable libstdc++ has been rebuilt with that new release. A new libstdc++ checksum/size meant a new script release of course.
    • Version 7.20 (7th June 2015):
      If the running kernel is too old (which causes Google Chrome to immediately crash), offer to update it and reboot. If you decline or the update fails, this is only a warning only at the moment, but it will be a fatal error in a future script release. I hadn't done a dry run (-n) for quite a while and John Stembridge spotted a couple of issues with it. Firstly, it output a wrong yum repo path and secondly it incorrectly tried to create a spec file - both issues have been fixed. No longer needed the ironically-titled remove_redundant_libs() function, so it's been removed.
    • Version 7.13 (24th April 2015):
      Updated downloadable 64-bit libstdc++.so.6 to be one built with gcc 5.1.0. This changed the checksum and size (the latter increasing by 60%!), which is why there is a new release of the script with the new checksum/size values present. The library build instructions were also updated, including new --disable-multiarch and --disable-multilib flags, plus using the stage 3-built library instead of the stage 2 one.
    • Version 7.12 (10th April 2015):
      CentOS 7 did its first "move old release to vault.centos.org", which promptly broke the 32-bit libstdc++ RPM download. Corrected the URLs appropriately (try mirror.centos.org version first, then fallback to vault.centos.org version).
    • Version 7.11 (23rd February 2015):
      It turns out that the soft-link I added to the chrome-deps-* RPM became a "Requires:", so I resolved this by also making it a "Provides:". Thanks to Raymond Page for spotting this issue.
    • Version 7.10 (6th February 2015):
      No longer need to LD_PRELOAD the unset_var.so library (one of the major causes of orphaned kitten deaths apparently) because the more recent libstdc++ works with sub-processes fired off from Google Chrome without unset_var.so being used. An old "missing" function (gnome_keyring_attribute_list_new) came back to bite us after the removal of the patched libgnome-keyring.so.0, so created a new copy of that with the function version rather than CentOS 6's macro version. Needed some convoluted code involving two compilations and a new soft-link in the chrome-deps-* RPM (you really don't want to know!). Added gnome-keyring as a dependency just in case the system library isn't installed.
    • Version 7.00 (2nd February 2015):
      Discovered that only a more recent libstdc++ is now needed (either from a 64-bit gcc build or the CentOS 7 libstdc++ 32-bit RPM), but only if the user is at version 6.6 of the OS or later. Raised the minimum OS version to 6.6 because of that and cleaned up any old libraries lying around (including removing Fedora 15's libc and banishing any potential GHOST vulnerability). Now use %_topdir for the RPM build dir (thanks to Bob Hepple for this). Removed a lot of library-modifying code, so this release is unusually slightly smaller than the previous one.
    • Version 6.10 (29th August 2014):
      Google Chrome 37 introduced a very kludgy redirect of stdout/stderr so that it ended up running 2 copies of cat for the duration of the session, both of which crashed due to LD_LIBRARY_PATH issues with the previous 6.00 release. Redirected stdout/stderr to /dev/null instead. Added "Obsoletes: chrome-deps" to the RPM spec file for anyone still having the old chrome-deps RPM around.
    • Version 6.00 (27th July 2014):
      After many years installing into the same /opt/google/chrome tree for all 3 RPM releases (stable, beta, unstable), Google suddenly decided to split the install trees. This meant a fair amount of new code was needed to deal with this, although the dumb inclusion of the /usr/bin/google-chrome soft-link in 3 RPM manifests means that the whole purpose of the split (to allow all 3 RPM releases to be simultaneously installed) is ruined. Added PackageKit as a new dependency (some live CentOS DVDs don't install this package, but the Google Chrome RPM needs it). Fixed a bad grep during the beta/unstable RPM install by creating a soft-link for google-chrome.desktop. chrome-deps RPM has been renamed to chrome-deps-(stable|beta|unstable) and any old-named chrome-deps RPM will be removed. Removed the no longer needed CentOS 7 repo code. Re-wrote the wrapper to handle all 3 RPM types because Google have dubiously left the defaults for all 3 in the same /etc/default/google-chrome file.
    • Version 5.02 (10th July 2014):
      CentOS 7 final is out, so I removed the pre-release repo code and the .repo file it created if it's present. Google Chrome will fail in any pre-6.5 OS release, so refuse to continue if the user won't upgrade to 6.5 or later. Changed equivalent RHEL and CentOS references to be RHEL/CentOS.
    • Version 5.01 (26th June 2014):
      The latest pre-release CentOS 7 live ISO creates placeholder .repo files which messed up the repo-creating code I'd put in 5.00. This has been corrected by checking that the .repo files have at least one non-blank/non-comment line in them (they don't at the moment!).
    • Version 5.00 (21st June 2014):
      Added initial 64-bit RHEL/CentOS 7 (pre-release) support that's been tested in a VM. This involved possibly creating an updates repo file if no repos are found and not building the chrome-deps RPM on RHEL/CentOS 7 of course. Upped the minimum RHEL/CentOS 6 release supported by the script to version 6.5. Tidied up some of the final messages output by the script.
    • Version 4.70 (17th May 2014):
      Finally fix the 2-hourly segfault that was appearing in syslog. It was a self-call to the google-chrome bash script which was fixed by unsetting LD_LIBRARY_PATH before the self-call. Steve Cleveland suggested a non-interactive mode to allow the script to be cron'ed, so I added a -f flag (specify up to 3 times depending on what prompting you want eliminated) to provide this.
    • Version 4.60 (12th April 2014):
      Latest Google Chrome prompted me for a keyring password, which I eventually realised was because of an undefined gnome_keyring_attribute_list_new symbol. Turns out this first appeared in an F17 library, so I've had to download F17's libgnome-keyring RPM and extract libgnome-keyring.so.0 from it. I had no idea people managed to get a RHEL/CentOS 6 install with no nss package (must be some sort of minimal install I guess), so that's been added. Thanks to Ravi Saive at tecmint.com for suggesting this, though no-one actually told me the issue directly :-( Check the size and cksum of a downloaded Fedora RPM after the download as well as before (duh!).
    • Version 4.50 (11th December 2013):
      If Google Chrome execs a helper app and that app then execs another sub-process, then LD_PRELOAD would mess up that second sub-process. This has been fixed by saving, unsetting and restoring LD_PRELOAD around the point where the helper app is exec'ed (an example would be file-roller viewing .tar.gz downloads). Previously downloaded F15 RPMs are now checksummed and size-checked on subsequent script runs. If they don't match, they are deleted and re-downloaded. This is a special non-raw-orphan-kitten-eating release just for a certain CentOS mailing list member :-)
    • Version 4.41 (9th December 2013):
      A user reported that glibc-devel wasn't present (causing the gcc compilation to fail), so I've added this in as a dependency. Removed the SELinux warning at the end of the script because enforcing mode seems to not upset nacl_helper in recent Google Chrome releases. Fedora 15 RPMs have moved to the archive site, so adjusted the code to only download from the archive site. Primary testing is now with CentOS 6.5 and Scientific Linux 6.4.
    • Version 4.40 (5th October 2013):
      The same user who reported the 4.30 issue found another missing symbol, this time in the Fedora 15 libgtk-x11-2.0 library. The symbol is defined in the Fedora 15 libgdk_pixbuf-2.0 library, so that is now extracted from the additionally downloaded Fedora 15 gdk-pixbuf2 RPM. The chrome-deps RPM is therefore now at version 1.03.
    • Version 4.30 (4th October 2013):
      A user reported a missing symbol that was tracked down to the Fedora 15 libgio-2.0 library. That library and its libgobject-2.0 dependency are now additionally extracted and included in the chrome-deps RPM (which was bumped to version 1.02).
    • Version 4.20 (22nd August 2013):
      If possible, use "yum check-update google-chrome-stable" ahead of the OmahaProxy CSV site to look for updates. Any newer version can be installed rather than insisting on the exact OmahaProxy version (after a full day being out-of-date after the Google Chrome 29 launch, we can't trust it not to happen on each new release). Used some extra params to the OmahaProxy request to narrow the data down more precisely. Google Chrome 29 doesn't wrongly output dbus messages like version 28 did, so the terminal warning was removed.
    • Version 4.10 (8th August 2013):
      Fixed Google Talk (Hangouts) plugin crash by unsetting LD_LIBRARY_PATH when it's run (yes, for some reason, the plugin is built with an older toolchain than Google Chrome itself). Some users are reporting i686 is used in their RPM build path instead of i386 - I couldn't reproduce this, but I've added code to work around this anyway. modify_wrapper no longer outputs anything to stdout if it successfully updates /opt/google/chrome/google-chrome.
    • Version 4.01 (30th July 2013):
      Emergency 2-char bug fix because I found a 4th build environment that triggered an rpmbuild bug (parses % directives on a commented line in a spec file). Removed the two percent chars on a comment line and it works again. No idea why my normal three build environments didn't show this problem (one of them is literally a VM image of a clean desktop right after a CentOS 6 install).
    • Version 4.00 (30th July 2013):
      New chrome-deps RPM is built that includes 7 Fedora libraries (libdl.so.2 added for this release), unset_vars.so (updated slightly) and a modify_wrapper script that is run post-install to add code to /etc/default/google-chrome to modify google-chrome if its LD_PRELOAD addition isn't present. modify_wrapper will also enable the Google Chrome repo. Download/installation of google-chrome-stable/chrome-deps dependencies is now prompted for. Don't remove /etc/cron.daily/google-chrome or /etc/yum.conf.d/google-chrome.repo any more. Added -t (temp dir parent location) option and also -s (stable), -b (beta) and -U (unstable) options to switch release channels.
    • Version 3.20 (27th July 2013):
      Compile and install LD_PRELOAD functions that wrap around exec*() routines, bringing in gcc as a new dependency. The functions save/blank LD_LIBRARY_PATH, call the original routines and, if they return, restore LD_LIBRARY_PATH. This is an initial effort to stop helper apps/plugins from crashing when run from within Google Chrome.
    • Version 3.11 (25th July 2013):
      If SELinux is enabled, set appropriate SELinux contexts on Fedora libraries in /opt/google/chrome/lib and that directory itself. If SELinux is enabled and in enforcing mode, display a warning that permissive mode (with a reboot) is required to get nacl_helper to run correctly.
    • Version 3.10 (24th July 2013):
      Use .so.0 extension (instead of .so.3 in earlier releases) for renamed Fedora ld-linux library. Also changed references to ld-linux*.so.0 in ld-linux, libc and libstdc++ Fedora libraries. Thanks to Marcus Sundberg for this suggestion. Dependency list for Google Chrome RPM is now redhat-lsb, wget, xdg-utils GConf2, libXScrnSaver and libX11 (1.5+). Hangs/errors occurred with a CentOS 6.0 VM I ran Google Chrome under, but 6.4 is fine, so that's now the minimum OS version requirement (script offers to upgrade 6.0-6.3 to the latest release - if declined, the script aborts).
    • Version 3.00 (21st July 2013):
      Added command line options at long last. -d will remove /tmp/chrome_install at the end of the script. -h shows syntax help. -n displays a dry run of what it would do without actually doing anything. -q reduces the output messages to the minimum needed and -q -q silences the output completely apart from fatal errors. -u uninstalls the Fedora libraries and the Google Chrome RPM. Abort script if it detects Google Chrome is running. Display disk/file usage (only if files are present) for /opt/google/chrome and /tmp/chrome_install at the start and end of the script. If it's defined, use $TMPDIR instead of /tmp. Install Fedora libraries before the Google Chrome RPM (was the other way around). Don't download Fedora RPMs and/or unpack them if the Fedora libraries are already installed in /opt/google/chrome/lib - this speeds up second and later runs (e.g. for Google Chrome upgrades) significantly.
    • Version 2.10 (20th July 2013):
      Can detect if Fedora 15 RPMs have been moved to the archive site and will download from there instead if they have. Fixed incorrect check for lsb dependency. Remove a cron file and repo file installed by the Google Chrome RPM. Simplistic check that OS is an RHEL/CentOS 6 derivative. Early exits now run clean up routine. Downloads all go through one function that will restore any pre-existing file if the download fails.
    • Version 2.00 (14th July 2013):
      32-bit support added thanks to prodding from Seva Epsteyn. Version check both installed and downloaded Google Chrome against the OmahaProxy CSV list and only download/install if out-of-date. Use updated Fedora 15 RPMs rather than the original ISO versions. Warn if an enabled Google Chrome repo is present. General code tidy ups and more/readable messages are output now too.
    • Version 1.10 (13th July 2013):
      Added auto-update check because the number of versions today is getting somewhat crazy. Also fixed an incorrect skip of force-installing a downloaded Chrome RPM (if any previous Chrome RPM had been installed, it would have never installed a new one!).
    • Version 1.02 (13th July 2013):
      Added --no-check-certificate to wget command (my testing didn't need it, but someone reported that their wget did need it). Also yum install wget if it's not on the system.
    • Version 1.01 (13th July 2013):
      Fixed the bad variable that plagued version 1.00.
    • Version 1.00 (13th July 2013):
      Downloads latest Chrome and some Fedora 15 RPMs, installs lsb and some extracted libraries from the F15 RPMs. Had a last-minute bad variable added that broke the Chrome download completely. :-(

    The TODO list

    • The first-time install and run of Google Chrome on a non-KDE system produces some xdg-mime errors. This is a bug in the xdg-utils package that I've reported to Red Hat, so you'll have to wait for them to fix it.
    • It would be nice to prevent the beige support banner appearing every time you start up Google Chrome on CentOS 6. Replacing glibc/libpthread with a newer release didn't seem to work, so any clues to help with this would be most welcome.

    The compatibility note

    Please note that RHEL/CentOS 6 and 7 references on this page should hopefully equally cover all RHEL/CentOS 6 and 7 derivatives. I have now moved to CentOS 7 on bare metal, but do CentOS 6 testing in a 64-bit VM. Someone's bound to ask: no, the script won't work with RHEL/CentOS 5 or earlier.

    The feedback

    Any bugs, fixes, improvements or suggestions should be fed back to me, Richard K. Lloyd, at rklloyd@gmail.com but please note there is no warranty on this product whatsoever and the script itself is in the public domain. Bemusingly, one ultimate feedback was a tutorial video someone uploaded to YouTube!

    The defence (no, it doesn't eat raw orphaned kittens)

    Apparently one of the guys on the CentOS mailing list really doesn't like my script, claiming that it "consumes raw orphaned kittens" and "should be classified as a criminal offense". Here's my response:

    • I'm now using libstdc++ built from the latest gcc source, so the issue of using potentially vulnerable old libraries has now been resolved.
    • There is no LD_PRELOAD library code any more either, not that there was anything wrong with that code in the first place anyway!
    • To produce a single script that does everything (including root-only RPM installs) obviously requires root access. Yes, in theory, you could skip root-requiring actions if you're not root, but these are so intermingled in the code flow (e.g. you need to install some prerequisite RPMs and even upgrade your OS if it's pre-6.6 before you even get to build the chrome-deps RPM), that it would be extremely clumsy to try to split root vs. non-root actions.
    • The script doesn't consume raw orphaned kittens - more like raw orphaned Google build systems!

    The ChromeDriver server (Web app developers only)

    If you're a Web app developer and have just installed Google Chrome via my script, you may also be trying to run the ChromeDriver server on RHEL/CentOS 6 to automate the testing of your app. Sadly, after downloading and unpacking it (and making sure you got the latest 32-bit or 64-bit version), you'll find it has a familiar library problem very similar to Google Chrome's. However, this is easily fixed by simply using the extra libraries from your Google Chrome installation:

    export LD_LIBRARY_PATH=/opt/google/chrome/lib
    ./chromedriver
    [Should output: Starting ChromeDriver (v2.9.248304) on port 9515]
    

    The non-solution at Red Hat's Customer Portal

    I was bemused to find this on the Red Hat Customer Portal. Basically, it says "Google Chrome doesn't install in RHEL 6", gives a bunch of failed yum install outputs and, er, that's it. Even funnier is that it has a capitalised green "SOLUTION VERIFIED" statement just below the heading :-) Maybe they need to link to this page...

    The Chromecast

    If you have a Chromecast, you can install the Google Cast extension in Google Chrome by going to the Extensions section of the Chrome Web store and searching for "Google Cast". You can then cast a tab from your RHEL/CentOS Google Chrome, though it can be laggy. More info (from a UK/Linux/Android perspective) about Chromecast can be found on my sister site.

    Here is the url:  http://chrome.richardlloyd.org.uk/

    Google Chrome was installed successfully.
    Please run the browser via the 'google-chrome' command as a non-root user.

    To update Google Chrome, run "yum update google-chrome-stable" or
    simply re-run this script with "./install_chrome.sh".

    To uninstall Google Chrome,
    run "yum remove google-chrome-stable " or "./install_chrome.sh -u".

  • 相关阅读:
    Python中的logging模块
    Windows 域(domain)
    linux下查看某软件是否已安装, ubuntu安装deb包
    linux之iptables
    linux之flock函数锁文件
    《上班赚钱,下班理财》
    Get the image file(s) some informations,Including the Make,Model,Date/Time,etc
    java中的Integer的toBinaryString()方法
    面试题中遇到的SQL题目
    get和post方法的区别
  • 原文地址:https://www.cnblogs.com/flying607/p/5628495.html
Copyright © 2020-2023  润新知