CentOS Bare Stack


  • Strip an existing install of CentOS packages
  • Use CentOS development tools (gcc, make, autoconf, etc.)
  • Build AMP stack manually for future maintenance
  • Duplicate standard CentOS install locations (using /usr as prefix, etc.)

Minimal Install

Since it's more likely than not that you are starting with an existing CentOS install, the first place to begin is by stripping it down to its basics. There are some packages you'll want to download first to make sure you have access to fetch things from the Internet.

Here are some basics you should download the source files for before removing any packages:

  • openssl
  • elinks
  • screen
  • vim
  • dropbear
  • openssh
  • htop
Current Package Set

Get a list of the currently installed programs:

yum list installed | cut -d " " -f 1

Remove Packages

There is a list of “safe” packages that can be removed without affecting any existing LAMP systems:

yes N | yum remove `curl -s http://centos.digitaltrike.com/minimal/remove-packages/safe`

Base Packages

Need to reinstall:

  • sudo
  • vim
yes N | yum remove `curl -s http://centos.digitaltrike.com/minimal/remove-packages/base`

You will need the pam.d sudo file, since yum will remove it.

yum -y remove sudo
wget http://centos.digitaltrike.com/minimal/pam.d/sudo -O /etc/pam.d/sudo

You will also need to run visudo again to setup proper permissions.

Desktop Packages

Need to reinstall:

  • gd
  • ImageMagick
yes N | yum remove `curl -s http://centos.digitaltrike.com/minimal/remove-packages/desktop`

System Packages

yes N | yum remove `curl -s http://centos.digitaltrike.com/minimal/remove-packages/system`

Install Packages

First let's start with the base system, and the applications you are already familiar with. Install these from source:

  • htop
  • unfoo
  • vim
  • libpng
  • libjpeg
  • libgd
  • imagemagick


Create a symlink when finished for CentOS compatability:

ln -s /usr/bin/vim /bin/vi


You'll need to keep the OpenSSL libraries that are installed with CentOS to maintain the existing system. You can upgrade to the latest OpenSSL version and overwrite the old install, if desired.


Install binary as needed, then download the pam.d and init.d files, and add the script to startup:

mkdir -p /var/empty/sshd/etc
chmod 0711 /var/empty/sshd
wget http://centos.digitaltrike.com/init.d/sshd -O /etc/init.d/sshd
chmod +x /etc/init.d/sshd
wget http://centos.digitaltrike.com/minimal/pam.d/sshd -O /etc/pam.d/sshd
chkconfig --add sshd
chkconfig sshd on


You'll need some development libraries before installing:

CentOS packages:

yes N | yum install `curl -s http://centos.digitaltrike.com/minimal/install-packages/graphics`

Source libraries:

Once all the libraries are installed, you can install ImageMagick:


Safely remove Apache and related applications:

yes N | yum remove `curl -s http://centos.digitaltrike.com/minimal/remove-packages/httpd`

Apache comes with templates for directory layouts in config.layout. In this case, use –enable-layout=RedHat


Ruby is a little different, in that you cannot install it directly from the source code, because it requires a previous version of ruby installed to do that. You can, instead, use rvm to install it:

echo insecure >> ~/.curlrc
curl -L get.rvm.io | bash -s stable
gpasswd -a dtrike rvm
source /etc/profile.d/rvm.sh
rvm install 1.9.3