Installing Software from Source

Many software packages can be installed to your home directory by building the software from source. While building software from source may sound like a challenge, it is usually an easy process. To build software from source and install it to your home directory:

  1. Open an SSH session to your account.

  2. Create a temporary directory. Some software installations may require a user-writable temporary directory. To create the directory, enter mkdir -p $HOME/tmp and press Enter.

  3. Set the TEMPDIR environment variable to point to the temporary directory. Enter export TEMPDIR=$HOME/tmp and press Enter.

  4. Download the source to your home directory.

    Typically, source is distributed in the form of a zip or tar archive which contains the software package’s source files, configuration scripts, and documentation. To download this file directly to your home directory with wget: enter wget url, where url is the URL for the source archive, and press Enter. The source archive is created in the current directory.

  5. Unpack the source archive.

    To unpack a zip file, enter unzip file, where file is the path to the source archive, and press Enter.

    To unpack a tar file, enter tar -xf file, where file is the path to the source archive, and press Enter.

    The new directory containing the source files is created in the current directory.

  6. Switch to the source directory. Enter cd source, where source is the path to the directory containing the source files, and press Enter.

  7. Read the software’s documentation. Some software packages may have additional installation steps or configuration switches not described by these instructions. Review the package’s README and INSTALL files, if available.

  1. Run the package’s configure script. The script prepares the build environment for the package; typically, switches on this script determine where to install the software and where to find relevant dependencies. The most frequently used switches include:

    --prefix=

    This switch determines where the software will be installed, including shared libraries and executables. You will use --prefix=$HOME to choose your home directory as the installation destination.

    --with-curl=

    If applicable, this switch notifies the software where to find the cURL executable. You can use --with-curl=/usr to specify the system’s cURL executable. Alternatively, you can use --with-curl=$HOME to specify a different version of cURL you may have installed in your home directory.

    --with-wget=

    If applicable, this switch notifies the software where to find the wget executable. You can use --with-wget=/usr to specify the system’s wget executable. Alternatively, you can use --with-wget=$HOME to specify a different version of wget you may have installed in your home directory.

    To see all of the available options, enter ./configure --help and press Enter.

    To run the configure script, enter ./configure --prefix=$HOME switches, where switches are any additional, space-separated switches the software requires, and press Enter.

  2. Build the binaries from the source: enter make and press Enter. The build will run.

    Note

    This step may take a few minutes to complete.

  3. Install the software. Enter make install. The completed software is copied to appropriate locations, such as executables in ~/bin and libraries in ~/lib.

Troubleshooting

Depending on Non-Standard Libraries and Headers Causes Errors

Some software packages may depend on non-standard libraries or headers. If these dependencies are not available, you may encounter an error such as cannot open shared object file: No such file or directory or various other errors while running the software’s configure script. These problems can be resolved with the help of some environment variables: CPPFLAGS, LDFLAGS, and LD_LIBRARY_PATH.

See also

Don’t forget to set appropriate configure switches, too. See the Installing Software from Source step-by-step instructions for details.

CPPFLAGS is used to support non-standard headers. For installations which require additional headers, you may add your home directory’s include directory to CPPFLAGS. Before running configure or make, enter export CPPFLAGS="-I$HOME/include $CPPFLAGS" and press Enter.

LDFLAGS is used to support non-standard libraries. For installations and executions which require additional libraries, you may add your home directory’s lib directory to LDFLAGS. Before running configure or make, enter export LDFLAGS="-L$HOME/lib $LDFLAGS" and press Enter.

Like LDFLAGS, LD_LIBRARY_PATH is used to support non-standard libraries. For installations and executions which require additional libraries, you may add your home directory’s lib directory to LD_LIBRARY_PATH. Before running configure, make, or the software after it is installed, enter export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH and press Enter.

To simplify future usage, permanently amend your LD_LIBRARY_PATH by adding the export statement to your $HOME/.bash_profile file. To permanently add $HOME/lib to your LD_LIBRARY_PATH, enter echo "export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH" >> $HOME/.bash_profile and press Enter.

Finally, for commands which run outside of your shell process, like an Apache server for a Django application or a cron script, you may need to make additions to LD_LIBRARY_PATH elsewhere.

For example, a Django application’s start script already defines the LD_LIBRARY_PATH environment variable. To add $HOME/lib to the application’s LD_LIBRARY_PATH, edit $HOME/webapps/app/apache2/bin/start from this:

LD_LIBRARY_PATH=/home/<username>/webapps/<app>/apache2/lib /home/<username>/webapps/<app>/apache2/bin/httpd.worker -f /home/<username>/webapps/<app>/apache2/conf/httpd.conf -k start

to this:

LD_LIBRARY_PATH=/home/<username>/lib:/home/<username>/webapps/<app>/apache2/lib /home/<username>/webapps/<app>/apache2/bin/httpd.worker -f /home/<username>/webapps/<app>/apache2/conf/httpd.conf -k start

where <username> is your username and <app> is the name of the application.

Likewise, to change a cron job’s LD_LIBRARY_PATH, prepend LD_LIBRARY_PATH=$HOME/lib to your cron job’s command. For example, edit this cron task:

1 0 * * * command

to this:

1 0 * * * LD_LIBRARY_PATH=/home/username/lib command

where username is your username and command is the task to be executed.

Previous topic

General Topics

Next topic

Bazaar

Search the documentation

Example: "configure email" or "create database"

Feedback

Send us your feedback on this documentation.