[Drupal][Git] How to compile and install git on a live server?
We encountered a situation when developing a Drupal site where our client website had been recently migrated to a new server. We had been using git as our version control system for almost all of our Drupal projects and this one was no exception. Now the new server did not have git installed and we needed one very quickly. So instead of requesting a support ticket and waiting for a response we decided to install git manually. Read on to know how to compile and install git on a live server.
One might wonder why on earth, we would want to compile a program like git when there are package management tools like yum, apt, gdebi installed on a server. The reason would be permissions! Most of the time we are faced with restrictive hostile environments and delays in getting the required software installed by the hosting company which we cannot tolerate.
The thought of compiling a program usually brings up unpleasant images of the source needing the required libraries, dependencies, the numerous warnings, encountering errors and all the more. However compiling git was a pleasant experience as it is a robust piece of software built with such a server environment in mind. Follow the instructions below to make git work in your server.
Instructions
- All you need to compile and install git is to have root access to the server.
- First create a directory outside of public_html and name it src and change into it.
mkdir src cd src
- Next download the source git using wget and unzip it.
wget https://github.com/git/git/archive/master.zip unzip master.zip
- Check into git-master directory.
cd git-master
- Next we are going to compile it for all the users in the server. In our case there were just two users, the root and the user role for the website but we decided to do it anyway.
make prefix=/usr all make prefix=/usr install
- If you need to have a better understanding about the installation process just type the command below from within the git directory
less INSTALL
Thats all there is to it. If you found the article helpful please return the favor by promoting it.