I
I
Igor Vorotnev2014-03-17 17:56:47
ruby
Igor Vorotnev, 2014-03-17 17:56:47

Gems are installed in /root, the paths are not the same. Where did you mess up and how to fix it?

Comrades, I need help, my brain exploded. On an already running VPS under Ubuntu 12.04 with Apache, PHP and MySQL, I decided to install Redmine on a separate subdomain. For him, of course, you need to install Ruby and Rails, and then Passenger. I'm not friends with Ruby yet, I followed several instructions, comparing and checking:
https://grandslam90.wordpress.com/2012/05/22/howto...
www.redmine.org/projects/redmine/wiki/RusRedmineInstall
Everything seemed to go well, it completely coincided with the instructions, and Redmine even launched under WEBrick. I started installing Passenger, and then there were inconsistencies. For starters, "passenger-install-apache2-module" didn't run - command not found. With the help of Google, I realized that either you need to register the path in PATH, or run it with the full path. It was useful to look for where it lies, and was surprised that all the gems I have are in "/root/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/", although logically they should be in "/var/lib/gems/2.0.0/gems". I started Passenger manually, then the installer cursed and asked me to do "chmod o + x / root", which already completely strained me.
Log from the beginning:

cd

git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

apt-get install gcc

apt-get install libssl-dev

rbenv install 2.0.0-p451
rbenv global 2.0.0-p451
rbenv rehash
ruby -v

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

gem install bundler

apt-get install python-software-proprties
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

gem install rails --version 4.0.0 --no-ri --no-rdoc
rbenv rehash
rails -v

It seems that everything is according to the tutorials (see links above), with the exception of the additional installation of the missing packsages along the way. But there seems to be an error somewhere. Knowledgeable people, tell me plz. I've already broken my head. I'm afraid I'll have to restore from the snapshot and do it all over again. The main thing is to know where not to repeat the glitch.
PS: Further actions (installing and configuring Redmine) could hardly be the reason, but just in case, I will also give a log:
cd /usr/share
wget http://www.redmine.org/releases/redmine-2.5.0.tar.gz
tar xvfz redmine-2.5.0.tar.gz
rm redmine-2.5.0.tar.gz
mv redmine-2.5.0 redmine
chown -R root:root /usr/share/redmine
chown www-data /usr/share/redmine/config/environment.rb
ln -s /usr/share/redmine/public /var/www/office.paspar2.com/httpdocs

mysql -u root -p
CREATE DATABASE redmine character SET utf8;
CREATE user 'redmine'@'localhost' IDENTIFIED BY '**********';
GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost';
exit

cp redmine/config/database.yml.example redmine/config/database.yml
nano redmine/config/database.yml

  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: **********
  encoding: utf8

apt-get install libmysqlclient-dev
apt-get install libmagickcore-dev libmagickwand-dev

gem install bundler

cd redmine
bundle install --without development test postgresql sqlite

cd /usr/share/redmine
rake generate_secret_token
RAILS_ENV=production rake db:migrate 
RAILS_ENV=production rake redmine:load_default_data

mkdir tmp tmp/pdf public/plugin_assets
chown -R www-data:www-data files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

ruby script/rails server webrick -e production

After that, everything opened beautifully at redmine.domain.com:3000 . Let's move on to installing Passenger:
gem install passenger

apt-get install libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev

passenger-install-apache2-module

And here the error appeared. On the last command I got an error: Command not found. I looked for where it is installed, and found it here:
~/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.38/bin/passenger-install-apache2-module

I started it like this, and he asked me to give the / root o + x folder, which finally stopped me. Out of curiosity, he did what he asked. After compiling the Apache module, it gave me the following text for the config:
LoadModule passenger_module /root/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.38/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /root/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/passenger-4.0.38
     PassengerDefaultRuby /root/.rbenv/versions/2.0.0-p451/bin/ruby
   </IfModule>

Well, here there are no options at all, to run the Apache module from / root - wtf ?!
Where did I screw up? Restoring from a snapshot and doing it all over again is not a problem, the main thing is to understand where not to repeat the mistake. Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kozhin, 2014-03-17
@HeadOnFire

You have everything installed in /root, since you are doing the installation as root. It's better to install everything via sudo from a regular user account.
Then everything is put in the "hamster" of this user.
As for passenger, when installing it, it is possible to set the location directory (if you do not want to change the rights to the directory with the module).
Check out the official Passenger installation documentation - www.modrails.com/documentation/Users%20guide%20Apa... I
recommend installing ruby ​​via RVM - https://rvm.io/rvm/install

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question