[How-To] Install Redmine On A Zpanel Server Using Apache Passenger and Subversion
For those of you that would like to run Redmine with your Zpanel client follow this how-to below. I see there are a lot of programmers here so I hope this helps you out. This is a tutorial put together by a buddy of mine (Tide). Thanks Tide. I felt like this would be a good how to here. Maybe even a sticky? hint, hint.
Also, Ballen...I noticed somewhere before that you were working on a Redmine module for zpanel. If you are still working on it I hope this help you out.
This has been tested on the following set up.
Centos 6.3 , zpanel 10.0.2
Centos 6.4 , zpanel 10.1.0
Here's what you need.
Centos 6.3 or Centos 6.4
Zpanel 10.0.2 or Zpanel 10.1.0
SSH Access
Patience (You need lots of this )
Time
Time
And More Time
Did I mention you need a lot of time?
Before we get started lets assume the following.
You domain is: "www.myexample.com"
Your sub-domain will be "svn.myexample.com"
Your user home directory will be "testclient"
You have SSH access to your server
You have root access.
You know how to use NANO or another Linux editor.
You have working email on your Zpanel server
If you do not have all of the above.........STOP.....Fix those before continuing. Thanks
Important! You should disable SElinux before installing. You can enable it and configure the IPtables later. This is not a tutorial for setting up iptables.
So, Let's get started.
Log into your zpanel client.
Create your new site for http://www.myexample.com
Create your dns records for http://www.myexample.com
Make sure you point your domain to the server.
Wait for this to resolve. This is important! Make sure your page comes up with the default Zpanel creation page before you continue. This will make sure you have a working page before Redmine is installed. This way if it breaks, you know it's Redmine causing the issue. Once your new domain resolves you can continue.
Now that you can see your newly created site lets create the sub domain that subversion will use.
Go to sub domains in Zpanel.
Create a sub domain svn.myexample.com (Remember...Use your actual domain)
Now create an "A" record for svn.myexample.com
Those settings for this "A" record will be.....
Host Name = svn
TTL = 86400
Target = xxx.xxx.xxx.xxx (This will be your IP Address)
Save your settings.
Wait for this to resolve. This is important! Make sure your svn sub domain page comes up with the default Zpanel creation page before you continue. This will make sure you have a working page before subversion is installed. This way if it breaks, you know it's subversion causing the issue. Once your new domain resolves you can continue.
Log into SSH (Under Root) I know this is not recommended but this was the best way.
Now you need to install the following....Run these in SSH and follow the prompts.
yum update
yum -y install ruby rubygems
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel
yum -y install gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
gem install passenger
passenger-install-apache2-module
Important! When your done installing Apache-Module you will see the code you need to use to configure the ruby.conf .Make sure you save that code. It will look like this....
Code:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8/buildout/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.8
PassengerDefaultRuby /usr/bin/ruby
Now lets create and edit the ruby.conf
nano /etc/httpd/conf.d/ruby.conf
Once you open the ruby.conf add the code that Apache-Module gave you. Remember...The code I told you to save....
Now lets restart Apache
service httpd restart
Go to your user home Directory that you installed "www.myexample.com" in.
cd /var/zpanel/hostdata/testclient
Now lets download Redmine. Click here to see if you are getting the latest version
wget http://www.redmine.org/releases/redmine-2.4.2.tar.gz
Let's unzip it. (Make sure you have the version correct)
tar xvfz redmine-2.4.2.tar.gz
Now let's copy the file to the new Redmine directory. (Make sure you change the version if you downloaded a different one.)
mv redmine-2.4.2 redmine
Remove old files
rm -r redmine-2.4.2.tar.gz
Go to your new Redmine directory
cd redmine
Now install these....
gem install bundler
bundle install --without development test
Now go back to your zpanel client and create a new database and a new database user. Make sure you note this info down as you will need it later.
Then give the new user R/W access to the database you created.
Now lets set up some stuff in Redmine.
Go to this directory...Remember to use the correct user directory.
cd /var/zpanel/hostdata/testclient/redmine/config
Create the new Redmine config.
cp database.yml.example database.yml
Now lets edit the config.
nano database.yml
You need to change the database info under production.
Code:
production:
adapter: mysql
database: Enter your database here
host: localhost
username: Enter your database user name here
password: "" Enter your database password here
encoding: utf8
Save your settings.
Now lets go back to your Redmine directory.
cd /var/zpanel/hostdata/testclient/redmine/
Run these commands.
bundle install
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
mkdir -p tmp tmp/pdf public/plugin_assets
Lets chmod some files
chmod -R 755 files log tmp public/plugin_assets
Go to your public directory in Redmine
cd /var/zpanel/hostdata/testclient/redmine/public/
Run these commands.
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess
Go back to your user directory
cd /var/zpanel/hostdata/testclient
Guess what........ We are going to download and install more stuff. Run these...
Getting Apache to work with FastCGI:
Important! the following file version may change. If so go Here to check and see what the new version is.
Code:
rpm --import https://fedoraproject.org/static/0608B895.txt
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install mod_fcgid
Now get rid of some old files...
rm -rf *rpm
Go to the Redmine config directory
Code:
cd /var/zpanel/hostdata/testclient/redmine/config
Important! Before you complete the next section make sure your email thru Zpanel is working properly.
Copy config file for Redmine email settings
cp configuration.yml.example configuration.yml
Open the config file
nano configuration.yml
Under attachments_storage in the configuration.yml put this...
attachments_storage_path: /var/zpanel/hostdata/testclient/redmine/files
Then change this for email settings...
email_delivery:
delivery_method: :smtp
smtp_settings:
address: Enter your email server here (Example: smtp.myexample.com)
port: Enter your port here (Default: 25)
domain: Enter your domain here (Example: myexample.com)
authentication: :login
user_name: "Enter your email username" (Example: testclient[at]myexample.com)
password: "Enter your email password here."
Yours will look more like this...
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.myexample.com
port: 25
domain: myexample.com
authentication: :login
user_name: "testclient[at]myexample.com"
password: "mypassword"
Save the new configuration.yml
Now chown the directory...
chown -R apache:apache /var/zpanel/hostdata/testclient/redmine/
Now go to zpanel page > Module Admin > Apache Config > Override a Virtual Host Setting and select myexample.com
Make sure OpenBase is unchecked.
add this to the custom entry section:
DocumentRoot "/var/zpanel/hostdata/testclient/redmine/public/"
MaxRequestLen 20971520
<Directory "/var/zpanel/hostdata/testclient/redmine/public/">
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
AllowOverride all
</Directory>
Let's install subversion....
yum -y install mod_dav_svn subversion subversion-ruby
Make this directory...
mkdir /usr/share/perl5/vendor_perl/Apache
Run this....
ln -s /var/zpanel/hostdata/testclient/redmine/extra/svn/Redmine.pm /usr/share/perl5/vendor_perl/Apache/Redmine.pm
Make a new directory called "svn" ... (This directory will be in the same directory as Redmine)
cd /var/zpanel/hostdata/testclient
mkdir svn
Lets make sure that apache can read it.
chown -R apache:apache /var/zpanel/hostdata/testclient/svn
Now go to zpanel page > Module Admin > Apache Config > Override a Virtual Host Setting and select svn.myexample.com
Make sure OpenBase is unchecked.
Add this to the custom entry section:
PerlLoadModule Apache::Redmine
<Location />
DAV svn
SVNParentPath "/var/zpanel/hostdata/testclient/svn"
AuthType Basic
AuthName "Redmine SVN Repository"
Require valid-user
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
RedmineDSN DBI:mysql:database=Enter_Your_Database_Here;host=localhost
RedmineDbUser Enter your database user name here
RedmineDbPass Enter your database password here
</Location>
Now restart Apache...
service httpd restart
You may also want to run the Zpanel daemon at Zpanel >Zpanel config >
Your done!!! Congrats I told you this takes a lot of time... ....
You can now go to http://www.myexample.com to see your new Redmine page. You can log into your new redmine installation by using the username: admin Password: admin . For security reasons make sure you change the username and password first thing.
svn.myexample.com is only there for subversion. It wont let you log in unless you have a project.
Also, with Redmine you will have to manually create repos. To keep from having to do this you can install SCM Creator. This will allow you to create and delete repos on the fly. This plugin for Redmine works with Subversion/Git/Mercurial/Bazaar. So you want to install it? Let's keep going.
[How-To] Install SCM Creator Plugin for Redmine
Information about the plugin.
You can view the plugin infomation HERE
You can download the plugin HERE
You can view the install instructions HERE
Let's get started.
If you followed the tutorial above you will have a working Redmine site and a working Subversion site. In the examples they were the following.
You domain is: "www.myexample.com" (This is the url for the Redmine site)
Your sub-domain will be "svn.myexample.com" (This is the url for subversion site)
Remember that the Redmine site (Folder) and the Subversion site (Folder) are located in the users directory in zpanel.
In the tutorial these folders are located in /var/zpanel/hostdata/testclient
Time to download the SCM plugin.
Go to your Redmine plugins directory.
cd /var/zpanel/hostdata/testclient/redmine/plugins
Download the latest version of the SCM Creator Plugin. You can check to see what the latest version is by clicking HERE
wget http://projects.andriylesyuk.com/attachments/download/486/redmine_scm-0.4.3.tar.bz2
Now extract the file you just downloaded.
tar xvjf redmine_scm-0.4.3.tar.bz2
Remove old files.
rm -r redmine_scm-0.4.3.tar.bz2
You should now have a folder for redmine_scm in your plugins directory. Let's move on.
Go to your users directory.
cd /var/zpanel/hostdata/testclient
Change the owner and the group of the subversion folder.
chown apache:apache /var/zpanel/hostdata/testclient/svn
Next make sure that the subversion folder is writeable by the user.
chmod 0755 /var/zpanel/hostdata/testclient/svn
Go to the SCM Creator plugin config directory in Redmiine.
cd /var/zpanel/hostdata/testclient/redmine/plugins/redmine_scm/config
Now you need to copy the scm.yml config file to the Redmine config directory.
cp scm.yml /var/zpanel/hostdata/testclient/redmine/config/scm.yml
Now we need to edit the newly copied config file. Go to the Redmine config folder.
cd /var/zpanel/hostdata/testclient/redmine/config
Nano the scm.yml config file so we can do some editing.
nano scm.yml
You will see the following lines.
production:
auto_create: true
deny_delete: false
pre_create: /usr/local/bin/pre-create.sh
post_create: /usr/local/bin/post-create.sh
pre_delete: /usr/local/bin/pre-delete.sh
post_delete: /usr/local/bin/post-delete.sh
svn:
path: /var/lib/svn
svnadmin: /usr/bin/svnadmin
url: svn
git:
path: /var/lib/git
git: /usr/bin/git
options: --bare
url: http://git.myhost.com
update_server_info: true
git_ext: true
append: .git
mercurial:
path: /var/lib/mercurial
hg: /usr/bin/hg
bazaar:
path: /var/lib/bazaar
bzr: /usr/bin/bzr
init: init-repository
log_encoding: UTF-8
append: trunk
You need to set the following options. I put explanations on what they do beside them. Click HERE for details on each setting.
auto_create: true (This option turns auto creation of repos on or off. If you want this plugin to work set it to true)
deny_delete: false (This allows the admin to delete a repo thru the plugin. Set this to false)
Under the svn lines edit the following. (You can check to see what the directory for your svnadmin tool is by running the following command.
which svnadmin
)
path: /var/zpanel/hostdata/testclient/svn (This is the path to your SVN folder) This setting is required!
svnadmin: /usr/bin/svnadmin (This is the path to your svnadmin tool) This setting is required!
url: svn.myexapmle.com (Your subversion url)
Once you edited these lines save the scm.yml file.
Go to your Redmine directory.
cd /var/zpanel/hostdata/testclient/redmine
Now lets finish installing the plugin. Run this command.
rake redmine:plugins:migrate RAILS_ENV=production
To finsh the install you need to restart Redmine. To do this just restart Apache.
service httpd restart
Once Redmine has been restarted you can now go to your Redmine site and login. Go to the Administration section to view your new plugin.
[How-To] Configure SVN to use the usernames, passwords and permissions from Redmine.
If you are running Redmine with subversion using the tutorial above you are already set up. SVN is already using your Redmine database usernames and passowrds.
You can set up GIT and Mercurial as well. Some How-To's for those are below.
Note: For Redmine based SVN/Git/Mercurial authentication to work the repository name and the project identifier must be identical.
Here are some How-To's for GIT and Mercurial.
For GIT (This one is more complicated)
- Repositories access control with apache, mod_dav_svn and mod_perl
- HowTo configure Redmine for advanced git integration
- Redmine.pm: add support for Git’s smart HTTP protocol
For Mercurial
- HowTo configure Redmine for advanced Mercurial integration
I hope this tutorial helps someone and congrats if you made it all the way thru. I currently have this working on two servers.
Good Luck
Additional Tools for commiting to Redmine.
I use Visual Studio 2010 and Visual Studio 2013 for coding. To properly commit to a project in Redmine Use the tool below.
AnkhSVN - Subversion Support for Visual Studio
Their site is HERE
Their downloads are HERE
Once you download and install this plugin in Windows do the following.
1. Open Visual Studio
2. Go to "Tools" then "Options"
3. Click the expand arrow on "Source Control"
4. Click on Plug-in Selection
5. In the drop down select "AnhkSVN - Subversion Support for Visual Studio"
6. Click Ok
7. That's It!
Now look at your Solution Explorer in Visual Studio once your project is open. Right Click and you will see the options to commit your projects into your newly setup Redmine site.
(james30263 - http://forums.zpanelcp.com)