0

我下载了 ZendServer 安装程序的最新版本,它包含简单的 shell 脚本。当我尝试如下运行 shell 脚本时,它显示一条消息 无法安装:您的发行版不适合使用 Zend 的 DEB/RPM 存储库进行安装。

   .....  ZendServer-RepositoryInstaller-linux]# ./install_zs.sh 5.5 ce

修改: install_zs.sh 如下

      #!/bin/sh

        usage()
        {
        cat <<EOF

        Usage: $0 <php_version> [nginx] [java] [--automatic]
        Where php_version is either 5.3 or 5.4.

        EOF
        return 0
        }

        # on OEL, /etc/issue states "Enterprise Linux Enterprise Linux Server"
        SUPPORTED_OS='CentOS|Red Hat Enterprise Linux Server|Enterprise Linux Enterprise Linux Server|SUSE|Debian GNU/Linux|Ubuntu|Oracle Linux Server'

        if ! egrep -q "$SUPPORTED_OS" /etc/issue ; then
        cat <<EOF

        Unable to install: Your distribution is not suitable for installation using
        Zend's DEB/RPM repositories. 

        EOF
            exit 1
        fi

        # -v or --version
        if [ "$1" = "-v" -o "$1" = "--version" ]; then
            echo "`basename $0` version 6.1.0 (build: \$Revision: 72681 $)"
            usage
            exit 0
        fi

        # -h or --help
        if [ "$1" = "-h" -o "$1" = "--help" ]; then
            usage
            exit 0
        fi

        # No parameters
        if [ $# -lt 1 ]; then
            usage
            exit 2
        fi

        # Verify parameter
        if [ "$1" != "5.3" -a "$1" != "5.4" ]; then
            usage
            exit 2
        else
            PHP=$1
            if [ "$2" = "nginx" ]; then
                shift
                NGINX="nginx"
                WHAT_TO_INSTALL="zend-server-nginx-php-$PHP"
            else
                WHAT_TO_INSTALL="zend-server-php-$PHP"
            fi

            if [ "$2" = "java" ]; then
                shift
                WHAT_TO_INSTALL="$WHAT_TO_INSTALL php-$PHP-java-bridge-zend-server"
            fi
        fi


        MYUID=`id -u 2> /dev/null`
        if [ ! -z "$MYUID" ]; then
            if [ $MYUID != 0 ]; then
            echo "You need root privileges to run this script.";
            exit 2
            fi
        else
            echo "Could not detect UID";
            exit 2
        fi

        cat <<EOF

        Running this script will perform the following:
        * Configure your package manager to use Zend Server repository 
        * Install Zend Server (PHP $PHP) on your system using your package manager

        EOF

        if [ "$2" = "--automatic" ]; then
            if which zypper > /dev/null 2>&1; then
                AUTOMATIC="-n --gpg-auto-import-keys"
            else
                AUTOMATIC="-y"
            fi
        else
            AUTOMATIC=""
        fi

        if [ -z "$AUTOMATIC" ]; then
        cat <<EOF
        Hit ENTER to install Zend Server (PHP $PHP), or Ctrl+C to abort now.
        EOF
        # give read a parameter, as it required in dash
        read answer
        fi

        # Upgrade check
        UPGRADE=0
        echo -n "Tool for checking existing installation: "
        if which dpkg 2> /dev/null; then
            INSTALLED_PACKAGES=`dpkg -l '*zend*' | grep ^ii | awk '{print $2}'`
            if `dpkg -l "zend-server*" | grep ^ii | grep -q -E "php-5|cluster-manager"`; then
                UPGRADE=1;
            fi
        elif which rpm 2> /dev/null; then
            INSTALLED_PACKAGES=`rpm -qa --qf="%{NAME}\n" '*zend*'`
            if `rpm -qa | grep "^zend-server" | grep -q -E "php-5|cluster-manager"`; then
                UPGRADE=1;
            fi
        else
            echo
            echo "Your system doesn't support either dpkg or rpm"
            exit 2
        fi

        # Check if upgrade is allowed
        if [ "$UPGRADE" = "1" ]; then
            if [ -f /etc/zce.rc ]; then
                . /etc/zce.rc
            fi

            echo "Found existing installation of Zend Server ($PRODUCT_VERSION)"

            INSTALLED_PHP=`/usr/local/zend/bin/php -v | head -1 | cut -f2 -d" "`
            INSTALLED_PHP_MAJOR=`echo $INSTALLED_PHP | cut -f1,2 -d"."`

            if [ "$INSTALLED_PHP" = "5.3.15" -o "$INSTALLED_PHP" = "5.4.5" ]; then
                echo "Upgrade from ZendServer 6.0 Beta isn't supported."
                exit 2
            elif [ "$INSTALLED_PHP" = "5.4.0-ZS5.6.0" ]; then
                echo "Upgrade from ZendServer 5.6.0 with PHP 5.4 technology preview isn't supported."
                exit 2
            elif echo "$INSTALLED_PACKAGES" | grep -q cluster-manager; then
                echo "Upgrade from ZendServer cluster manager isn't supported."
                exit 2
            elif [ "$PRODUCT_VERSION" = "5.0.4" -o "$PRODUCT_VERSION" = "5.1.0" -o "$PRODUCT_VERSION" = "5.5.0" ]; then
                echo "Upgrade from version $PRODUCT_VERSION isn't supported."
                exit 2
            elif [ "$INSTALLED_PHP_MAJOR" = "5.4" -a "$PHP" = "5.3" ]; then
                echo "Downgrade from PHP $INSTALLED_PHP_MAJOR to $PHP isn't supported."
                exit 2
            elif echo "$INSTALLED_PACKAGES" | grep -q nginx && [ -z "$NGINX" ]; then
                echo "Zend Server with nginx cannot be upgraded to a different installation type of Zend Server."
                echo "Please uninstall Zend Server and perform a clean installation."
                exit 2
            elif ! (echo "$INSTALLED_PACKAGES" | grep -q nginx) && [ -n "$NGINX" ]; then
                echo "The Zend Server installation type you are currently using cannot be upgraded to Zend Server with nginx."
                echo "Please uninstall Zend Server and perform a clean installation."
                exit 2
            fi

        fi

        # Set nginx.org repository 
        if [ "$NGINX" = "nginx" ]; then
            `dirname $0`/nginx/install_nginx.sh
            if [ $? != 0 ]; then
                exit 2
            fi
        fi

        # Set repository 
        echo -n "Doing repository configuration for: "
        if which apt-get 2> /dev/null; then
            if grep -q -E "Debian GNU/Linux 5|Debian GNU/Linux 6|Ubuntu 10" /etc/issue; then
                REPO_FILE=`dirname $0`/zend.deb.repo
            else
                # This is the default for Debian >> 6 and Ubuntu >> 10.04
                REPO_FILE=`dirname $0`/zend.deb_ssl1.0.repo
            fi

            TARGET_REPO_FILE=/etc/apt/sources.list.d/zend.list
            SYNC_COMM="apt-get update"
            wget http://repos.zend.com/zend.key -O- 2> /dev/null | apt-key add -
        elif which yum 2> /dev/null; then
            if [ -d /etc/yum/repos.d ]; then
                # OpenSUSE
                REPO_FILE=`dirname $0`/zend.rpm.suse.repo
                TARGET_REPO_FILE=/etc/yum/repos.d/zend.repo

                # Change arch in the repo file 
                if [ "`uname -m`" == "x86_64" ]; then
                    ARCH=x86_64;
                elif [ "`uname -m`" == "i686" ]; then
                    ARCH=i586;
                fi
                SYNC_COMM="sed -i \"s/\\\$basearch/$ARCH/g\" ${TARGET_REPO_FILE};"
            else
                # Fedora / RHEL / Centos
                REPO_FILE=`dirname $0`/zend.rpm.repo
                TARGET_REPO_FILE=/etc/yum.repos.d/zend.repo
            fi
            if [ "$UPGRADE" = "1" ]; then
                SYNC_COMM="$SYNC_COMM yum clean all"
            fi
        elif which zypper 2> /dev/null; then
            REPO_FILE=`dirname $0`/zend.rpm.suse.repo
            TARGET_REPO_FILE=/etc/zypp/repos.d/zend.repo
            if [ "$UPGRADE" = "1" ]; then
                SYNC_COMM="zypper clean -a"
            fi

            mkdir -p /etc/zypp/repos.d

            # Change arch in the repo file 
            if [ "`uname -m`" == "x86_64" ]; then
                ARCH=x86_64;
            elif [ "`uname -m`" == "i686" ]; then
                ARCH=i586;
            fi
            SYNC_COMM="sed -i \"s/\\\$basearch/$ARCH/g\" ${TARGET_REPO_FILE}; $SYNC_COMM"
        else
            echo
            echo "Can't determine which repository should be setup (apt-get, yum or zypper)"
            exit 2
        fi

        cp $REPO_FILE $TARGET_REPO_FILE
        if [ $? != 0 ]; then
            echo
            echo "***************************************************************************************"
            echo "* Zend Server Installation was not completed. Can't setup package manager repository. *" 
            echo "***************************************************************************************"
            exit 2
        fi

        if [ -n "$SYNC_COMM" ]; then
            eval $SYNC_COMM
        fi

        RC=0


        # Clean Installation
        if [ "$UPGRADE" = "0" ]; then
            echo -n "Package manager for installation: "
            if which aptitude 2> /dev/null; then
                aptitude $AUTOMATIC install $WHAT_TO_INSTALL
                RC=$?
            elif which apt-get 2> /dev/null; then
                apt-get $AUTOMATIC install $WHAT_TO_INSTALL
                RC=$?
            elif which yum 2> /dev/null; then
                yum $AUTOMATIC install $WHAT_TO_INSTALL
                RC=$?
            elif which zypper 2> /dev/null; then
                zypper $AUTOMATIC install $WHAT_TO_INSTALL
                RC=$?
            else
                echo
                echo "Can't determine which package manager (aptitude, apt-get, yum or zypper) should be used for installation of $WHAT_TO_INSTALL"
                exit 2
            fi
        fi

        # Upgrade
        if [ "$UPGRADE" = "1" ]; then
            if [ -f /etc/zce.rc ]; then
                . /etc/zce.rc
            fi

            # Backup etc
            BACKUP_SUFFIX=$PRODUCT_VERSION

            if [ ! -d $ZCE_PREFIX/etc-$BACKUP_SUFFIX ]; then
                mkdir $ZCE_PREFIX/etc-$BACKUP_SUFFIX
            fi

            cp -rp $ZCE_PREFIX/etc/* $ZCE_PREFIX/etc-$BACKUP_SUFFIX/

            if [ ! -d $ZCE_PREFIX/lighttpd-etc-$BACKUP_SUFFIX ]; then
                mkdir $ZCE_PREFIX/lighttpd-etc-$BACKUP_SUFFIX
            fi

            cp -rp $ZCE_PREFIX/gui/lighttpd/etc/* $ZCE_PREFIX/lighttpd-etc-$BACKUP_SUFFIX/

            echo -n "Package manager for upgrade: "
            if [ "$INSTALLED_PHP_MAJOR" = "$PHP" ]; then
                # Same PHP upgrade
                if which aptitude 2> /dev/null; then
                    aptitude $AUTOMATIC install '~izend'
                    RC=$?
                elif which apt-get 2> /dev/null; then
                    apt-get $AUTOMATIC install $WHAT_TO_INSTALL
                    RC=$?
                    apt-get $AUTOMATIC install `dpkg -l '*zend*' | grep ^ii | awk '{print $2}'`
                elif which yum 2> /dev/null; then
                    yum $AUTOMATIC upgrade '*zend*'
                    RC=$?
                elif which zypper 2> /dev/null; then
                    zypper $AUTOMATIC update '*zend*'
                    RC=$?
                else
                    echo
                    echo "Can't determine which package manager (aptitude, apt-get, yum or zypper) should be used for upgrade to $WHAT_TO_INSTALL"
                    exit 2
                fi
            else
                # PHP upgrade

                EXTRA_PACKAGES="zend-server-framework-dojo zend-server-framework-extras source-zend-server pdo-informix-zend-server pdo-ibm-zend-server ibmdb2-zend-server java-bridge-zend-server \-javamw-zend-server"
                WHAT_TO_INSTALL_EXTRA=""

                # Find which extra packages we have and should be installed
                for package in $EXTRA_PACKAGES; do 
                    EXTRA_PACKAGE=`echo "$INSTALLED_PACKAGES" | grep $package | sed "s/$INSTALLED_PHP_MAJOR/$PHP/g"`
                    if [ -n "$EXTRA_PACKAGE" ]; then
                        WHAT_TO_INSTALL_EXTRA="$WHAT_TO_INSTALL_EXTRA $EXTRA_PACKAGE"
                    fi
                done

                if which apt-get 2> /dev/null; then
                    apt-get $AUTOMATIC install $WHAT_TO_INSTALL $WHAT_TO_INSTALL_EXTRA
                    RC=$?
                elif which yum 2> /dev/null; then
                    yum $AUTOMATIC remove "zend-server*-php-5.*" && yum $AUTOMATIC remove "deployment-daemon-zend-server" && yum $AUTOMATIC remove "*zend*"
                    yum $AUTOMATIC install $WHAT_TO_INSTALL $WHAT_TO_INSTALL_EXTRA
                    RC=$?
                elif which zypper 2> /dev/null; then
                    zypper $AUTOMATIC remove "zend-server*-php-5.*" && zypper $AUTOMATIC remove "deployment-daemon-zend-server" && zypper $AUTOMATIC remove "*zend*"
                    zypper $AUTOMATIC install $WHAT_TO_INSTALL $WHAT_TO_INSTALL_EXTRA
                    RC=$?
                else
                    echo
                    echo "Can't determine which package manager (aptitude, apt-get, yum or zypper) should be used for upgrade to $WHAT_TO_INSTALL"
                    exit 2
                fi
            fi
        fi

        if [ $RC -eq 0 ]; then
            echo
            echo "***********************************************************"
            echo "* Zend Server was successfully installed.         *"
            echo "*                             *"
            echo "* To access the Zend Server UI open your browser at:  *"
            echo "* https://<hostname>:10082/ZendServer (secure)        *" 
            echo "* or                          *" 
            echo "* http://<hostname>:10081/ZendServer          *" 
            echo "***********************************************************"
        else
            echo
            echo "************************************************************************************************"
            echo "* Zend Server Installation was not completed. See output above for detailed error information. *" 
            echo "************************************************************************************************"
        fi
        echo

        exit $RC

我正在使用 Fedora 19,但我没有弄清楚我的问题可能是什么。我的发行版是 RMP 有谁能解决我的问题吗?

4

1 回答 1

0

您可以通过编辑 install_zs.sh 文件来解决此问题,您必须在其中添加操作系统描述。如果您在此处发布该文件的内容,我可以向您展示如何操作。
在 Linux Mint 上安装 Zend Server 时,我也遇到了同样的事情

首先通过执行以下操作查看您的操作系统描述: cat /etc/issue

然后将描述添加到 install_zs.sh SUPPORTED_OS=' YOUR_OS_DESCRIPTION_HERE |CentOS|Red Hat Enterprise Linux Server|Enterprise Linux Enterprise Linux Server|SUSE|Debian GNU/Linux|Ubuntu|Oracle Linux Server'

保存并再次运行安装。那应该解决它。

于 2013-09-04T18:18:32.630 回答