How to Install Git on Ubuntu 12.04

About Git

Git is a distributed version control system released to the public in 2005. The program allows for non-linear development of projects, and can handle large amounts of data effectively by storing it on the local server.

This tutorial will cover two ways to install Git.

How to Install Git with Apt-Get

Installing Git with apt-get is a quick and easy process. The program installs on the virtual private server with one command:

sudo apt-get install git

After it finishes downloading, you will have Git installed and ready to use.

How to Install Git from Source

If you are eager to download the most recent version of Git, it is generally a good idea to install it from the source.

Quickly run apt-get update to make sure that you download the most recent packages to your VPS.

sudo apt-get update

Prior to installing Git itself, download all of the required dependancies:

sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

Once they are installed, you can download the latest version of Git from the google code page.


After it downloads, untar the file and switch into that directory:

tar -zxf git-
cd git-

If you want to do a global install, install it once as yourself and once as root, using the sudo prefix:

make prefix=/usr/local all
sudo make prefix=/usr/local install

If you need to update Git in the future, you can use Git itself to do it.

git clone git://


How to Setup Git

After Git is installed, whether from apt-get or from the source, you need to copy your username and email in the gitconfig file. You can access this file at ~/.gitconfig.

Opening it following a fresh Git install would reveal a completely blank page:

sudo nano ~/.gitconfig

You can use the follow commands to add in the required information.

git config --global "NewUser"
git config --global [email protected]

You can see all of your settings with this command:

git config --list

If you avoid putting in your username and email, git will later attempt to fill it in for you, and you may end up with a message like this:

[master 0d9d21d] initial project version
 Committer: root <[email protected](none)>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global "Your Name"
    git config --global [email protected]

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

<[email protected](none)>

How to Create a New User and Grant Permissions in MySQL

About MySQL

MySQL is an open source database management software that helps users store, organize, and later retrieve data. It has a variety of options to grant specific users nuanced permissions within the tables and databases—this tutorial will give a short overview of a few of the many options.

How to Create a New User

In Part 1 of the MySQL Tutorial, we did all of the editing in MySQL as the root user, with full access to all of the databases. However, in the cases where more restrictions may be required, there are ways to create users with custom permissions.

Let’s start by making a new user within the MySQL shell:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Sadly, at this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell.

Therefore, the first thing to do is to provide the user with access to the information they will need.

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

The asterisks in this command refer to the database and table (respectively) that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.

Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges.


Your changes will now be in effect.

How To Grant Different User Permissions

Here is a short list of other common possible permissions that users can enjoy.

  • ALL PRIVILEGES- as we saw previously, this would allow a MySQL user all access to a designated database (or if no database is selected, across the system)


  • CREATE- allows them to create new tables or databases


  • DROP- allows them to them to delete tables or databases


  • DELETE- allows them to delete rows from tables


  • INSERT- allows them to insert rows into tables


  • SELECT- allows them to use the Select command to read through databases


  • UPDATE- allow them to update table rows


  • GRANT OPTION- allows them to grant or remove other users’ privileges

To provide a specific user with a permission, you can use this framework:

 GRANT [type of permission] ON [database name].[table name] TO ‘[username]’@'localhost’;

If you want to give them access to any database or to any table, make sure to put an asterisk (*) in the place of the database name or table name.

Each time you update or change a permission be sure to use the Flush Privileges command.

If you need to revoke a permission, the structure is almost identical to granting it:

 REVOKE [type of permission] ON [database name].[table name] TO ‘[username]’@‘localhost’;

Just as you can delete databases with DROP, you can use DROP to delete a user altogether:

 DROP USER ‘demo’@‘localhost’;

To test out your new user, log out by typing


and log back in with this command in terminal:

mysql -u [username]-p


Installing Ruby on Rails on Ubuntu 12.04 LTS with RVM

Step One— Install Ruby with RVM

Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date:

sudo apt-get update

Once that’s done, we can start installing RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one server; however, in this case, we will just use it to install the latest version of Ruby on the droplet.

If you do not have curl on your system, you can start by installing it:

sudo apt-get install curl

To install RVM, open terminal and type in this command:

\curl -L | bash -s stable

After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.

source ~/.rvm/scripts/rvm

In order to work, RVM has some of its own dependancies that need to be installed. You can see what these are:

rvm requirements

In the text that RVM shows you, look for this paragraph.

Additional Dependencies:
# For ruby:
apt-get --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev

Just follow the instructions to get your system up to date with all of the required dependancies.

 sudo apt-get --no-install-recommends install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev

On occasion the zlib package may be reported as missing. The RVM page describes the issue and the solution in greater detail here.

Step Two—Install Ruby

Once you are using RVM, installing Ruby is easy.

rvm install 1.9.3

Ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use 1.9.3 by default.

rvm use 1.9.3 --default


Step Three—Install RubyGems

The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.

 rvm rubygems current


Step Four—Install Rails

Once everything is set up, it is time to install Rails.

To start, open terminal and type in:

gem install rails

This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your droplet.

Important Security Alert – SolusVM WHMCS Module

We have been made aware of an exploit in the SolusVM WHMCS module. We thought we’d inform you as SolusVM are not able to email you directly. Please find the following information on their blog and take the necessary action to protect yourselves if you are using this module.

“We have been made aware of a potential security issue with our WHMCS Billing Module. We suggest you disable the module and rename/delete the /modules/servers/solusvmpro folder as soon as possible.

A new module will be released shortly to patch the security problem.”

SolusVM Security Alert – CRITICAL

This is an email I just received from SolusLabs.


In the last few hours a security exploit has been found. This email is to inform you of a temporary fix to eliminate this exploit whilst the issue is patched and transferred to our file servers for release.


You will need root SSH access to your master server. You are then required to delete the following file:


rm -f /usr/local/solusvm/www/centralbackup.php

Once the file is deleted the exploit can no longer be used. This file only exists on the master server and the slaves will not be affected.

You will receive a follow-up email once the patch versions are available.

Soluslabs Security Team

Are you under a DoS or DDoS attack ? How to find out ?

Your server appearing pretty slow could be many things from wrong configs, scripts and dodgy hardware – but sometimes it could be because someone is flooding your server with traffic known as DoS ( Denial of Service ) or DDoS ( Distributed Denial of Service ) it could also be that your server itself is part of a botnet and is being used to attack other networks, in this case its always a good idea to run scans with software such as ClamAV and RootKit Hunter as a precaution or even higher a professional to check it out for you if your not confident enough to do it on your own.

Furthermore whenever a client connects to a server via network, a connection is established and opened on the system. On a busy high load server, the number of connections connected to the server can be run into large amount till hundreds if not thousands. Find out and get a list of connections on the server by each node, client or IP address is useful for system scaling planning, and in most cases, detect and determine whether a web server is under DoS or DDoS attack

Take a look at these handy netstat commands below that will surely help you determine wether your under attack or are part of an attack.

netstat -na

Display all active Internet connections to the server and only established connections are included.

netstat -an | grep :80 | sort

Show only active Internet connections to the server on port 80 and sort the results. Useful in detecting a single flood by allowing you to recognize many connections coming from one IP.

netstat -n -p|grep SYN_REC | wc -l

To find out how many active SYNC_REC are occurring on the server. The number should be pretty low, preferably less than 5. On DoS attack incidents or mail bombs, the number can jump to pretty high. However, the value always depends on system, so a high value may be average on another server.

netstat -n -p | grep SYN_REC | sort -u

List all IP addresses involved.

netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'

List all the unique IP addresses of the nodes that are sending SYN_REC connection status.

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

Use netstat command to calculate and count the number of connections each IP address makes to the server.

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

List the number of connections the IPs are making to the server using TCP or UDP protocol.

netstat -ntu | grep ESTAB | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr

Check on ESTABLISHED connections instead of all connections, and display the number of connections for each IP.

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1

Show a list IP address’s and its number of connections that are connecting to port 80 on the server. Port 80 is used mainly by the HTTP protocol.

How to Configure Nginx as a Front End Proxy for Apache On Ubuntu

Both nginx and apache are powerful and effective servers. Apache currently reigns as the #1 server for websites and since its public release in 2006, nginx has taken the world by storm and is now the #2 server for active sites. The reasons for each respective server’s popularity are clear: apache’s power and nginx’s speed are well known. However, both servers do have drawbacks—apache is hard on server memory, while nginx (great at static files) needs the help of php-fpm or similar modules for dynamic content.

However, one can combine the two web servers to great effect, with nginx as static web server front and apache processing the back end.

Install Nginx

To start off, we need to install and configure nginx which will serve the front end of our site.

Let’s download it from apt-get:

sudo apt-get install nginx
This image has been resized. Click this bar to view the full image. The original image is sized 1079×71.

This image has been resized. Click this bar to view the full image. The original image is sized 743×210.

Once it has downloaded, you can go ahead and configure the virtual host to run on the front end.

There are a few changes we need to make in the configuration.

Configure nginx

Open up the nginx configuration.

Install Nano :-

sudo apt-get install nano
This image has been resized. Click this bar to view the full image. The original image is sized 1015×342.

sudo nano /etc/nginx/sites-available/example
This image has been resized. Click this bar to view the full image. The original image is sized 984×22.

This image has been resized. Click this bar to view the full image. The original image is sized 893×679.

The following configuration will set you up to use nginx as the front end server. It is very similar to the default set up, and the details are under the configuration.

server {
        listen   80; 

        root /var/www/; 
        index index.php index.html index.htm;


        location / {
        try_files $uri $uri/ /index.php;

        location ~ \.php$ {

        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;


         location ~ /\.ht {
                deny all;

The following changes were implemented in the configuration:

  • The root was set to the correct web directory
  • index.php was added on the index line
  • try_files attempts to serve whatever page the visitor requests. If nginx is unable, then the file is passed to the proxy
  • proxy_pass lets nginx the address of the proxied server
  • Finally the “location ~ /\.ht {” location block denies access to .htaccess files, if Apache’s document root concurs with nginx’s one

This configuration sets up a system where all extensions with a php ending are rerouted to the apache backend which will run on port 8080.

Activate the virtual host.

sudo ln -s /etc/nginx/sites-available/example /etc/nginx/sites-enabled/example

Additionally, delete the default nginx server block.

sudo rm /etc/nginx/sites-enabled/default
This image has been resized. Click this bar to view the full image. The original image is sized 837×102.

The next step is to install and configure apache.

Install Apache
With nginx taken care of, it’s time to install our backend, apache.

sudo apt-get install apache2
This image has been resized. Click this bar to view the full image. The original image is sized 785×54.

Since nginx is still not turned on, Apache will start running on port 80.

Configure Apache
We need to configure apache to take over the backend, which as we told nginx, will be running on port 8080. Open up the apache ports file to start setting apache on the correct port:

sudo nano /etc/apache2/ports.conf
This image has been resized. Click this bar to view the full image. The original image is sized 852×504.

Find and change the following lines to have apache running on port 8080, accessible only from the localhost:


Save and Exit.

Subsequently, open up a new virtual host file, copying the layout from the default apache file:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/example
sudo nano /etc/apache2/sites-available/example

The main issue that needs to be addressed here is that the virtual host needs to be, once again, running on port 8080 (instead of the default 80 given to nginx).

The line should look like this:


Make sure your Document Root is correct. Save and exit the file and activate that virtual host:

sudo a2ensite example
This image has been resized. Click this bar to view the full image. The original image is sized 922×188.

Before we start testing anything out, we need to equip apache with php. Go ahead and install it now:

 sudo apt-get install php5

Restart both servers to make the changes effective:

sudo service apache2 restart
sudo service nginx restart
This image has been resized. Click this bar to view the full image. The original image is sized 705×100.

Finish Up
We have set up the VPS with nginx running on the front end of our site and apache processing php on the back end. Loading our domain will take us to our site’s default page.

We can check that information is being routed to apache is working by running a common php script.

Go ahead and create the file:

sudo nano /var/www/info.php

Paste the following lines into that file:

PHP Code:
phpinfo( );

Save and exit.

Visiting your domain/info.php should show you php info screen, and you’ll be able to see that this was handled by apache.

Finally, you can see which ports are open and which application is on each one by typing in this command.

sudo netstat -plunt

That’s all ! Let me know if anyone is facing any issues while installing the above codes .

Setting Up A Linux Streaming Server

Linux, streaming server Linux, allows you to stream video, audio or other media on your website. If you don’t use an open source streaming server or a Darwin streaming server Linux your website will not be able to stream the media you want to provide to your visitors or customers. You can either operate your own Linux streaming server or you can sign up for a hosting plan that allows you to use their Linux video streaming server which will help with the high cost of equipment and maintenance.
Most websites do not need to operate their own streaming server linux, it is for more complicated websites that need to have open source streaming servers or Darwin streaming server capabilities. You can either purchase your own streaming server Linux equipment or you can buy software online and install it into your web server. You can find this software available for both Windows and Linux streaming servers needs.
Some major companies that offer Linux streamer server software are Helix from RealNetworks, Apple Quicktime, and Macromedia. They can provide you with open source streaming servers or Darwin streaming server capabilities without having to own your own equipment or maintain it.
When you use a hosted Linux streaming server it is much like the media software programs but is a much more realistic option for most website owners. These hosting companies specialize in Linux video streaming servers, open source streaming server and Darwin streaming server Linux needs. They are much simpler and less expensive to use. The same companies that offer the software media can offer you hosting for your Linux video streaming server needs.
When you decide that you do need to purchase your own equipment you should know that it is a very expensive endeavor. Starting out with HTTP streaming is recommended so that you can get the hang of what you’re doing before you opt for an open source streaming server or other Linux video streaming server equipment.
There are many websites online that can give you step-by-step instructions on the basics of conversion for your media which you will be using through your Linux streaming server. It is a complicated job to do on your own so if you are inexperienced in conversion and other expertise areas that have to do with Darwin streaming servers and open source streaming servers you should find the resources you need and learn everything there is to know before you begin.
Streaming server Linux equipment is very costly and unless you are planning on running a very large website like YouTube or its competitors you don’t need to have your own equipment. Streaming video online has been around for over 10 years and almost everyone knows what it is; but there are few who can run a Linux streaming server that offers both quality and compatibility. The only way to get experienced using open source streaming server equipment is to practice, so if your goal is to someday be the best streaming video website then it is recommended to get started sooner than later.
There are many steps you need to take when you are setting up a Darwin streaming server Linux based website. Listed below you will find some basic steps:
What you need to prepare yourself:
A web browser
Root access to the Linux system, which will be the media servere
Access to Ubuntu repositories
Media players that can handle streaming videos and other media such as VideoLan or Totem
Test files, audio or video
To install GNUMP3d is one of the simplest steps in your process of getting your Linux streaming server setup.
Open a terminal and run xterm or any other terminal application
Run sudo apt-get install GNUMP3d you may need to install it manually or just go to the next step
Enter your sudo or root password and allow the installation, download the source tarball from the GNUMP3d website and untar
A folder called music will be created in the var folder
Put the audio into the music folder and create symlinks to the music and movie folders in your directory
Use sudo to create links to your user account and make shortcuts which will allow it to run through your website.
Your media library will now be available in your web interface, going to your server address and adding :8888 will allow you access to your Linux video streaming server library.
Depending on the type of media or file, a different player may be required in order to make it run at best quality. If you don’t try out your Linux video streaming server with many different players you might end up with some video or audio with lag or low quality.
It is best to run an open source streaming server or Darwin streaming server Linux with the fastest possible internet connection. The faster the connection, the better streaming quality you will find.
If you follow these simple steps you should be well on your way to offering high quality streaming media to your website and to your visitors or customers.


DomainKey And DKIM Working Simultaneously In Kloxo

I have DomainKey and DKIM working simultaneously.

Here’s what you need to do

1. Install Mail::DKIM perl module

yum install perl-Mail-DKIM

2. Install libdomainkeys

rpmbuild --rebuild  libdomainkeys-toaster-0.68-1.3.6.src.rpm
rpm -ivh /usr/src/redhat/RPMS/i386/libdomainkeys-toaster-0.68-1.3.6.i386.rpm

3. Download and copy it to /usr/bin
4. Download

mv /var/qmail/bin/qmail-remote /var/qmail/bin/qmail-remote.orig
cp /var/qmail/bin/qmail-remote
chmod 755 /var/qmail/bin/qmail-remote
rm /var/qmail/bin/qmail-queue
mv /var/qmail/bin/qmail-queue.orig /var/qmail/bin/qmail-queue

6. Edit /var/qmail/bin/qmail-remote. goto line 49 and replace

error=`( --type=dkim --selector=default \


error=`( --type=dkim --selector=dkim \

7. Finally do not forget to add DKIM DNS TXT record.     IN  TXT  "v=DKIM1; g=*; k=rsa; p=MEwwDQYJKoZIhvcN.....AQAB"

the “p=MEwwDQYJKoZIhvcN…..AQAB” part is same as that for your domainkey created by kloxo

You can do a test by sending mail to yahoo or gmail

This basically works on most qmail toaster installation.

Hope this helps everyone here

Install IonCube Loader Using The Atomic Yum Repository On CentOS Linux

The other day I needed to install ionCube Loader for encrypted PHP code to run on a CentOS Linux server but was initially unable to find a repository that included the 
php-ioncube-loader RPM package. After a couple minutes I remembered that I had previously used the Atomic repo to install PHP Zend Optimizer and so I thought I would 
check that repository to see if an ioncube RPM package was available as well. Below I display the search for a repository that includes an ionCube Loader RPM package 
along with installing the package on a CentOS Linux server.

Install Atomic Yum Repository On CentOS Linux:
[[email protected]]# wget -q -O - |sh
Now that the Atomic repository is installed on your Linux server you can move forward with installing the PHP ionCube Loader package by using the syntax below. It is 
likely that there will be some other PHP dependencies installed along with the php-ioncube-loader RPM package so don’t be alarmed if multiple packages are installed at 
the same time.
Install PHP ionCube Loader On A CentOS Linux Server:
[[email protected]]# yum install php-ioncube-loader
Notice that in my scenario PHP was also upgraded so be careful if you do not want to upgrade PHP during the process of installing the php-ioncube-loader RPM package.