{"id":1241,"date":"2022-05-11T06:18:27","date_gmt":"2022-05-10T22:18:27","guid":{"rendered":"https:\/\/wp.vicds.com\/?p=1241"},"modified":"2022-05-23T11:01:36","modified_gmt":"2022-05-23T03:01:36","slug":"apt-yum-%e5%82%bb%e5%82%bb%e5%88%86%e4%b8%8d%e6%b8%85%e6%a5%9a","status":"publish","type":"post","link":"https:\/\/wp.vicds.com\/?p=1241","title":{"rendered":"apt yum \u50bb\u50bb\u5206\u4e0d\u6e05\u695a"},"content":{"rendered":"\n<p>\u6700\u8fd1\u5e38\u9047\u5230centos. \u4e5f\u6c92\u4ec0\u9ebc, \u7528uname\u6216\u8005lsb_relead\u5c31\u77e5\u9053\u662f\u54ea\u500bdistribution.<\/p>\n\n\n\n<p>\u4f46\u662f\u5728\u5bebbash\u7684\u6642\u5019\u5c31\u6bd4\u8f03\u9ebb\u7169\u4e86.<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u5e7e\u500b\u5224\u65b7\u7684\u65b9\u5f0f.<\/p>\n\n\n\n<p>\u53c3\u8003\u81ea <a href=\"https:\/\/raw.githubusercontent.com\/v2fly\/fhs-install-v2ray\/master\/install-release.sh\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/raw.githubusercontent.com\/v2fly\/fhs-install-v2ray\/master\/install-release.sh<\/a><\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">identify_the_operating_system_and_architecture() {\n        if [[ &quot;$(uname)&quot; == &#039;Linux&#039; ]]; then\n                case &quot;$(uname -m)&quot; in\n                        &#039;i386&#039; | &#039;i686&#039;)\n                                MACHINE=&#039;32&#039;\n                                ;;\n                        &#039;amd64&#039; | &#039;x86_64&#039;)\n                                MACHINE=&#039;64&#039;\n                                ;;\n                        &#039;armv5tel&#039;)\n                                MACHINE=&#039;arm32-v5&#039;\n                                ;;\n                        &#039;armv6l&#039;)\n                                MACHINE=&#039;arm32-v6&#039;\n                                grep Features \/proc\/cpuinfo | grep -qw &#039;vfp&#039; || MACHINE=&#039;arm32-v5&#039;\n                                ;;\n                        &#039;armv7&#039; | &#039;armv7l&#039;)\n                                MACHINE=&#039;arm32-v7a&#039;\n                                grep Features \/proc\/cpuinfo | grep -qw &#039;vfp&#039; || MACHINE=&#039;arm32-v5&#039;\n                                ;;\n                        &#039;armv8&#039; | &#039;aarch64&#039;)\n                                MACHINE=&#039;arm64-v8a&#039;\n                                ;;\n                        &#039;mips&#039;)\n                                MACHINE=&#039;mips32&#039;\n                                ;;\n                        &#039;mipsle&#039;)\n                                MACHINE=&#039;mips32le&#039;\n                                ;;\n                        &#039;mips64&#039;)\n                                MACHINE=&#039;mips64&#039;\n                                ;;\n                        &#039;mips64le&#039;)\n                                MACHINE=&#039;mips64le&#039;\n                                ;;\n                        &#039;ppc64&#039;)\n                                MACHINE=&#039;ppc64&#039;\n                                ;;\n                        &#039;ppc64le&#039;)\n                                MACHINE=&#039;ppc64le&#039;\n                                ;;\n                        &#039;riscv64&#039;)\n                                MACHINE=&#039;riscv64&#039;\n                                ;;\n                        &#039;s390x&#039;)\n                                MACHINE=&#039;s390x&#039;\n                                ;;\n                        *)\n                                echo &quot;error: The architecture is not supported.&quot;\n                                exit 1\n                                ;;\n                esac\n                if [[ ! -f &#039;\/etc\/os-release&#039; ]]; then\n                        echo &quot;error: Don&#039;t use outdated Linux distributions.&quot;\n                        exit 1\n                fi\n                # Do not combine this judgment condition with the following judgment condition.\n                ## Be aware of Linux distribution like Gentoo, which kernel supports switch between Systemd and OpenRC.\n                ### Refer: https:\/\/github.com\/v2fly\/fhs-install-v2ray\/issues\/84#issuecomment-688574989\n                if [[ -f \/.dockerenv ]] || grep -q &#039;docker\\|lxc&#039; \/proc\/1\/cgroup &amp;&amp; [[ &quot;$(type -P systemctl)&quot; ]]; then\n                        true\n                elif [[ -d \/run\/systemd\/system ]] || grep -q systemd &lt;(ls -l \/sbin\/init); then\n                        true\n                else\n                        echo &quot;error: Only Linux distributions using systemd are supported.&quot;\n                        exit 1\n                fi\n                if [[ &quot;$(type -P apt)&quot; ]]; then\n                        PACKAGE_MANAGEMENT_INSTALL=&#039;apt -y --no-install-recommends install&#039;\n                        PACKAGE_MANAGEMENT_REMOVE=&#039;apt purge&#039;\n                        package_provide_tput=&#039;ncurses-bin&#039;\n                elif [[ &quot;$(type -P dnf)&quot; ]]; then\n                        PACKAGE_MANAGEMENT_INSTALL=&#039;dnf -y install&#039;\n                        PACKAGE_MANAGEMENT_REMOVE=&#039;dnf remove&#039;\n                        package_provide_tput=&#039;ncurses&#039;\n                elif [[ &quot;$(type -P yum)&quot; ]]; then\n                        PACKAGE_MANAGEMENT_INSTALL=&#039;yum -y install&#039;\n                        PACKAGE_MANAGEMENT_REMOVE=&#039;yum remove&#039;\n                        package_provide_tput=&#039;ncurses&#039;\n                elif [[ &quot;$(type -P zypper)&quot; ]]; then\n                        PACKAGE_MANAGEMENT_INSTALL=&#039;zypper install -y --no-recommends&#039;\n                        PACKAGE_MANAGEMENT_REMOVE=&#039;zypper remove&#039;\n                        package_provide_tput=&#039;ncurses-utils&#039;\n                elif [[ &quot;$(type -P pacman)&quot; ]]; then\n                        PACKAGE_MANAGEMENT_INSTALL=&#039;pacman -Syu --noconfirm&#039;\n                        PACKAGE_MANAGEMENT_REMOVE=&#039;pacman -Rsn&#039;\n                        package_provide_tput=&#039;ncurses&#039;\n                else\n                        echo &quot;error: The script does not support the package manager in this operating system.&quot;\n                        exit 1\n                fi\n        else\n                echo &quot;error: This operating system is not supported.&quot;\n                exit 1\n        fi\n}\n\n<\/code><\/pre>\n\n\n\n<p>\u53e6\u5916\u6293\u662f\u5426root\u6b0a\u9650<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-\">check_if_running_as_root() {\n        # If you want to run as another user, please modify $UID to be owned by this user\n        if [[ &quot;$UID&quot; -ne &#039;0&#039; ]]; then\n                echo &quot;WARNING: The user currently executing this script is not root. You may encounter the insufficient privilege error.&quot;\n                read -r -p &quot;Are you sure you want to continue? [y\/n] &quot; cont_without_been_root\n                if [[ x&quot;${cont_without_been_root:0:1}&quot; = x&#039;y&#039; ]]; then\n                        echo &quot;Continuing the installation with current user...&quot;\n                else\n                        echo &quot;Not running with root, exiting...&quot;\n                        exit 1\n                fi\n        fi\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5e38\u9047\u5230centos. \u4e5f\u6c92\u4ec0\u9ebc, \u7528un [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-1241","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/wp.vicds.com\/index.php?rest_route=\/wp\/v2\/posts\/1241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.vicds.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.vicds.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.vicds.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.vicds.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1241"}],"version-history":[{"count":2,"href":"https:\/\/wp.vicds.com\/index.php?rest_route=\/wp\/v2\/posts\/1241\/revisions"}],"predecessor-version":[{"id":1243,"href":"https:\/\/wp.vicds.com\/index.php?rest_route=\/wp\/v2\/posts\/1241\/revisions\/1243"}],"wp:attachment":[{"href":"https:\/\/wp.vicds.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.vicds.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.vicds.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}