In previous posts, we’ve demonstrated how to use software we provide through one-click installers or through your shell account. But sometimes you may want to use something we haven’t installed. Today we’d like to give a better picture of how to do that, and what WebFaction servers already have installed to help you.
Sometimes the software you want to use will be available as a binary or script you can run more or less straight away, without any compilation steps. It’s simply a matter of downloading and running. wget and curl both make it easy to download files, limiting the need to upload with SFTP.
Take ack, a grep alternative, as an example. Downloading and installing ack is a one-liner, provided $HOME/bin is in your PATH:
curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 !#:3
Much of the software you may want to install may require a more complicated installation process, however. In particular, you may be required to configure, compile, and install as separate steps.
To that end, each WebFaction server comes equipped with many of the common tools you need to do that. In particular, each WebFaction server has make for running the compilation and installation process, C/C++ compilers, and plenty of common prerequisite libraries. Preinstalled libraries include essentials such as readline and libcurl, as well as fancier libraries, like ImageMagick for graphics manipulation (to get a sense of what’s installed, try running ldconfig -p).
System configuration details are a bit dry, however. For a more concrete demonstration, we’ll compile the open source key-value store Redis. In general, the strategy for setting up software in your home directory is:
- Get the source.
- Configure (if applicable) and build.
Of course, no two packages are alike, so be sure to read the software’s README file and other documentation. You should also look over the WebFaction Installing Software from Source documentation for some additional guidelines.
In Redis’s case, the process is simple. First, log in to your SSH account, then download the source with this command:
Next, extract the tarball and switch to the source directory with these commands:
tar -xf redis-2.6.11.tar.gz
Redis doesn’t require any configuring before building, so the next step is to compile. Enter make and press Enter. It takes a couple of minutes to compile, but when it’s done you’ll have working redis-server and redis-cli executables in the src directory. Before continuing, it’s best to confirm that the compilation finished without any problems. Many packages, including Redis, provide a test suite to confirm the build results. Run the test suite with this command:
The tests take a few minutes to run, but provide confidence that the software will work as expected. Once we’re satisfied it’s ready, then we can install Redis to the home directory. Install with this command:
make PREFIX=$HOME install
Now, the Redis binaries are in your $HOME/bin directory. You can run the server with redis-server and the command-line client with redis-cli. You’re free to store keys and values to your heart’s content.
For a broader example, featuring several different packages and numerous dependencies, check out our post Setting up the reddit app without root access. It contains several more examples of installing software in your home directory.
Let us know what you’re installing in the comments, and if you need any help, join us in the Q&A Community.