How to install Redmine on Fedora 11 linux? - ruby-on-rails

I would like to install REDMine on my LINUX LAMP.
First i need to install ROR.
http://www.redmine.org
Provide steps if anybdoy has done installation

If you actually looked, you would have found that the instructions are on the redmine website: http://www.redmine.org/wiki/1/RedmineInstall

Given that no truly reliable installation instructions can be found around (Fedora or other distribution that is), I will hereby detail the installation steps that worked for me. The website instructions are pretty reliable, but this is the most straightforward approach. I assume that you already have Apache2 and MySql, and installed Redmine 1.2.1 on a given $REDMINE_HOME.
This procedure was tested on Ubuntu 11.04, but given the packages involved, it should not be a problem replicating the procedure with success under Fedora. I will try to be as generic as possible.
Ruby:
Install ruby, rubygems, rake and the development mysql client library (libmysqlclient-dev on Ubuntu); a working ruby version is the 1.8.7 as of Sep '11
gem install rails -v=2.3.11
gem install i18n -v=0.4.2
gem install mysql
MySql:
Perform the following list of commands:
create database redmine character set utf8;
create user 'redmine'#'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'#'localhost';
Redmine configuration:
Create a $REDMINE_HOME/config/database.yml file with at least the following profile:
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
In $REDMINE_HOME, run
rake generate_session_store
rake db:migrate RAILS_ENV=production
rake redmine:load_default_data RAILS_ENV=production
Now running ruby script/server -e production should have you access Redmine at "0.0.0.0:3000".
Apache2:
Install the Apache2 Passenger mod (libapache2-mod-passenger in Ubuntu)
Assuming you provided a symbolic link to $REDMINE_HOME/public from /var/www/redmine, the virtual host should read something like this:
<VirtualHost *:80>
DocumentRoot /var/www
Options Indexes ExecCGI FollowSymLinks
RailsBaseURI /redmine
<Directory /var/www/redmine>
Options -MultiViews
</Directory>
</VirtualHost>
Eclipse Mylyn integration:
Go to $REDMINE_HOME/vendor/plugins and run
git clone git://redmin-mylyncon.git.sourceforge.net/gitroot/redmin-mylyncon/redmine-mylyn-connector
(Re)start the server, and in Redmine under Administration/Plugins the Mylyn Connector Plugin should be listed
Again in Redmine, under Administration/Settings/Authentication, check the "Enable REST web service" field
In Eclipse, install the Eclipse connector via its update site
http://redmin-mylyncon.sourceforge.net/update-site/N/

Related

apache, passenger/rails, ruby, redmine -- rails startup / gem path problem

I am having a ruby gem path problem starting passenger on apache.
Environment:
ubuntu-20
passenger-6.0.14
ruby-3.0.4
Ruby was installed system-wide using ruby-install, and is located at
/opt/rubies/ruby-3.0.4
chruby is being used to set the ruby environment.
ruby apps and gems are (hopefully) installed on a per-user and per-app basis. In this case, redmine is the only app.
When I visit the newly-created redmine site, passenger fails to start rails because of a gem path problem:
Raw Bundler exception:
Bundler was unable to find one of the gems defined in the Gemfile
Bundler tried to load the gems from #<struct Bundler::Settings::Path explicit_path=nil, system_path=false>
Could not find rails-6.1.4.7, rouge-3.28.0, ...
The gems are in fact, present:
$ cd ~
$ find . | grep rails-6.1.4
./.gem/ruby/3.0.4/specifications/rails-6.1.4.7.gemspec
./.gem/ruby/3.0.4/cache/rails-6.1.4.7.gem
./.gem/ruby/3.0.4/gems/rails-6.1.4.7
./.gem/ruby/3.0.4/gems/rails-6.1.4.7/README.md
The apache ssl startup for the virtual host looks like:
<IfModule mod_passenger.c>
PassengerRoot /home/test_user/.gem/ruby/3.0.4/gems/passenger-6.0.14
PassengerDefaultRuby /opt/rubies/ruby-3.0.4/bin/ruby
</IfModule>
...
Include rubies/test_user.include
and rubies/test_user.include has:
<Directory /var/www/html/issues-test>
PassengerAppRoot /home/test_user/redmine_test
PassengerAppEnv redmine_test
PassengerAppGroupName redmine_test
RailsBaseURI /issues-test
PassengerUser test_user
PassengerGroup test_user
PassengerFriendlyErrorPages on
</Directory>
The gem environment for the user where redmine is installed:
- RUBYGEMS VERSION: 3.2.33
- RUBY VERSION: 3.0.4 (2022-04-12 patchlevel 208) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/test_user/.gem/ruby/3.0.4
- USER INSTALLATION DIRECTORY: /home/test_user/.gem/ruby/3.0.0
- RUBY EXECUTABLE: /opt/rubies/ruby-3.0.4/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/test_user/.gem/ruby/3.0.4/bin
- SPEC CACHE DIRECTORY: /home/test_user/.local/share/gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /opt/rubies/ruby-3.0.4/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/test_user/.gem/ruby/3.0.4
- /opt/rubies/ruby-3.0.4/lib/ruby/gems/3.0.0
- SHELL PATH:
- /home/test_user/.gem/ruby/3.0.4/bin
- /opt/rubies/ruby-3.0.4/lib/ruby/gems/3.0.0/bin
- /opt/rubies/ruby-3.0.4/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /snap/bin
Note that the shell PATH does not include the
/home/test_user/.gem/ruby/3.0.4/gems/
path; and the test_user.include shows no path to the gems for passenger.
I'm not clear on how ruby/passenger establishes the path for gems.
The passenger install was done from the user environment.
Note: I'm also unclear as to why the INSTALLATION DIRECTORY shows
/home/test_user/.gem/ruby/3.0.4
but the USER INSTALLATION DIRECTORY shows
/home/test_user/.gem/ruby/3.0.0.
(At some point I may have done ruby-install 3.0 and it installed 3.0.4). There is, however, no directory ~/.gem/ruby/3.0.0
There were a couple of issues here. Thanks #Casper for some hints.
Passenger must be installed system-wide, i.e., as root.
It was installed as the redmine user, so had to be de-installed.
Checking the passenger uninstall page for apache, it says
"Remove the passenger files" and then details how to do that, assuming passenger was installed any way except from source.
Unfortunately, I installed from source, as the regular repositories are way out of date. Uninstalling from source is non-trivial, as the passenger files are mixed in with the other application files and there is no easy way to find them all and differentiate. I ended up deleting the entire ruby / redmine environment for the user and starting over.
To install passenger as root, in a ruby-install/chruby environment:
sudo -i
cd /opt/rubies
source /usr/local/share/chruby/chruby.sh
chruby 3.0.4
gem install passenger
passenger-install-apache2-module
exit
Once passenger was re-installed globally, attempting to set up redmine for a specific user still failed with the same error -- Bundler can't find any gems. I read several places that one should not have to set the GEM_PATH explicitly, as Passenger/Ruby/Bundler are supposed to be able to automatically find the gems they need if they are in a conventional place, but apparently not. My assumption was that since the passenger definition for the redmine app specified the user environment properly, they should be found. (It's not clear to me if this problem is specific to Passenger, an Apache2 installation, or Ruby/Bundler)
The problem may be because I am using ruby-install and not rvm; passenger's docs seem to assume rvm is used as the installer.
In any case, I had to explicitly set GEM_PATH in the apache2 configuration.
The path is the one shown if "gem env GEM_PATH" is given from the user account.
So for this case, in (file rubies/test_user.include above), add the line:
SetEnv GEM_PATH /home/test_user/.gem/ruby/3.0.4/:/opt/rubies/ruby-3.0.4/lib/ruby/gems/3.0.0/
The complete apache2 config fragment looks like:
<Directory /var/www/html/issues-test>
PassengerAppRoot /home/test_user/redmine_test
PassengerAppEnv redmine_test
PassengerAppGroupName redmine_test
RailsBaseURI /issues-test
PassengerUser test_user
PassengerGroup test_user
PassengerFriendlyErrorPages on
SetEnv GEM_PATH /home/test_user/.gem/ruby/3.0.4/:/opt/rubies/ruby-3.0.4/lib/ruby/gems/3.0.0/
</Directory>

start rails server automatically after reboot

I'd like my rails server to start automatically after every reboot, so I added the following to my .bashrc file
rvm use 1.9.2
cd /home/user/myapp
rails server
With that, the server never starts automatically after a reboot, and I have to start it manually.
Also, when I login to start the server, I see the following message
Using /usr/local/rvm/gems/ruby-1.9.2-p290
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby: symbol lookup error: /usr/local/rvm/gems/ruby-1.9.2-p290/gems/sqlite3-1.3.4/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize
As a consequence, I need to install sqlite3 after every reboot using "gem install sqlite3" after I make myself superuser, and only then I can start the rails server without issues.
$ cat /etc/*-release
CentOS release 5.8 (Final)
$ rails -v
Rails 3.1.1
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
Anyone can please help me overcome this issue? Thanks
Install Apache and Passenger
They will take care of starting your App with the server in a safer and more systematic way and what is now more or less a standard.
I had the same issue with Rails 4, Ruby 2.1 on CentOS 6. If you're not familiar with bash scripts and the rc, profiles system - it's much faster and easier to setup passenger.
Also, there are other reasons why you would go for passenger, including security and performance ( www.phusionpassenger.com )
Here is a quick how-to of what it took me to introduce the gem.
Install Apache (html daemon) and dependency packages (if you don't have them already):
yum install httpd curl-devel httpd-devel
Get Apache to start on boot:
chkconfig httpd on
Install Phusion Passenger and dependency packages:
gem install passenger
yum install curl-devel httpd-devel
Compile the environment:
passenger-install-apache2-module
Edit the Apache config file in etc/httpd/conf/httpd.conf
Uncomment the line containing NameVirtualHost *:80 towards the end
Paste the output from point 4) anywhere at the end of the file, eg:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-4.0.41
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.1/wrappers/ruby
<VirtualHost *:80>
ServerName 1.2.3.4 # www.whatever.com
DocumentRoot /var/www/rails/public # the path to your rails app
<Directory /var/www/rails/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
Took me 30 minutes in total, including several trial-errors with the httpd.conf to get everything right.
Note that installation requires at least 1 GB RAM on your machine.

Installing passenger in production environment

I have managed to install ruby 1.9.2 with rvm and rails,, but am having some trouble getting passenger installed. I have the source files in my /opt directory. When I run sudo ./passenger-install-nginx-module in the passenger bin directory I get this error: /usr/bin/env: ruby: No such file or directory
rvm info:
Ruby Path "/home/me/.rvm/rubies/ruby-1.9.2-p180/bin/ruby"
Use rvmsudo instead of sudo to run the passenger install command. Also, you may need to specify the full path to that command. On my server it's something like this:
rvmsudo /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/bin/passenger-install-apache2-module
You should be able to generate an RVM wrapper script (shell script to select RVM ruby):
rvm wrapper default_192
...and then set PassengerRuby in your Passenger config (tell Passenger which ruby to use):
PassengerRuby /home/your_user/.rvm/bin/default_192
if ever you find yourself wondering why your vagrant box has suddenly stopped loading your website, and you have the passenger gem installed, there's a big possibility that it has automatically upgraded the gem and needs you to make a few changes to the apache module for it. This is just one issue I have come across.
So in light of sharing the knowledge just open the following file for editing on the command using your preferred editor if you're running apache.
/etc/apache2/conf.d/passenger
and replace the three lines with the following:
. LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-4.0.10/buildout/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.9.1/gems/passenger-4.0.10
PassengerDefaultRuby /usr/bin/ruby1.9.1
we're basically replacing the version number the module should use.

installing passenger on Apache2 using rvm

I've installed Apache2 and it runs okay.
And I've installed rvm following this link.
After that, I've execute follow commands as its order. Actually some of these commands are from this link installing redmine.
rvm install 1.8.7
rvm use 1.8.7
gem install rails -v=2.3.5
gem install postgres-pr pq
gem install i18n -v=0.4.2
gem install passenger
passenger-install-apache2-module
and append this to apache2.conf
LoadModule passenger_module /home/myhome/.rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
PassengerRoot /home/myhome/.rvm/gems/ruby-1.8.7-p330/gems/passenger-3.0.2
PassengerRuby /home/myhome/.rvm/wrappers/ruby-1.8.7-p330/ruby
This is log for Apache after restart
[notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch Phusion_Passenger/3.0.2 configured -- resuming normal operations
But!!!, if I open my redmine root page, it just shows file list in public directory. I think Passenger may not work correctly.
Why? and how to fix this? I've tried everything what I can do for 2 days T-T
Have you added this section to apache config? It tells apache that you are using Rails application:
<VirtualHost :*80>
ServerName myapp
DocumentRoot /root-to-your-path/public
</VirtualHost>
And restarted Apache? Read more here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_ruby_on_rails_application
You should view the Passenger Integration guide from RVM, or the more detailed guide from Phusion (the makers of Passenger).
Note that in Phusion's guide, you should omit the --pre when installing the gem, as the guide was written when Passenger 3 was still in beta.

Can't get passenger to serve pages (steps I used inside)

I have been struggling to get passenger to run my Rails/Rack apps.
Steps I used (as root):
Clean Debian 6 installation
aptitude install apache2, (Ruby
requirements taken from RVM),
git-core, curl, (and some more
packages too I guess)
getting rvm installed (system wide)
installing ruby 1.9.2-p180, and
setting it to be used as default
installing passenger gem, and
running the apache2 module
installation (getting apache2
prequisites along the way)
creating
/etc/apache2/mods-available/passenger.load
and placing:
LoadModule
passenger_module ... (the one
printed after apache2 passenger
module got installed)
creating
/etc/apache2/mods-available/passenger.conf
and placing:
PassengerRuby ...
PassengerRoot ... (the ones printed after apache2
passenger module got installed)
ap2enmod passenger (and getting apache restarted afterwards)
mkdir /var/www
setting /var/www to be user: root, group: www-data
creating /var/www/testapp and copying my rails app there
creating /etc/apache2/sites-available/testapp and placing in there:
<VirtualHost *:80>
ServerName localhost/testapp
DocumentRoot /var/www/testapp/public
<Directory /var/www/testapp/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
ap2ensite testapp
bundle install from within /var/www/testapp
/etc/init.d/apache2 restart
After opening in the browser: localhost/testapp I can only see my rails app structure (it didnt fire the page)
I don't know what I have done wrong. It seems to be pretty much okay. I am concerned about file permissions, groups and so on, although I have no clue how should I set these up. How should permissions be structured? Apart from that, anything else that looks suspicious?
Thanks!
ServerName can't have slashes in it. Just make ServerName localhost, and go to http://localhost to visit your site.
If you need multiple websites deployed on localhost, you can do that, but you need to follow the extra steps here:
http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri

Resources