How to add shared libraries to Linux's system library path

Sometimes in Linux when you install a new software package the instructions tell you to add a directory of shared libraries to your $LD_LIBRARY_PATH environment variable in your .bashrc.

You may have noticed that if you then create a shortcut icon on your desktop to this application it won't start because it can't find the libraries.
A typical solution is to write a wrapper shell script to set the LD_LIBRARY_PATH and then call that application.

Well, I've discovered how to add them to your system's library path allowing all environments to access them. Note: There are differences between Debian and Ubuntu (the two flavours of Linux that I'm familiar with).

Create a new file in /etc/ called .conf

Edit the file and add a line per directory of shared libraries (*.so files), it will look something like:

Reload the list of system-wide library paths:
sudo ldconfig
Edit /etc/

Add a line per directory of shared libraries (*.so files) to the bottom of the file, it will look something like:
Reload the list of system-wide library paths:
If you run your new application it should now work fine without you having to set any LD_LIBRARY_PATH environment variables.
If you still have problems you can obtain a list of the libraries that are on the system path by re-running the ldconfig command in verbose mode:
ldconfig -v

Technorati Tags: , , , ,

DESTRUCTOID's Team Fortress 2 for Beginners

Reverend Anthony over at the DESTRUCTOID gaming site has written a great set of beginner guides to the different classes of the rather excellent Team Fortress 2 game that came out of beta today. He's provided some tips for each class as well as a general post full of common tips.

I've found them quite invaluable in getting to know the game quickly!

Heavy Weapons Guy
General Tips

Technorati Tags: , , , ,

A Capistrano recipe for restarting Apache 2 (on Linux)

Capistrano is the rather excellent tool for automating Rails application deployment. But it can do a lot more than just uploading Rails applications to live webservers. It's scripts are basically Rake scripts and so have the full power of Ruby behind then so you can pretty much write code to do anything that you want.

I wanted a way to reload the configuration for my Apache2 web server running on my home Ubuntu server. I found a post on Mongrel and Capistrano 2.0 by John Ward which showed a very nifty way to create Capistrano tasks for variants of the same base command.

My adapted version for controlling Apache is:

namespace :apache do
[:stop, :start, :restart, :reload].each do |action|
desc "#{action.to_s.capitalize} Apache"
task action, :roles => :web do
invoke_command "/etc/init.d/apache2 #{action.to_s}", :via => run_method
Add this code to your config/deploy.rb. This will add four new tasks to Capistrano which you can use to restart or reload Apache:
cap apache:stop
cap apache:start
cap apache:restart
cap apache:reload
Technorati Tags: , , , , , , ,