A look at installing your own tools on WebFaction servers

Posted in Server setup by

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:

  1. Get the source.
  2. Configure (if applicable) and build.
  3. Install.

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:

wget http://redis.googlecode.com/files/redis-2.6.11.tar.gz

Next, extract the tarball and switch to the source directory with these commands:

tar -xf redis-2.6.11.tar.gz
cd redis-2.6.11

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:

make test

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.

-
-

Welcoming Ruby 2.0

Posted in General by

Today we’re happy to announce that the recently released Ruby 2.0 is now available on all of our servers. You can run Ruby 2.0 today as ruby2.0. Here it is on Web310:

$ ruby2.0 -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]

Ruby 2.0 comes with a number of new features, performance improvements, and built-in library changes.

One of the more prominent new features is an addition to the language syntax: keyword arguments. Sometimes known as named parameters, keyword arguments provide a more explicit way of using arguments and setting defaults. Here’s a little example:

$ irb2.0
irb(main):001:0> def greet(greeting: 'Hello',  name: 'WebFactioneers')
irb(main):002:1>   puts "#{greeting}, #{name}!"
irb(main):003:1> end
=> nil
irb(main):004:0> greet(name: 'readers')
Hello, readers!
=> nil
irb(main):005:0> greet(greeting: 'Howdy')
Howdy, WebFactioneers!
=> nil
irb(main):006:0> # you can even change the order
irb(main):007:0* greet(name: 'readers', greeting: 'Salutations')
Salutations, readers!
=> nil

For more details about Ruby 2.0, including a description of potential incompatibilities with previous Ruby versions, please see the official release notes. Try out Ruby 2.0 with your WebFaction account and, if you have any questions, join us in the Q&A Community.

-
-

A look at version control on our servers

Posted in Git by

Appending version_36 or final_2 to a file name is no way to keep track of different versions of files. Instead, we’re lucky to have a wide variety of version control tools at our disposal. And a webserver is no place to skimp on such things, so today we’re taking a look at version control on WebFaction’s servers.

If you like your version control centralized, with a single, authoritative repository, we’ve got you covered with Subversion. Both the Subversion client and server are available with your WebFaction account.¬†For example, you can check out a working copy of the WordPress trunk with the svn command-line client like this:

$ svn co http://core.svn.wordpress.org/trunk/ wp-source

You can also serve a Subversion repository with the one-click installer. You can serve a Subversion repository publicly for open-source projects, or set up users to control access for private projects. Check out the Subversion documentation for more details.

If you like your version control distributed, where each user has a complete “clone” of the repository, then Git is a great choice. Each WebFaction server has the Git client installed, and serving Git repositories on the web is a snap with the one click installer. The client’s handy for grabbing code from GitHub, like the Django¬†repository:

$ git clone https://github.com/django/django.git

Like Subversion, you can make respositories available on the web with the one-click installer. A single Git application can host mulitple repositories and can be configured for public access or per user access for private projects. See the Git documentation for detailed instructions.

An additional benefit of using a Git or Subversion application is that you can link your repositories to a Trac installation. Trac is a handy, open source project management tool that features a ticket tracker, wiki, and repository browser. For more details about using Trac with your WebFaction account, see our Trac documentation.

Of course, Git and Subversion aren’t your only options. It’s easy to set up other version control tools in your home directory. We have instructions for installing Mercurial and Bazaar clients, as well as publishing Mercurial and Bazaar repositories on the web with hgweb and loggerhead respectively.

So if you haven’t already, give version control a try with your WebFaction account. Let us know what you think in the comments, or if you need any help, join us in the Q&A Community.

-
-