Debian Lenny - Installing Nginx via aptitude

Nginx is a popular lightweight server for those who do not need the bulk and extra services that Apache may offer.

This article will look at installing Nginx on a Debian Lenny Slice using the 'aptitude' package manager.


Using the built-in package manager to install packages is a great idea as it solves dependency issues and you are assured of any security updates, if and when they occur.

However, one drawback can be that it is rare for a version upgrade to be placed into the repositories. As such, it is possible for a newer version of an application to be released and not be placed into the repository.

Versions

At the time of writing, aptitude will install Nginx version 0.6.32.

However, at the time of writing, the latest stable version of Nginx is 0.7.61. You can check the latest versions and change logs at the main nginx site.

Which one you choose is, of course, entirely up to you.

Install and Dependencies

Installing Nginx is incredibly simple as it involves only one command:

sudo aptitude install nginx

This will install any and all dependencies that Nginx requires, such as libpcre.

Start

One odd thing is that Nginx is not started automatically:

sudo /etc/init.d/nginx start

Done.

Navigate

Now simply navigate to your IP address, and you will see the wonderfully simple welcome screen:

Nginx Welcome Screen

Init scripts

As you would imagine when installing an application with the aptitude package manager, all init scripts have been created and added to the relevant run levels.

Controlling nginx is done with these commands:

sudo /etc/init.d/nginx start
...
sudo /etc/init.d/nginx stop
...
sudo /etc/init.d/nginx restart

That's it.

Summary

Using the aptitude package manager makes the installation of Nginx and associated dependencies very simple indeed.

The only thing to consider is the version disparity between the one offered by aptitude and the one available via source code.

Ben B

Article Comments:

john commented Sun Jul 26 01:48:48 UTC 2009:

Hi, any comments on what to do if you install a more recent version from source? There are then no init.d scripts... many thanks.

Tom commented Fri Jul 01 04:47:59 UTC 2011:

Very good articles. Have been struggling with ruby/rails etc. These articles have been informative.

I need to also intall passenger. any articles on that?

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)