`

fedora 17 安装chrome

 
阅读更多

 

(1)运行sh脚本向yum repo添加chrome源,运行下面的命令
sudo sh google-repo-setup.sh
(2)用yum安装chrome
yum install google-chrome-stable

 

 

#!/bin/bash
#
# Copyright 2007 Google Inc. All Rights Reserved.

KEYNAME=linux_signing_key.pub
PUBKEYURL="https://dl-ssl.google.com/linux/$KEYNAME"
REPOURL="http://dl.google.com/linux"
DEBREPO="$REPOURL/deb"
RPMREPO="$REPOURL/rpm"
ARCH=$(uname -m)
DRYRUN=0

export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin

usage () {
  echo "Usage: $(basename $0) [-h] [-n]"
  echo "-n  Don't make any chanages, just show what would happen."
  echo "-h  Show this help message."
}

writetempfile () {
  if [ $DRYRUN -eq 0 ]; then
    TEMPFILE=$(mktemp -q)
    if [ $? -ne 0 ]; then
      echo "ERROR: couldn't create temp file."
      exit 1
    fi
    TEMPFILES="$TEMPFILES \"$TEMPFILE\""
    FN="$TEMPFILE"
  else
    FN=/dev/stdout
    # So we have something to print during dry run.
    TEMPFILE="dry-run"
  fi

  while [ $# -gt 0 ]; do
    echo "$1" >> "$FN"
    shift
  done
}

# Start with 2 because sudo/su use 0/1 internally for return values.
ROOTEXITBASE=2
ROOTEXITLAST=$ROOTEXITBASE
ROOTCOMMANDS=""
declare -a HANDLERS
queuecmd () {
  local OPTNAME
  local OPTIND

  while getopts ":e:" OPTNAME
  do
    case $OPTNAME in
      e )
        HANDLERS[$ROOTEXITLAST]="$OPTARG"
      ;;
    esac
  done
  shift $(($OPTIND - 1))

  CMD=$1
  shift

  local ARGS=""
  while [ $# -gt 0 ]; do
    ARGS="$ARGS\"$1\" "
    shift
  done

  if [ $DRYRUN -eq 0 ]; then
    if [ "${HANDLERS[$ROOTEXITLAST]}" ]; then
      ROOTCOMMANDS="$ROOTCOMMANDS $CMD $ARGS || RETVAL=\$((RETVAL+$((2**ROOTEXITLAST++)))) ;"
    else
      ROOTCOMMANDS="$ROOTCOMMANDS $CMD $ARGS;"
    fi
  else
    echo "DRY-RUN: $CMD $ARGS"
  fi
}

handlerooterror () {
  EXITCODE=$1
  while [ $((ROOTEXITLAST--)) -ge $ROOTEXITBASE ]; do
    if [ $((2**$ROOTEXITLAST & $EXITCODE)) -ne 0 ]; then
      if [ "${HANDLERS[$ROOTEXITLAST]}" ]; then
        ${HANDLERS[$ROOTEXITLAST]}
      else
        echo
        echo "ERROR: Unhandled exit code from root shell: $1."
      fi
    fi
  done
}

see_webdocs () {
  echo "Please see http://www.google.com/linuxrepositories/index.html"
  echo "for information on configuring your system manually."
}

repoconfig_error () {
  echo
  echo "ERROR: Couldn't configure repository settings in '$1'."
  see_webdocs
  echo
}

keyadd_error () {
  echo
  echo "ERROR: The package signing key could not be installed."
  see_webdocs
  echo
}

repoapp_error () {
  echo
  echo "ERROR: Couldn't configure repository using $1."
  see_webdocs
  echo
}

configRPM () {
  queuecmd echo "Installing Google package signing key for RPM..."
  queuecmd -e keyadd_error rpm --import $KEYFILE
}


#=========
# MAIN
#=========
while getopts ":nh" OPTNAME
do
  case $OPTNAME in
    n )
      DRYRUN=1
      echo "--------------------------------------------------------------"
      echo "Performing dry run. No changes will be made to your system."
      echo "--------------------------------------------------------------"
      echo
      ;;
    h )
      usage
      exit 0
      ;;
    \: )
      echo "'-$OPTARG' needs an argument."
      usage
      exit 1
      ;;
    * )
      echo "ERROR: invalid command-line option: $OPTARG"
      echo
      usage
      exit 1
      ;;
  esac
done
shift $(($OPTIND - 1))

# Try to detect the package manager based on distro rules. We could try to
# detect the package management programs directly, but that might be confusing
# if a system has more than one installed (e.g. an APT-based system might have
# rpm installed to be LSB-compliant).
if [ ! "$PACKAGEMANAGER" ]; then
if [ -f /etc/lsb-release ]; then
  eval $(sed -e '/DISTRIB_ID/!d' /etc/lsb-release)
  case $DISTRIB_ID in
  *buntu)
    PACKAGEMANAGER=apt
    ;;
  esac
fi
fi

if [ ! "$PACKAGEMANAGER" ]; then
if [ -f /etc/debian_release ] || [ -f /etc/debian_version ]; then
  PACKAGEMANAGER=apt
fi
fi

if [ ! "$PACKAGEMANAGER" ]; then
if [ -f /etc/fedora-release ]; then
  PACKAGEMANAGER=yum
fi
fi

if [ ! "$PACKAGEMANAGER" ]; then
if [ -f /etc/SuSE-release ]; then
  PACKAGEMANAGER=yast
fi
fi

if [ ! "$PACKAGEMANAGER" ]; then
if [ -f /etc/mandriva-release ]; then
  PACKAGEMANAGER=urpmi
fi
fi

if [ ! "$PACKAGEMANAGER" ]; then
if [ -f /etc/redhat-release ] || [ -f /etc/redhat_version ]; then
  PACKAGEMANAGER=rpm
fi
fi

if [ ! "$PACKAGEMANAGER" ]; then
  echo "ERROR: Unsupported or unknown package management system."
  see_webdocs
  exit 1
else
  echo "Configuring for '$PACKAGEMANAGER' package manager."
fi
echo

FETCHCMD=""
if [ ! "$FETCHCMD" ]; then
  FETCHPROG=$(which curl 2>/dev/null)
  if [ "$FETCHPROG" ]; then
    FETCHCMD="$FETCHPROG -s $PUBKEYURL"
  fi
fi
if [ ! "$FETCHCMD" ]; then
  FETCHPROG=$(which wget 2>/dev/null)
  if [ "$FETCHPROG" ]; then
    FETCHCMD="$FETCHPROG -q -O - $PUBKEYURL"
  fi
fi
if [ ! "$FETCHCMD" ]; then
  FETCHPROG=$(which w3m 2>/dev/null)
  if [ "$FETCHPROG" ]; then
    FETCHCMD="$FETCHPROG -dump_source $PUBKEYURL"
  fi
fi
if [ ! "$FETCHCMD" ]; then
  FETCHPROG=$(which links 2>/dev/null)
  if [ "$FETCHPROG" ]; then
    FETCHCMD="$FETCHPROG -source $PUBKEYURL"
  fi
fi
if [ ! "$FETCHCMD" ]; then
  FETCHPROG=$(which lynx 2>/dev/null)
  if [ "$FETCHPROG" ]; then
    FETCHCMD="$FETCHPROG -source $PUBKEYURL"
  fi
fi

if [ ! "$FETCHCMD" ]; then
  echo "ERROR: Couldn't find a program to use to download signing key."
  echo "ERROR: Please install wget, curl, w3m, links, or lynx."
  exit 1
else
  echo "Using '$FETCHPROG' to download key."
fi
echo

if [ $DRYRUN -eq 0 ]; then
  $FETCHCMD > $KEYNAME
  if [ $? -eq 0 ]; then
    chmod a+r $KEYNAME
    KEYFILE="$(pwd)/$KEYNAME"
  else
    echo "ERROR: Failed to download Google key from $PUBKEYURL."
    exit 1
  fi
else
  # So we have something to print during dry run.
  KEYFILE="dry-run"
fi
echo "Key file is '$KEYFILE'."
echo

case $PACKAGEMANAGER in
  apt)
    APTKEYPROG=$(which apt-key 2>/dev/null)
    # If they don't have apt-key, it's not secure APT, so they can't check
    # package sigs.
    if [ ! "$APTKEYPROG" ]; then
      echo "WARNING: You don't appear to be running a signature-aware version of APT."
      echo "WARNING: The Google package signing key won't be installed,"
      echo "WARNING: and package downloads won't be validated."
      echo
    else
      queuecmd echo "Installing Google package signing key..."
      queuecmd -e keyadd_error $APTKEYPROG add "$KEYFILE"
    fi

    queuecmd echo "Adding Google repository to APT sources..."
    DEBLINE="deb $DEBREPO/ stable non-free main"

    eval `apt-config shell APTBASEDIR "Dir" APTDIRETC "Dir::Etc" APTSOURCELIST "Dir::Etc::sourcelist" APTSOURCELISTD "Dir::Etc::sourceparts"`
    # Try to keep our customizations separate.
    if [ "$APTSOURCELISTD" ]; then
      LISTFILE="$APTBASEDIR$APTDIRETC$APTSOURCELISTD/google.list"
      writetempfile \
        "# Google software repository" \
        "$DEBLINE"
      queuecmd -e "repoconfig_error $LISTFILE" cp -f "$TEMPFILE" "$LISTFILE"
      queuecmd chmod a+r "$LISTFILE"

    # Otherwise use the global sources.list.
    else
      LISTFILE="$APTBASEDIR$APTDIRETC$APTSOURCELIST"
      # Don't add it if it's already there.
      grep -q -s "^$DEBLINE" "$LISTFILE"
      if [ $? -gt 0 ]; then
        writetempfile "" \
          "# Google software repository" \
          "$DEBLINE"
        queuecmd -e "repoconfig_error $LISTFILE" sh -c "cat '$TEMPFILE' >> '$LISTFILE'"
      fi
    fi
    queuecmd echo "added to '$LISTFILE'"
    echo

    # Refresh the index files to make sure our apps show up immediately.
    queuecmd echo "Syncing repository index..."
    queuecmd apt-get -qq update
    ;;

  yum)
    configRPM
    if [ -d "/etc/yum.repos.d" ]; then
      queuecmd echo "Adding Google repository to YUM configs..."
      # On x86_64 distro, hardcode the arch of the repository.
      if [ "$ARCH" = "x86_64" ]; then
        YUMARCH="i386"
      else
        YUMARCH="\$basearch"
      fi
      REPOFILE=/etc/yum.repos.d/google.repo
      writetempfile \
        "[google]" \
        "name=Google - $YUMARCH" \
        "baseurl=$RPMREPO/stable/$YUMARCH" \
        "enabled=1" \
        "gpgcheck=1"
      queuecmd -e "repoconfig_error $REPOFILE" cp -f "$TEMPFILE" "$REPOFILE"
      queuecmd chmod a+r "$REPOFILE"
      queuecmd echo "created '$REPOFILE'"
    else
      echo "WARNING: YUM repository configs not found."
      echo "WARNING: Google repository will not be added."
    fi
    echo
    ;;

  yast)
    # Don't need to do rpm key install separately since yast should find
    # repomd.xml.asc file automatically.
    queuecmd echo "Adding Google repository to YaST2 configs..."
    queuecmd -e "repoapp_error zypper" \
      zypper sa -t YUM $RPMREPO/stable/i386 google
    echo
    ;;

  urpmi)
    # Don't need to do rpm key install separately since urpmi should find pubkey
    # file automatically.
    queuecmd echo "Adding Google repository to urpmi configs..."
    queuecmd -e "repoapp_error urpmi.addmedia" \
      urpmi.addmedia google $RPMREPO/stable/i386 with hdlist.cz
    echo
    ;;

  rpm)
    echo "WARNING: Unable to configure this system to use Google's APT or YUM
    repositories."
    echo
    configRPM
    ;;
esac

SHELLCMD="RETVAL=0 ; $ROOTCOMMANDS exit \$RETVAL"

# If this isn't a dry run, and we're not root yet, become root to run the
# queued commands.
if [ "$ROOTCOMMANDS" ] && [ `id -u` != '0' ]; then
  echo "WARNING: You are not running as root, but repository configuration"
  echo "WARNING: requires root privileges."
  echo
  echo "Attempting to become root..."

  # Try sudo. Some systems don't have users configured in /etc/sudoers by
  # default. Mandriva doesn't even install sudo by default.
  SUDOPRG=$(which sudo 2>/dev/null)
  if [ "$SUDOPRG" ]; then
    echo "Trying 'sudo'. Enter your password when prompted."
    $SUDOPRG -k
    $SUDOPRG sh -c "$SHELLCMD"
    res=$?
  else
    res=1
  fi
  if [ $res -eq 1 ]; then
    echo
    echo "WARNING: Failed to invoke 'sudo'."
    # Try su. This won't work on systems that don't have a root password by
    # default (e.g. Ubuntu), but those should have sudo configured by default.
    echo "Trying 'su'. Enter root's password when prompted."
    su root -c "$SHELLCMD"
    res=$?
    if [ $res -eq 1 ]; then
      echo
      echo "ERROR: Could not gain root privileges."
      echo "ERROR: Please re-run from a root login."
      exit 1
    fi
  fi

  # Check if root shell exited with one of our errors.
  if [ $res -ge $ROOTEXITBASE ]; then
    handlerooterror $res
    exit $res
  fi
elif [ "$ROOTCOMMANDS" ]; then
  sh -c "$SHELLCMD"
fi

# Cleanup.
if [ "$TEMPFILES" ]; then
  eval "rm $TEMPFILES"
fi
echo
echo "Done."
 

参考网站;http://code.google.com/p/lpotato/source/browse/trunk/

 

分享到:
评论

相关推荐

    Fedora 26 chrome 60

    Fedora 26 chrome 60

    centos6安装chrome

    这篇博文将指导我们如何在CentOS 6上安装Chrome。由于官方的Chrome浏览器并不直接支持旧版的CentOS,我们需要采取一些额外的步骤来实现安装。 首先,我们需要更新系统的软件包。在终端中输入以下命令来更新yum仓库...

    chrome 28.0.rpm redhat,fedora,centOs适用

    chrome.rpm redhat,fedora,centOs适用,

    chrome 最新114版 64 位 .rpm(适用于 Fedora/openSUSE)

    Chrome是一款由Google公司开发的网页浏览器。该浏览器基于其他开源软件(如WebKit)撰写,目标是提升稳定性、速度和安全。Google Chrome 是一款快速、易用且安全的网络浏览器。此版 Chrome 是专为windows10 64位设计...

    centos 安装chrome浏览器资源

    然而,对于习惯使用Chrome浏览器的用户来说,可能需要在CentOS上安装这款流行的浏览器。本篇文章将详细介绍如何在CentOS系统中安装Google Chrome。 首先,了解一点背景知识:由于Chrome官方并未直接提供针对CentOS...

    fedora,opensuse等系列的chrome浏览器rpm包

    最新版的谷歌浏览器的rpm包,适合fedora,opensuse等redhat系列的linux安装,传上来分享给大家!

    linux安装chrome

    本篇文章将详细介绍如何在不同的Linux发行版上安装Chrome,包括Ubuntu、Debian、Fedora、CentOS等。 首先,我们需要了解的是,Google Chrome官方并没有在Linux的软件仓库中提供预编译的二进制包,而是提供了.deb...

    Google chrome 历史所有版本rpm包&chromedriver对应rpm版本rpm包下载地址.docx

    针对Linux系统的用户,Chrome提供了RPM格式的安装包,适用于Red Hat Enterprise Linux、Fedora、CentOS等基于RPM的发行版。通过RPM包安装Chrome可以确保软件与系统的兼容性,并简化安装过程。 #### 二、Google ...

    fedora29repo.tar.gz

    6. **chrome**:Google Chrome是一款广泛使用的网页浏览器,其在Fedora中的安装通常需要添加额外的软件源,因为官方仓库可能不包含最新版本的Chrome。 【标签】中的"fedora aliyun源 repo文件 dnf"进一步强调了这个...

    安装fedora16后需要做的事情

    ### 安装Fedora 16后的必要步骤与软件配置 #### 一、概述 本文档将详细介绍在安装Fedora 16操作系统之后,为了更好地适应工作与生活的需要,需要进行的一系列配置与软件安装。这些操作将帮助用户获得一个功能更加...

    chrome-deps-stable-3.11-1.i386_chrome_

    描述中的"Installation for chrome to centOS"清楚地告诉我们,这个压缩包的目的是为了在CentOS操作系统上安装Chrome浏览器。CentOS是一个基于Linux的开源操作系统,常用于服务器环境,因此这个包对于那些在CentOS...

    google-chrome-stable_current_x86_64.rpm.zip

    总的来说,这个压缩包提供了一种在64位Linux环境下安装Google Chrome稳定版的方法,用户需要了解如何在Linux中使用RPM命令或者通过包管理器来完成安装。同时,理解RPM包管理和Linux的文件系统结构对于成功安装和使用...

    chrome-linux64-123.0.6312.58

    这个压缩包包含了所有必要的文件,使得用户能够在Linux环境下安装和运行Chrome浏览器。 首先,我们来了解Linux操作系统。Linux是一种自由和开放源代码的操作系统,与Windows和macOS不同,它主要基于Unix。Linux有...

    chromedriver&google-chrome-stable-123.0.6312.122-1.x86-64-rpm包

    1. "google-chrome-stable-123.0.6312.122-1.x86_64.rpm":这是Google Chrome浏览器的安装包,用于在Linux系统上安装和管理Chrome。 2. "chromedriver-123.0.6312.122-1.fc40.x86_64.rpm":这是Chromedriver的安装包...

    安装Fedora_15后需做的25件事情

    12. **安装 Google Chrome**:从Google官方站点下载RPM包,按照指示进行安装。 13. **安装 LibreOffice**:如果没有预装,可以从LibreOffice官网下载并按照说明安装办公套件。 14. **安装 Thunderbird**:`sudo ...

    Fedora_19办公注意的19件事

    【Fedora 19 办公环境配置与常用软件安装】 Fedora 19 是一款基于 Linux 的操作系统,被广泛认为是一款性能强大的发行版,能够替代传统的Mac或Windows系统。以下是在Fedora 19中进行系统配置和安装常用软件的一些...

    google-chrome-stable_deb_rpm_60.0.3112.113.zip

    2. "google-chrome-stable_current_x86_64_60.0.3112.113.rpm" - 这是相同版本的RPM安装包,同样适用于64位系统,但使用的是RPM包管理系统,常见于Fedora、CentOS、RHEL等Linux发行版。 Google Chrome是一款由...

Global site tag (gtag.js) - Google Analytics