Install Redmine on Hostgator shared hosting
Pushing the limits of the shared hosting account at Hostgator again. This time I've decided to install Redmine in order to track the progress of my private projects.
The nice thing about Hostgator is that they offer, besides the standard PHP, the increasingly popular Python and Ruby on Rails. And this can prove quite handy if you want to do more with your hosting than the average Wordpress and Drupal installs.
Enable the SSH access
The first step is to enable the SSH access for your Hostgator account. If you don't know how to do it, you can read my previous article about this subject:
Enable SSH access on a Hostgator shared hosting account
Create a database
You need a database for your Redmine instance. You can easily create one using the cPanel interface for your Hostgator account. Note the details of the database, as you'll need them later.
Configure the environment
Edit .bash_profile and set the RAILS_ENV to the production environment.
vim ~/.bash_profile
Add the following line:
export RAILS_ENV=production
Install Redmine
Create a folder for the Redmine application:
mkdir ~/apps/
Download the latest stable Redmine code from Subversion:
cd ~/apps/ svn co http://redmine.rubyforge.org/svn/branches/1.3-stable redmine
Configure the database
Configure the database details. You can use a temple file provided with the code:
cd ~/apps/redmine/ cp config/database.yml.example config/database.yml
Open the file and edit the details of the production section by entering the details of the database created in the beginning of the post.
Initialize the database:
rake config/initializers/session_store.rb rake db:migrate rake redmine:load_default_data
Specify the environment
Open the Redmine environment file:
vim ~/apps/redmine/config/environment.rb
And set the RAILS_ENV like this:
ENV['RAILS_ENV'] = 'production'
Make the Redmine application available
The folder where we installed Redmine is not accessible to the apache web server. To remedy this, we can create a symbolic link in the public_html folder.
ln -s /home/kenjiru/apps/redmine/public /home/kenjiru/public_html/redmine
Now Redmine will be accessible as a folder in the main domain, like kenjiru.ro/redmine. You can also create a subdomain and point it to the redmine folder, for a result like this redmine.kenjiru.ro.
Install Git on Hostgator shared hosting
Introduction
After hearing my colleagues talking today about how cheap the VPS got in the last few years, I almost convinced myself that I have to switch. But I've decided to give my old shared hosting package from Hostgator another try. Buying a VPS package only to install Git is not the smartest thing to do, as you can get better and cheaper services from source code hosting providers like github.com or bitbucket.org.
Enable the SSH access
Enabling SSH access for a Hostgator access is really simple. You can learn more about it by reading my article about this subject:
Enable SSH access on a Hostgator shared hosting account
Install git
Git won't be available system wide, and you can't install it from source either. You can't compile Git remotely, because you won't have access to a compiler from within the jail shell. The only option left is to compile the git package from sources on a different machine with the same configuration as the one used by Hostgator for its shared hosting packages.
After a little research I've found that Hostgator is using CentOS 5.5, the 32 bit version. If you don't have a CentOS machine available, you can download a preinstalled Vmware image or you can install the system yourself. If you want to go the "do it yourself" way, then check my previous posts about installing CentOS 5.x and compiling Git:
If you just want to get to the next step quickly, just download the binary package attached to this post. It was compiled on a 32 bit version of CentOS 5.7.
Upload the binary package to Hostgator and unzip it somewhere in your home folder. I've called it /home/kenjiru/apps in my case.
Setup the environment
The last step is to let the shell know about the location of the git binary. You can do that by editing the ~/.bash_profile and appending the location of the git distribution to the PATH environment variable.
PATH=$PATH:/home/kenjiru/apps/git/bin
Give it a try
Now you can use Git as you would normally do on your machine. On the remote server you can issue commands like:
git clone git@github.com:kenjiru/test.git
You can also push to a remote repository hosted on the shared hosting. You will have to additionally specify the custom port that Hostgator uses like this:
git remote add origin ssh://kenjiru@kenjiru.ro:2222/~/git/test.git
Also notice the format of the remote path.
That's pretty much all. I hope this tutorial helped you.
Enable SSH access on a Hostgator shared hosting account
Hostgator always had the option to enable the SSH access to your shared hosting account. But only recently I've noticed how is to enable it. First time when I tried to activate the SSH access, they were requiring a scan your ID card with a clear photo on it. That proved to be too much for me.
Getting back to the subject, Hostgator provides free SSH access to a Jail Shell environment, but you have to explicitly enable this feature. Connect to gbclient.hostgator.com with your billing username and password, click on "View Hosting Packages" and then select the "Enable Shell Access" option. This will instantly enable the SSH access for your account. Now you can connect using your primary domain attached to your hosting package and the username and password you use to access cPanel.
Another thing to remember is that Hostgator uses the 2222 custom port for the SSH access. You can specify the custom port like this:
ssh -p 2222 user@domain.com scp /local/path/file -P 2222 user@domain.com:/remote/path
Install Git from source on CentOS 5.x
The simplest way to install Git is from the EPEL repository. You can add the EPEL repository by following my previous post on this subject: Adding the EPEL repository to CentOS 5.x.
But if you need, for some reason, to install Git from source, then you'll have to follow these instructions
Upgrade the system
It's always a good thing to have the latest packages:
yum -y upgrade
Install the needed packages for compilation
yum install gcc zlib-devel curl-devel
You'll need zlib-devel if you want to use http/https/webdav access to Git repositories.
Build Git from source
Download the sources and untar:
wget http://git-core.googlecode.com/files/git-1.7.8.4.tar.gz tar xvzf git-1.7.8.4.tar.gz
Configure and set the prefix, if you want something more exotic. And in the last step, build the thing:
./configure --prefix=/usr/ make make install
That's all!
Adding the EPEL repository to CentOS 5.x
What is EPEL
EPEL (Extra Packages for Enterprise Linux) is a community effort from the Fedora project to create a repository of high-quality add-on packages that complement the Fedora-based Red Hat Enterprise Linux (RHEL) and its compatible spinoffs, such as CentOS and Scientific Linux. EPEL packages are usually based on their Fedora counterparts and will never conflict with or replace packages in the base Enterprise Linux distributions.
How to enable it
The easiest way to add the EPEL repository is by installing the corresponding repository package from the Fedora web site. The repository package includes gpg keys for package signing and repository information.
For CentOS 5.x you have to install the following repository package: epel-release-5-4.noarch.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
After that you can install any packet from the repository using yum.
