在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Installing RVM Multi-user on CentOS can be a bit tricky. Here's my documentation - mostly so I remember, but hopefully it helps someone else as well. A quick note - the people behind RVM are clear that tutorials outside their site are not supported. They're not discouraged, but they won't support them. Pretty reasonable. These directions worked for me, but you should understand what you're doing before following directions on the internet. My install was for Ruby 1.9.3 (current at the time of writing) on CentOS 6.2 x86_64. I installed on a VMware Fusion virtual machine. I'll be installing this on an EC2 instance in the future - I don't expect much in the way of changes, but will update if needed. I'll also be assuming a minimal install. As this was for a local devel environment I did a few things I wouldn't suggest doing on a production or publicly available site. I want to use Apache and a local MySQL instance, so I'll be installing those as well.
Ok, with that out of the way:
First, as root:
The last step in this section is to run
Now logout and log back in as your_name. curl -L get.rvm.io | bash -s stable
Now back to root and run
and log back out.
Now we're getting somewhere. RVM is installed and we're about ready to install ruby. Let's do a couple of sanity checks first. Log in as your_name.
As a multi-site install RVM should have been installed to Next,
should return
OK, we've successfully installed RVM. Now let's install Ruby. We'll include an openssl directive so we can install Passenger in a bit. Still as your_name:
Now let's set the default version:
And finally:
Now rake and rails are installed. Let's install passenger (and a few gems for database connectivity).
OK, now to set up passenger for Apache:
Pay attention to the paths that the install script gives you at the end. Copy them to a text file somewhere - we'll need them in a bit.
Now let's configure Apache. I like the way Ubuntu lays out the Apache config - especially virtual hosts - so we'll mimic that here.
We'll also need a few virtual host specific folders:
Now that our folder layout is set, let's get to the actual configuration files: First up, passenger. Let's create a passenger.conf file and paste in the paths we saved previously:
and populate
Save the file. This will load the passenger module when Apache starts. Next let's set up the virtual hosts:
It's important to note we're pointing the DocumentRoot to /public of your application. Now let's tell Apache where to look for the virtual host definitions:
Towards the bottom add:
Save the file. Two more steps and we're there. First link the virtual host definition to sites-enabled
Second, we need to suspend SELinux:
I would absouletly, positively run SELinux on a publicly facing website. Spend some time to learn to configure it - it's not nearly as scary as it looks at first. Go ahead and deploy your application to
That's it. You should be able to visit your site at http://yourservername. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论