How to Remove an Old version of Ruby
This post just saved me a hours of work, thanks
http://www.d-man.org/news/2009/01/06/91/
It outlines how to remove an old version of ruby and install the version you need.
This post just saved me a hours of work, thanks
http://www.d-man.org/news/2009/01/06/91/
It outlines how to remove an old version of ruby and install the version you need.
This is a combination of all my instructions on how to setup redmine on Centos. Its still a work in progress so please note any problems in comments.
yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc ruby-mysql
Download and install ruby gems
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
ruby setup.rb
Install Rails
gem install rails
Install Redmine
go to /opt
cd /opt
Get latest source code from http://www.redmine.org
unzip redmineXXXX.zip
Create a Database for Redmine
mysql -u root -p
create database redmine character set utf8;
exit
Configure the Redmine database connection settings
Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment.
cp /opt/redmine-0.7.3/config/database.yml.example /opt/redmine-0.7.3/config/database.yml
edit database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: yourusername
password: yourpassword
socket: /var/lib/mysql/mysql.sock
Run the following command in /opt/redmine-0.7.3/
rake db:migrate RAILS_ENV=”production”
If you get this error message: “cannot connect to mysql: No such file or directory – /tmp/mysql.sock”, You forgot to specify the socket location in config/database.yml – see above.
This will create tables and an administrator account.
Run this command to load default data into db.
rake redmine:load_default_data RAILS_ENV=”production”
Test the installation by running WEBrick web server:
ruby script/server -e production
Once WEBrick has started, point your browser to http://localhost:3000/. You should now see the application welcome page.
Use default administrator account to log in:
login: admin
password: admin
You can go to Admin & Settings to modify application settings.
You must install Rmagick as well for the nice Gant charts.
yum install ImageMagick
yum install ImageMagick-devel
gem install rmagick -v 1.15.13 –no-rdoc –no-ri
Create a repository folder.
mkdir /svn
Change the owner and group to root.apache
chown -R root.apache /svn
Change the permissions
chmod 0750 /svn
Configure subversion to be browsed, goto /etc/httpd/conf.d
vi subversion.conf
Insert the following at the bottom
<Location /svn>
DAV svn
SVNParentPath /svn
SVNListParentPath on
</Location>
If you get ‘Could not open the requested SVN filesystem’ when you try to browse to your repository http://localhost/svn then you have used SVNPath instead of SVNParentPath, just update your subversion.conf and that should fix this issue. This could also be a permission error related to the file permissions of your svn repository, make sure they are readable by apache.
Run the following command to test that it works
ruby reposman.rb -redmine localhost:3000 -svn-dir /svn -owner apache -url http://localhost/svn/ -verbose
If it does not, and fails with this error
/usr/lib/ruby/1.8/rdoc/ri/ri_options.rb:53: uninitialized constant RI::Paths (NameError)
from /usr/lib/ruby/1.8/rdoc/usage.rb:72:in ‘require’
from /usr/lib/ruby/1.8/rdoc/usage.rb:72
from reposman.rb:59:in ‘require’
from reposman.rb:59
Then you need to edit the reposman.rb file and add require statement require ‘rdoc/ri/ri_paths’ above all the other require statements.
require ‘rdoc/ri/ri_paths’
You need to add this to your crontab
5 * * * * ruby /opt/redmine-0.8.0_RC1/extra/svn/reposman.rb -redmine localhost:3000 -svn-dir /svn -owner apache -url http://localhost/svn/ -verbose >> /var/log/reposman.log
I found the instructions at http://www.redmine.org/wiki/redmine/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl did not work for me. I managed to get it working doing the following;
You do not need to but you can set subversion 1.54 by installing the RPMForge repos, follow these instructions – http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
Get the necessary packages
yum install mod_dav_svn mod_perl perl-Apache-DBI perl-Digest-SHA1 perl-DBD-mysql subversion
Copy Redmine.pm from /opt/redmine-0.7.3/extra/svn/Redmine.pm to /usr/lib/perl5/vendor_perl/5.8.8/Apache/
cp /opt/redmine-0.7.3/extra/svn/Redmine.pm /usr/lib/perl5/vendor_perl/5.8.8/Apache/
create a file in /etc/httpd/conf.d/ called redmine.conf and put this in it.
PerlLoadModule Apache::Redmine
<Location /svn>
DAV svn
SVNParentPath “/svn”
AuthType Basic
AuthName redmine
Require valid-user
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
## for mysql
RedmineDSN “DBI:mysql:database=da;host=my.db.server”
## for postgres
# RedmineDSN “DBI:Pg:dbname=databasename;host=my.db.server”
RedmineDbUser “redmine”
RedmineDbPass “password”
</Location>
# a private location in read only mode to allow Redmine browsing
<Location /svn-private>
DAV svn
SVNParentPath “/svn”
Order deny,allow
Deny from all
# only allow reading orders
<Limit GET PROPFIND OPTIONS REPORT>
Allow from redmine.server.ip
</Limit>
</Location>
The error I received from using the Redmine-0.7.X was;
‘Invalid command ‘RedmineDSN’, perhaps misspelled or defined by a module not included in the server configuration’
This is related to not copying Redmine.pm to /usr/lib/perl5/vendor_perl/5.8.8/Apache
Taken from http://www.redmine.org/wiki/redmine/HowTo_run_Redmine_with_a_Mongrel_cluster
Install Mongrel
gem install mongrel mongrel_cluster daemons
Configure the Mongrel Cluster for redmine.
cd /opt/redmine
mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /opt/redmine-0.8.0_RC1 -user apache -group apache
Start the Cluster
mongrel_rails cluster::start
Configure apache as the load balancer
create a new config file in /etc/httpd/conf.d
vi /etc/httpd/conf.d/redmine.conf
paste this into the file
<VirtualHost *>
ServerName your.domain.name
DocumentRoot /opt/redmine-0.8.0_RC1
<Directory “/opt/redmine-0.8.0_RC1/public”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Proxy balancer://redmine_cluster>
Order allow,deny
Allow from all
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
</Proxy>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]
</VirtualHost>
And restart apache
service httpd restart
From – http://bitsandchaos.wordpress.com/2007/11/18/integrate-mongrel-with-rhel-and-derivatives/
This is tailored for the redmine installation that is descibed on this site.
create a directory
mkdir /etc/mongrel
create a file in that directory
vi /etc/mongrel/mongrel.conf
Put this into the file
# we want three instances, listening on ports 8000, 8001 and 8002
PORTS=”8000 8001 8002″
# the Rails environment (see config/database.yml of your application)
ENVIRONMENT=”production”
# the base name for the log file. Each instance will have a unique log file, as LOGFILE.PORT
LOGFILE=”/opt/redmine-0.8.0_RC1/log/rubyapp.logfile”
# the basename for the pid file. Each instance will have a unique pid file, as PIDFILE.PORT
PIDFILE=”/opt/redmine-0.8.0_RC1/tmp/pids/pidfile”
# the directory containing your RoR application.
ROOTDOCUMENT=”/opt/redmine-0.8.0_RC1/”
# every other extra parameter goes there.
EXTRAPARAMS=”--user apache --group apache”
Create another file
vi /etc/sysconfig/mongrel
Put this into it.
#Path of mongrel_rails
MONGREL=/usr/bin/mongrel_rails
Create another file
vi /etc/init.d/mongrel
Set the permissions
chown root:root /etc/init.d/mongrel
chmod 755 /etc/init.d/mongrel
add it to chkconfig:
chkconfig -add mongrel
and then set it for automatic starting at appropriate runlevels:
chkconfig –level 345 mongrel on
Put the following in /etc/init.d/mongrel
#!/bin/bash
#
# Mongrel Startup script for the Mongrel Server
#
# chkconfig: – 84 10
# description: Mongrel is a Ruby on Rails application server
#
# processname: mongrel_rails
# config: /etc/sysconfig/mongrel
# instance config: /etc/mongrel/*.conf
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/mongrel ]; then
. /etc/sysconfig/mongrel
fi
# Path to the mongrel_rails server.
mongrel=${MONGREL-/usr/bin/mongrel_rails}
RETVAL=0
# For each /etc/mongrel/*.conf file that describes a Ruby on Rails application
# we instantiate the corresponding server instances (one for each port).
# We also cleare the sessions, pids, cache and sockets subdirs.
# Note that you’ll hopefully get a [ OK ] line for each (instance,port) pair.
start() {
RET=0
for instancefile in `ls /etc/mongrel/*conf`; do
echo -n $instancefile;
unset PORTS ENVIRONMENT LOGFILE PIDFILE ROOTDOCUMENT EXTRAPARAMS
. $instancefile
for INSTANCEPORT in $PORTS; do
INSTANCELOG=$LOGFILE.$INSTANCEPORT
INSTANCEPID=$PIDFILE.$INSTANCEPORT
CMDLINE=”-e $ENVIRONMENT –port $INSTANCEPORT –log $INSTANCELOG –pid $INSTANCEPID $EXTRAPARAMS”
if [ -n "$ROOTDOCUMENT" ]; then
for SUBDIR in “sessions” “pids” “cache” “sockets”; do
rm -f $ROOTDOCUMENT/tmp/$SUBDIR/* 2> /dev/null
done
(cd $ROOTDOCUMENT; daemon mongrel_rails start -d $CMDLINE)
RETVAL=$?
if [ "$RETVAL" -ne "0" ]; then
RET=1
fi
echo
fi
done
done
return $RET
}
# When stopping mongrel_rails we wait a delay of 10 seconds
stop() {
echo -n $”Stopping Mongrel”
killproc -d 10 $mongrel
RETVAL=$?
# We force remove of PID files (a stopped Mongrel won’t do that for us)
for instancefile in `ls /etc/mongrel/*conf`; do
unset PORTS ENVIRONMENT LOGFILE PIDFILE ROOTDOCUMENT EXTRAPARAMS
. $instancefile
for INSTANCEPORT in $PORTS; do
INSTANCEPID=$PIDFILE.$INSTANCEPORT
rm -f $INSTANCEPID 2> /dev/null
done
done
echo
}
# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status $mongrel
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $”Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}”
exit 1
esac
exit $RETVAL
Use
service mongrel start
service mongrel stop
service mongrel restart
service mongrel status
Taken from http://www.redmine.org/wiki/redmine/HowTo_run_Redmine_with_a_Mongrel_cluster
Install Mongrel
gem install mongrel mongrel_cluster daemons
Configure the Mongrel Cluster for redmine.
cd /opt/redmine
mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /opt/redmine-0.8.0_RC1 –user apache –group apache
Start the Cluster
mongrel_rails cluster::start
Configure apache as the load balancer
create a new config file in /etc/httpd/conf.d
vi /etc/httpd/conf.d/redmine.conf
paste this into the file
<VirtualHost *>
ServerName your.domain.name
DocumentRoot /opt/redmine-0.8.0_RC1
<Directory “/opt/redmine-0.8.0_RC1/public”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Proxy balancer://redmine_cluster>
Order allow,deny
Allow from all
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
</Proxy>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]
</VirtualHost>
And restart apache
service httpd restart
I had a few problems so the solutions are below.
Install GCC
I had a new install of Centos and needed to install gcc.
yum install gcc
Wrong Path in Mongrel Configuration
I also put the wrong path in my mongel configuration and got this error.
[root@CentOS redmine-0.8.0_RC1]# mongrel_rails cluster::start
** Ruby version is not up-to-date; loading cgi_multipart_eof_fix
/usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/lib/mongrel_cluster/init.rb:18
8:in `chdir’: No such file or directory – /opt/redmine (Errno::ENOENT)
from /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/lib/mongrel_clust
er/init.rb:188:in `chdir_cwd’
from /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/lib/mongrel_clust
er/init.rb:161:in `pid_file_exists?’
from /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/lib/mongrel_clust
er/init.rb:89:in `start’
from /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/lib/mongrel_clust
er/init.rb:80:in `each’
from /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/lib/mongrel_clust
er/init.rb:80:in `start’
from /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/lib/mongrel_clust
er/init.rb:239:in `run’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/comman
d.rb:212:in `run’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/bin/mongrel_rails:19:in `load’
from /usr/bin/mongrel_rails:19
The problem was that I put /opt/redmine instead of /opt/redmine-0.8.0_RC1 in
mongrel_rails cluster::configure -e production -p 8000 -N 3 -c /opt/redmine-0.8.0_RC1 –user apache –group apache
Once I updated to the right path, everything worked fine.
Permissions for the Redmine application were wrong
Mongrel would not start. If you look in your logs (/opt/redmine-0.8.0_RC1/log/mongrel.8000.log you see
** Mongrel 1.1.5 available at 0.0.0.0:8000
** Writing PID file to tmp/pids/mongrel.8000.pid
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:86:
in `initialize’: Permission denied – tmp/pids/mongrel.8000.pid (Errno::EACCES)
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/config
urator.rb:86:in `open’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/config
urator.rb:86:in `write_pid_file’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:132:in
`run’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/comman
d.rb:212:in `run’
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/bin/mongrel_rails:19:in `load’
from /usr/bin/mongrel_rails:19
To fix, change the permission of your redmine installation so apache has the rights to write to tmp/PIDS/
chown -R apache.apache /opt/remine-0.8.0_RC1
The new release looks almost complete so I thought I would look at the differences between 0.8.0 and 0.7.3. The installation is basically the same as 0.7.3 except you need to update rails and gem.
Follow my instruction on how to install Ruby on Rails – http://www.how-to-linux.com/2008/12/how-to-install-ruby-on-rails-on-centos-52/
You will need to upgrade gem and rails to work with redmine 0.8.0.RC1
gem update –system
gem install -v=2.1.2 rails
Download redmine
cd /opt
wget http://rubyforge.org/frs/download.php/48050/redmine-0.8.0_RC1.zip
unzip redmine-0.8.0_RC1.zip
Create the database
mysql -u root -p
create database redmine character set utf8;
exit
Configure the Redmine database connection settings
Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment.
cp /opt/redmine-0.7.3/config/database.yml.example /opt/redmine-0.7.3/config/database.yml
edit database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: yourusername
password: yourpassword
socket: /var/lib/mysql/mysql.sock
Run the following command in /opt/redmine-0.7.3/
rake db:migrate RAILS_ENV=”production”
Install the default data
rake redmine:load_default_data RAILS_ENV=”production”
Start the webbrick server
ruby script/server -e production
Use default administrator account to log in:
login: admin
password: admin
goto http://yourserver:3000
Thanks it.
I found the instructions at http://www.redmine.org/wiki/redmine/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl did not work for me. I managed to get it working doing the following;
You do not need to but you can set subversion 1.54 by installing the RPMForge repos, follow these instructions - http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
Get the necessary packages
yum install mod_dav_svn mod_perl perl-Apache-DBI perl-Digest-SHA1 perl-DBD-mysql subversion
Copy Redmine.pm from /opt/redmine-0.7.3/extra/svn/Redmine.pm to /usr/lib/perl5/vendor_perl/5.8.8/Apache/
cp /opt/redmine-0.7.3/extra/svn/Redmine.pm /usr/lib/perl5/vendor_perl/5.8.8/Apache/
create a file in /etc/httpd/conf.d/ called redmine.conf and put this in it.
PerlLoadModule Apache::Redmine
<Location /svn>
DAV svn
SVNParentPath “/svn”AuthType Basic
AuthName redmine
Require valid-userPerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler## for mysql
RedmineDSN “DBI:mysql:database=da;host=my.db.server”
## for postgres
# RedmineDSN “DBI:Pg:dbname=databasename;host=my.db.server”
RedmineDbUser “redmine”
RedmineDbPass “password”
</Location>
# a private location in read only mode to allow Redmine browsing
<Location /svn-private>
DAV svn
SVNParentPath “/svn”
Order deny,allow
Deny from all
# only allow reading orders
<Limit GET PROPFIND OPTIONS REPORT>
Allow from redmine.server.ip
</Limit>
</Location>
The error I received from using the Redmine-0.7.X was;
‘Invalid command ‘RedmineDSN’, perhaps misspelled or defined by a module not included in the server configuration’
This is related to not copying Redmine.pm to /usr/lib/perl5/vendor_perl/5.8.8/Apache
Make sure apache starts at boot.
chkconfig httpd on
Create a repository folder.
mkdir /svn
Change the owner and group to root.apache
chown -R root.apache /svn
Change the permissions
chmod 0750 /svn
Configure subversion to be browsed, goto /etc/httpd/conf.d
vi subversion.conf
Insert the following at the bottom
<Location /svn>
DAV svn
SVNParentPath /svn
SVNListParentPath on
</Location>
If you get ‘Could not open the requested SVN filesystem’ when you try to browse to your repository http://localhost/svn then you have used SVNPath instead of SVNParentPath, just update your subversion.conf and that should fix this issue. This could also be a permission error related to the file permissions of your svn repository, make sure they are readable by apache.
Run the following command to test that it works
ruby reposman.rb –redmine localhost:3000 –svn-dir /svn –owner apache –url http://localhost/svn/ –verbose
If it does not, and fails with this error
/usr/lib/ruby/1.8/rdoc/ri/ri_options.rb:53: uninitialized constant RI::Paths (NameError)
from /usr/lib/ruby/1.8/rdoc/usage.rb:72:in `require’
from /usr/lib/ruby/1.8/rdoc/usage.rb:72
from reposman.rb:59:in `require’
from reposman.rb:59
Then you need to edit the reposman.rb file and add require statement require ‘rdoc/ri/ri_paths’ above all the other require statements.
require ‘rdoc/ri/ri_paths’
You need to add this to your crontab
5 * * * * ruby /opt/redmine-0.8.0_RC1/extra/svn/reposman.rb –redmine localhost:3000 –svn-dir /svn –owner apache –url http://localhost/svn/ –verbose >> /var/log/reposman.log
References
http://www.redmine.org/wiki/redmine/Automating_repository_creation
See instructions on how to install Ruby on Rails – http://www.how-to-linux.com/2008/12/how-to-install-ruby-on-rails-on-centos-52/
go to /opt
cd /opt
download the source http://rubyforge.org/frs/?group_id=1850
wget http://rubyforge.org/frs/download.php/39478/redmine-0.7.3.zip
unzip redmine-0.7.3.zip
Create a Database for Redmine
(install mysql if nececssary – see http://www.how-to-linux.com/2008/12/install-mysql-server-on-centos-52/)
mysql -u root -p
create database redmine character set utf8;
exit
Configure the Redmine database connection settings
Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment.
cp /opt/redmine-0.7.3/config/database.yml.example /opt/redmine-0.7.3/config/database.yml
edit database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: yourusername
password: yourpassword
socket: /var/lib/mysql/mysql.sock
Run the following command in /opt/redmine-0.7.3/
rake db:migrate RAILS_ENV=”production”
If you get this error message: “cannot connect to mysql: No such file or directory – /tmp/mysql.sock”, You forgot to specify the socket location in config/database.yml – see above.
This will create tables and an administrator account.
Run this command to load default data into db.
rake redmine:load_default_data RAILS_ENV=”production”
Test the installation by running WEBrick web server:
ruby script/server -e production
Once WEBrick has started, point your browser to http://localhost:3000/. You should now see the application welcome page.
Use default administrator account to log in:
login: admin
password: admin
You can go to Admin & Settings to modify application settings.
You probably will want to install Rmagick as well for the nice Gant charts.
yum install ImageMagick
yum install ImageMagick-devel
gem install rmagick –v 1.15.13 ––no–rdoc ––no–ri
You must install the rmagick -v 1.15.13
Subversion integration, see
and