Before we begin
Many website hosting companies prevent their customers from installing new software to shared-hosting servers. They restrict use of the GCC(Gnu Compiler Collection) tools, because the GCC can be used to build executable programs from source code. Although this is great for the hosting company’s security and server performance, it’s a less than ideal situation for any website owner to be forced to use out-of-date versions of software. Below, I’ve outlined a work-around around which helped me get around a big-name hosting provider’s GCC usage restriction. For any website owners seeking flexibility, Virtual Private Server(VPS) or Cloud hosted instance are both a much better option than shared-hosting.
Discover current configuration and installed software ( type and version)Before trying to download or install anything, it helps to know what kind of system the hosted server is running on. Do this with
uname -aThe system I used for this example was running Linux Kernel version 3.10 and seemed to be a CentOS based distribution. First thing I did was to check for already installed package-manager. The two major ones are .deb(Debian distros ) and .rpm. (Red Hat distros ) Use “which” command to find out which version your server uses. I checked for a Debian package manager with:
Rpm is installed
Install Libraries & Create FoldersIn your home directory, create source folder to hold extracted files and another for the binary files.
mkdir ~/binAdd the ~/bin directory to your executables PATH. code>export PATH=~/bin:$PATH
Download Install the GNU C compilerNow we need to download GCC which will compile the programs. Before doing this, check the system for the currently installed version. If you do not have execute permission for the compiler in /bin/gcc, then running
gcc --versionwill not work. Instead query the package manager on your server to find out which version of gcc is installed. That command for me was:
rpm -qa | grep gcc
rpm2cpio gcc-4.4.7-23.el6.x86_64.rpm | cpio -i --no-absolute-filenames -d -m -vFlags used with cpio:
-v --verboseAfter unpacking, find the gcc binary in the “bin” directory, and add it to your PATH using:
ln -s ~/path/to/gnu/compiler/bin/gcc ~/binAt this point I tried to compile one of my favorite programs, tree , and was met with yet another error message:
"ld not available"The man page for ld describes ld: “… ld combines a number of object and archive files, relocates their data and ties up symbol references. Usually the last step in compiling a program is to run ld…” Ld is one of the tools contained within the binutils package, so the next step is to install binutils that and hope there are no more major hurdles to clear.
Install binutilsTo find the version of binutils compatible with the server, run
rpm -qa | grep binutils
ln -s ~/path/to/binutils/bin/ld ~/bin
Install new programs!If you made it this far, you should be able to install programs on the server. I usually search for a pre-compiled binary on Pkgs.org before I try compiling from source. Expect to receive the odd error message here and there, for a missing library, or from install scripts trying to save files in location without write permissions. Remember to create a link for each newly compiled binary eg.
"ln -s ~/path/to/binary/directory/binary-file", and place the link inside your home binary folder( eg. ~/bin )
Other GuidesIf you were unable to find a compatible gcc binary, you might have success grabbing the binaries from a virtual machine with a distro similar to that of your server. This virutal machine would ideally have the same kernel version and cpu architecture as your server. Here’s another guide to achieve the same result using a different methods: https://ericdraken.com/transplanting-linux-shared-dynamic-libraries-shared-hosting/
Abusive Activities and Other Threats. You acknowledge and agree that you may not use our servers and your website as a source, intermediary, reply to address, or destination address for mail bombs, Internet packet flooding, packet corruption, denial of service, or other abusive activities that threaten the stability of our network or will damage the systems of, or cause a disruption of internet services to, GoDaddy, our customers, or third-parties. Server hacking or other perpetration of security breaches is prohibited and we reserve the right to remove sites containing information about hacking or links to such information. Use of your website as an anonymous gateway is prohibited. We prohibit the use of software or scripts run on our servers that cause the server to load beyond a reasonable level, as determined by us. You agree that we reserve the right to remove your website temporarily or permanently from our servers if you are in violation of this Service Agreement and/or there are activities that threaten the stability of our network. You acknowledge and agree that all websites associated with your hosting account may be removed if one website is in violation of this Service Agreement. You further acknowledge and agree that GoDaddy reserves the right to scan your hosted account for malicious content (e.g., malware), and that, in the event any such content is discovered, it may be removed in GoDaddy’s discretion for security purposes.