Remove unnecessary web services pre-installed with Ubuntu 16.04

Posted January 11, 2017 7.2k views
Server OptimizationSecurityLEMPUbuntu 16.04

on a fresh ubuntu 16.04 there are many services pre-installed. i want to know are there any services that are not required with my following setup?

I ill be having a wordpress site on LEMP and a php application.

more importantly, removing those unnecessary services will give me any significant benefits? i mean does it worth the effort?

thanks in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

Our Ubuntu images are pretty basic, providing the core distribution. While it may be possible to disable or remove a few services the time involved in doing so would likely not be worth the effort in terms of disk space and resources (RAM/CPU) saved.

Packages within the core distribution of Ubuntu have a lot of inter-dependencies so often, removing something you don’t think is needed could end up also removing (or trying to) services that are necessary or directly related to what you want to run.


The Ubuntu images provided by DigitalOcean are pretty basic and very close to the minimal images provided by Ubuntu, so there’s really nothing to remove.

That being said, when you begin installing packages from the CLI, it is possible that some packages will be installed that you do not want or need, but there is a remedy for that, too!

When running:

sudo apt-get install -y package package-two package-three

Add --no-install-recommends to the end.

So the actual command will look like:

sudo apt-get install -y package package-two package-three --no-install-recommends

That’ll help keep things clean and prevent often useless packages from being installed when they don’t need to be.

You can also get a list of packages installed using the command

$ apt-cache pkgnames

and pipe that to a file if you want to look up each package and check what it is.

$ apt-cache pkgnames | tee pkgnames.txt