Before we begin
Discover installed software
Install Libraries & Create Folders
Download Install GNU C compiler
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 -a
The 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:
which dpkg
which rpm
Rpm is installed
Install Libraries & Create Folders
In your home directory, create source folder to hold extracted files and another for the binary files.cd ~
mkdir ~/src
mkdir ~/bin
Add the ~/bin directory to your executables PATH.
code>export PATH=~/bin:$PATH
Download Install the GNU C compiler
Now 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 runninggcc --version
will 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 -v
Flags used with cpio:
-d --make-directories
-m --preserve-modification-time
-v --verbose
After unpacking, find the gcc binary in the “bin” directory, and add it to your PATH using:
ln -s ~/path/to/gnu/compiler/bin/gcc ~/bin
At 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 binutils
To 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 Guides
If 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.
MySQL cli vs. PhpMyadmin
Why use the Mysql cli
Using the command line interface offers offers several benefits. Visually there are less distractions when compared with. I find that I pay much more attention to each keypress and am inclined to pay attention to every character of output the cli displays. The cli experience is also snappier being ‘closer’ to the databse, and feels more interactive. Though I don’t mind using Phpmyadmin, it always feels good to eliminate a possible point-of-failure, even with such ubiquitous tool where bugs are unlikely. Update 9/18/19: A few months ago when I wrote this post, I thought this might be a stretch to suggest, but it looks like increased security is indeed a legitimate reason to choose the CLI. Check out this article on LinuxSecurity.com:MySql Vi Config
To set the mysql pager to vim( or less, nano etc.) Simply enter the following command (including the minus sign ):\P vi -
pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
Vim will open each query result in a temporary file which you can then navigate/search/edit like any other text file.
It is also possible to use the \e flag to enter editing mode and then use vim to structure your query before executing it.
edit (\e) Edit command with $EDITOR.
I use the “HELP” query to obtain the proper syntax of unfamiliar commands. It’s usually quicker than switching tabs to search the online documentation. It’s also great to have the results in vim so that the text can be quickly manipulated in-place to form the next query.
To view the same results using Phpmyadmin, I had to select the “Full texts” option under “Options”.
PhpMyAdmin is a great choice for those uninterested in becoming comfortable on the command line.
However, for the rest of us, choosing to use the cli version will eventually lead to more efficient database use.
Also vim users enjoy the added benefit of stacking skills by using vim as the primary pager.
It’s a great way to maintain the familiarity with the editor’s options and abilities, which comes only from frequent use. Reset worpdress password on development site / localhost
When running WordPress on a testing environment( localhost), I use generic usernames and passwords which are easy to remember.
Unfortutely, sometimes, I choose more difficult p@$$w0rd5 which I inevitable forget. After multiple failed attempts to remember whether I used two or three dollar signs, and in what order, it is time to give-up and reset the password.
Although using wordpress’ “Lost your password” feature will work in most cases, there are times when you may be working offline, or do not have access to your email.
My preferred fix in this situation is, to write the text contents of the reset email to a file. This avoids any need to manually edit hashed password values in the database.
Outputting reset info to a text file can be accomplished with the addition of a single line to the login file ( default login file name is “wp-login.php” ).
Open the login file and locate the “retrieve_password()” function.
Within the function find the last line of text that is appended to “$message”, and insert this code immediately after it:
file_put_contents('reset_email.txt', $message);
Your login file should resemble the image above
Using your web browser, open the word-press login page, click the “Lost your password” link, and enter your user name when asked. The reset email should now be saved in your web root directory
Using your system file browser, check inside the website root folder. If the reset was successful you should find the ‘reset_link.txt’ file there. It should contain text which looks something like …
Someone has requested a password reset for the following account: Site Name: Username: usernm If this was a mistake, just ignore this email and nothing will happen. To reset your password, visit the following address: https://localhost/wpsandbox/wp-login.php?action=rp&key=P4BnFkn2XgAbKLk6Vap1&login=usernm
Copy and paste the reset address in your browser url bar to reset the password.
If you chose to save the reset_email.txt file to a different location then apache will need write access to the directory.
If you are familiar with using a line-by-line debugger, you could also set a breakpoint immediately after the url has been appended to theĀ “$message” variable and copy the url value from your debugger watch window.