I'm using Vagrant to build a reproducible virtual machine for one of my projects. This virtual machine needs a basic LEMP stack, and I'm using a shell script to provision it after it's created.
The part I'm having trouble with is installing nginx from source. The provisioning script is as follows:
#!/bin/bash
# nginx settings
NGINX_VERSION=1.4.7
NGINX_SOURCE=http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
echo "==> Installing required packages and upgrading"
apt-get -u update
apt-get install make
echo "==> Checking if nginx is installed"
if [ ! -e /opt/nginx-$NGINX_VERSION ]
then
echo "==> nginx not installed, installing nginx $NGINX_VERSION"
# Download nginx to /usr/src and cd into the extracted directory
cd /usr/src
wget $NGINX_SOURCE
tar xf nginx-$NGINX_VERSION.tar.gz
cd nginx-$NGINX_VERSION
# Configure nginx
./configure --with-pcre --with-http_ssl_module --with-http_spdy_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --prefix=/opt/nginx-$NGINX_VERSION
# Make nginx and install it
make
make install
fi
The process fails at the make
and make install
steps, producing the following errors:
make: *** No rule to make target `build', needed by `default'. Stop.
make: *** No rule to make target `install'. Stop.
I've had to install make
using apt-get
at the start of the script because the image I'm using doesn't already have make
installed. The image is a Ubuntu Server 12.04 64-bit image.
I've verified that nginx gets successfully downloaded and extracted by checking the usr/src
directory after the scripts runs.
Googling the make
errors doesn't seemm to return anything useful I can work with as they're all specific to installing software that I'm not using.
Any ideas?