{"id":7992,"date":"2022-01-20T08:18:00","date_gmt":"2022-01-20T00:18:00","guid":{"rendered":"https:\/\/www.ldhost.cn\/jc\/?p=7992"},"modified":"2021-11-25T22:22:38","modified_gmt":"2021-11-25T14:22:38","slug":"%e5%9c%a8centos-7%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e5%ae%89%e8%a3%85ruby%e5%92%8cpassenger","status":"publish","type":"post","link":"https:\/\/www.ldhost.cn\/jc\/weberror\/7992.html","title":{"rendered":"\u5728CENTOS 7\u670d\u52a1\u5668\u4e0a\u5b89\u88c5RUBY\u548cPASSENGER"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"382\" src=\"https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227170905.jpg\" alt=\"\" class=\"wp-image-7997\" srcset=\"https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227170905.jpg 698w, https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227170905-300x164.jpg 300w, https:\/\/www.ldhost.cn\/jc\/wp-content\/uploads\/2021\/11\/20191227170905-150x82.jpg 150w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/figure>\n\n\n<p>\u60a8\u9700\u8981\u80fd\u591f\u4f7f\u7528 root \u6743\u9650\u901a\u8fc7SSH \u8fde\u63a5\u5230\u60a8\u7684<a href=\"https:\/\/www.ldhost.cn\/vps.html\" target=\"_blank\" rel=\"noopener\">\u670d\u52a1\u5668<\/a>\u3002\u60a8\u8fd8\u9700\u8981\u57fa\u672c\u719f\u6089vim \u6216 nano \u7b49BASH \u7f16\u8f91\u5668\u3002\u8fd9\u4e9b\u8bf4\u660e\u4e13\u95e8\u9488\u5bf9\u4f7f\u7528 CentOS 7 \u7684 (mt) Media Temple VPS \u5ba2\u6237\u3002\u59cb\u7ec8\u901a\u8fc7\u786e\u4fdd\u6240\u6709\u8f6f\u4ef6\u5305\u90fd\u662f\u6700\u65b0\u7684\u3002SSH \u5230\u60a8\u7684\u670d\u52a1\u5668\u5e76\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<pre><code>yum -y update<\/code><\/pre>\n<h2 class=\"h3 u-textAllcaps\">1. \u5b89\u88c5 RVM<\/h2>\n<p>\u66f4\u65b0\u5b8c\u6210\u540e\uff0c\u5b89\u88c5 Ruby \u7248\u672c\u7ba1\u7406\u5668\u3002RVM \u662f\u4e00\u79cd\u6d41\u884c\u7684\u5f00\u6e90\u5305\u7ba1\u7406\u5668\u3002\u60a8\u53ef\u80fd\u5df2\u7ecf\u5728\u4f7f\u7528\u4e0d\u540c\u7684\u5305\u7ba1\u7406\u5668\uff0c\u4f8b\u5982 Rbenv\uff0c\u5b83\u5e94\u8be5\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<pre><code>gpg --keyserver hkp:\/\/keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \n\\curl -sSL https:\/\/get.rvm.io | bash -s stable --ruby \nusermod -a -G rvm `whoami`<\/code><\/pre>\n<h2 class=\"h3 u-textAllcaps\">2. \u5b89\u88c5\u7ea2\u5b9d\u77f3<\/h2>\n<p>RVM \u5b89\u88c5\u5b8c\u6210\u540e\u5b89\u88c5 Ruby\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u60a8\u9700\u8981\u7684\u4efb\u4f55\u7248\u672c\uff0c\u4f46\u60a8\u53ef\u80fd\u9700\u8981\u9488\u5bf9\u7279\u5b9a\u200b\u200b\u7248\u672c\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u662f\u5426\u5df2\u7ecf\u6784\u5efa\u5e76\u51c6\u5907\u597d\u90e8\u7f72\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<ul>\n<li>\u5bf9\u4e8e\u6700\u65b0\u7248\u672c\uff1a<\/li>\n<\/ul>\n<pre>rvm \u5b89\u88c5\u7ea2\u5b9d\u77f3\nrvm --\u9ed8\u8ba4\u4f7f\u7528\u7ea2\u5b9d\u77f3\n<\/pre>\n<ul>\n<li>\u5bf9\u4e8e\u7279\u5b9a\u7248\u672c\uff0c\u8bf7\u5c06\u201cV\u201d\u66ff\u6362\u4e3a\u60a8\u60f3\u8981\u7684\u7248\u672c\u53f7\uff1a<\/li>\n<\/ul>\n<pre><code>rvm install ruby-V.V.V\nrvm --default use ruby-V.V.V<\/code><\/pre>\n<h2 class=\"h3 u-textAllcaps\">3.\u5b89\u88c5BUNDLER<\/h2>\n<p>Bundler \u662f\u4e00\u4e2a\u6613\u4e8e\u4f7f\u7528\u7684 Ruby \u5e94\u7528\u7a0b\u5e8f\u4f9d\u8d56\u7ba1\u7406\u5668\u3002\u5982\u679c\u6ca1\u6709 Bundler \u6216\u7b49\u6548\u5de5\u5177\uff0c\u60a8\u5c06\u4e0d\u5f97\u4e0d\u624b\u52a8\u5b89\u88c5\u6bcf\u4e2a\u5e94\u7528\u7a0b\u5e8f\u4f9d\u8d56\u9879\u3002<\/p>\n<pre><code>gem install bundler --no-rdoc --no-ri<\/code><\/pre>\n<h2 class=\"h3 u-textAllcaps\">4. \u5b89\u88c5 NODE.JS<\/h2>\n<p>Ruby on Rails \u9700\u8981<a href=\"https:\/\/nodejs.org\/en\/\">node.js<\/a>\u7528\u4e8e\u5176 JavaScript \u8fd0\u884c\u65f6\u73af\u5883\u3002\u5982\u679c\u60a8\u8ba1\u5212\u4f7f\u7528 Ruby on Rails\uff0c\u8bf7\u5b89\u88c5 node.js\u3002<\/p>\n<pre><code>yum install -y epel-release\nyum install -y --enablerepo=epel nodejs npm<\/code><\/pre>\n<h2 class=\"h3 u-textAllcaps\">5.\u7528NGINX\u5b89\u88c5PASSENGER<\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u76f8\u5bf9\u7b80\u5355\u7684\u8fc7\u7a0b\uff0c\u4f46\u5982\u679c\u60a8\u9047\u5230\u56f0\u96be\uff0c<a href=\"https:\/\/www.phusionpassenger.com\/library\/walkthroughs\/start\/ruby.html\" target=\"_blank\" rel=\"noopener\">Phusion<\/a>\u5728\u4ed6\u4eec\u7684\u7f51\u7ad9\u4e0a\u6709\u5f88\u68d2\u7684\u6559\u7a0b\u53ef\u4ee5\u5e2e\u52a9\u60a8\u8fdb\u884c\u6545\u969c\u6392\u9664\u3002\u4ee5\u4e0b\u547d\u4ee4\u5c06\u6dfb\u52a0 Phusion \u7684 Yum \u5b58\u50a8\u5e93\uff0c\u7136\u540e\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6240\u9700\u7684\u8f6f\u4ef6\u5305\u3002\u4e58\u5ba2\u4f7f\u7528 Nginx Web \u670d\u52a1\u5668\u7684\u4fee\u6539\u7248\u672c\u3002\u5982\u679c\u60a8\u5df2\u7ecf\u5728\u4f7f\u7528\u5176\u4ed6 Web \u670d\u52a1\u5668\uff08\u4f8b\u5982 Apache\uff09\uff0c\u6216\u8005\u5df2\u7ecf\u5b89\u88c5\u4e86 Nginx\uff0c\u5219\u6b64\u5b89\u88c5\u4ecd\u7136\u6709\u6548\u3002<\/p>\n<pre><code>yum install -y epel-release pygpgme curl\ncurl --fail -sSLo \/etc\/yum.repos.d\/passenger.repo https:\/\/oss-binaries.phusionpassenger.com\/yum\/definitions\/el-passenger.repo\nyum install -y nginx passenger<\/code><\/pre>\n<ul>\n<li>\u4f7f\u7528 Vim \u6216 Nano \u7b49\u7f16\u8f91\u5668\u7f16\u8f91passenger.conf\u3002<\/li>\n<\/ul>\n<pre><code>vim&nbsp;\/etc\/nginx\/conf.d\/passenger.conf<\/code><\/pre>\n<p>\u627e\u5230\u4ee5\u4e0b\u51e0\u884c\u5e76\u5220\u9664\u201c#\u201d\u3002\u4e58\u5ba2\u7684\u6587\u4ef6\u8868\u660e\u8fd9\u4e9b\u7ebf\u8def\u53ef\u80fd\u4e0d\u5b58\u5728\u3002\u5982\u679c\u662f\u8fd9\u79cd\u60c5\u51b5\uff0c\u8bf7\u5c06\u4e0b\u9762\u672a\u6ce8\u91ca\u7684\u884c\uff08\u5220\u9664#\uff09\u526a\u5207\u5e76\u7c98\u8d34\u5230passenger.conf \u4e2d\u3002<\/p>\n<pre><code># passenger_root \/some-filename\/locations.ini;\n# passenger_ruby \/usr\/bin\/ruby;\n# passenger_instance_registry_dir \/var\/run\/passenger-instreg;<\/code><\/pre>\n<ul>\n<li>\u4fdd\u5b58\u5e76\u9000\u51fa\u3002<\/li>\n<li>\u91cd\u65b0\u542f\u52a8 Nginx Web \u670d\u52a1\u5668\u3002<\/li>\n<\/ul>\n<pre><code>service nginx restart<\/code><\/pre>\n<ul>\n<li>\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6d4b\u8bd5\u60a8\u7684\u5b89\u88c5\uff1a<\/li>\n<\/ul>\n<pre><code>\/usr\/bin\/passenger-config validate-install&nbsp;<\/code><\/pre>\n<p>\u60a8\u5e94\u8be5\u4f1a\u6536\u5230\u4e00\u4efd\u9a8c\u8bc1\u5b89\u88c5\u7684\u6253\u5370\u8f93\u51fa\u3002\u5982\u679c\u4e0d\u8fd9\u6837\u505a\uff0c\u8bf7\u4f7f\u7528\u8bf4\u660e\u548c\u51fa\u73b0\u7684\u4efb\u4f55\u9519\u8bef\u6d88\u606f\u6765\u89e3\u51b3\u95ee\u9898\u3002\u60a8\u4e5f\u53ef\u4ee5\u53c2\u8003<a href=\"https:\/\/www.phusionpassenger.com\/library\/config\/nginx\/reference\/\">Phusion \u7684\u6587\u6863<\/a>\u3002<\/p>\n<pre><code>* Checking whether this Phusion Passenger install is in PATH... \u2713\n* Checking whether there are no other Phusion Passenger installations... \u2713\n<\/code><\/pre>\n<ul>\n<li>\u66f4\u65b0\u5e76\u91cd\u542f<\/li>\n<\/ul>\n<pre><code>yum -y update\nyum reboot\n<\/code><\/pre><div><img decoding=\"async\" src=\"https:\/\/www.ldhost.cn\/images\/ad-845-3.png\" alt=\"\u56fe\u7247\u63cf\u8ff0\" \/><\/div>","protected":false},"excerpt":{"rendered":"<p>\u60a8\u9700\u8981\u80fd\u591f\u4f7f\u7528 root \u6743\u9650\u901a\u8fc7SSH \u8fde\u63a5\u5230\u60a8\u7684\u670d\u52a1\u5668\u3002\u60a8\u8fd8\u9700\u8981\u57fa\u672c\u719f\u6089vim \u6216 nano \u7b49BASH \u7f16\u8f91\u5668\u3002\u8fd9\u4e9b\u8bf4\u660e\u4e13\u95e8\u9488\u5bf9\u4f7f\u7528 CentOS 7 \u7684 (mt) Media Temple VPS \u5ba2\u6237\u3002\u59cb\u7ec8\u901a\u8fc7\u786e\u4fdd\u6240\u6709\u8f6f\u4ef6\u5305\u90fd\u662f\u6700\u65b0\u7684\u3002SSH \u5230\u60a8\u7684\u670d\u52a1\u5668\u5e76\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff1a yum -y update 1. \u5b89\u88c5 RVM \u66f4\u65b0\u5b8c\u6210\u540e\uff0c\u5b89\u88c5 Ruby \u7248\u672c\u7ba1\u7406\u5668\u3002RVM \u662f\u4e00\u79cd\u6d41\u884c\u7684\u5f00\u6e90\u5305\u7ba1\u7406\u5668\u3002\u60a8\u53ef\u80fd\u5df2\u7ecf\u5728\u4f7f\u7528\u4e0d\u540c\u7684\u5305\u7ba1\u7406\u5668\uff0c\u4f8b\u5982 Rbenv\uff0c\u5b83\u5e94\u8be5\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u3002 gpg &#8211;keyserver hkp:\/\/keys.gnupg.net &#8211;recv-keys 409B6B1796C2&#8230; <a href=\"https:\/\/www.ldhost.cn\/jc\/weberror\/7992.html\" class=\"readmore\">\u9605\u8bfb\u5168\u6587<span class=\"screen-reader-text\">\u5728CENTOS 7\u670d\u52a1\u5668\u4e0a\u5b89\u88c5RUBY\u548cPASSENGER<\/span><span class=\"fa fa-angle-double-right\" aria-hidden=\"true\"><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-7992","post","type-post","status-publish","format-standard","hentry","category-weberror","content-layout-excerpt-thumb"],"_links":{"self":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/7992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/comments?post=7992"}],"version-history":[{"count":3,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/7992\/revisions"}],"predecessor-version":[{"id":7998,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/posts\/7992\/revisions\/7998"}],"wp:attachment":[{"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/media?parent=7992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/categories?post=7992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ldhost.cn\/jc\/wp-json\/wp\/v2\/tags?post=7992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}