Einleitung
Nginx lässt sich direkt aus den Ubuntu-Paketquellen installieren. Dort liegen allerdings häufig ältere Versionen des schnellen Webservers. Alternativ kann das offizielle Nginx-Repository eingebunden werden, um eine aktuellere Version zu erhalten. Die folgenden Shell-Skripte installieren alles Nötige.
Nginx aus den standardmäßigen Ubuntu-Paketquellen installieren
sudo apt-get install nginx
Hinweis
Die folgenden Shell-Skripte müssen mit sudo ausgeführt werden. Sie fügen das offizielle Nginx-Repository als Paketquelle hinzu und installieren anschließend Nginx.
Nginx unter Ubuntu 12.04 LTS Precise Pangolin installieren
#!/bin/bash
######################################################
# Install Nginx on Ubuntu 12.04 LTS Precise Pangolin #
######################################################
# allways update the sources first
apt-get update
apt-get upgrade -y
# change to root directory
cd /root
# get the nginx repository key
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
# remove the key again
rm nginx_signing.key
# add the repository to the source.list
echo
echo "# Repositories for nginx" >> /etc/apt/sources.list
echo "deb http://nginx.org/packages/ubuntu/ precise nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/ubuntu/ precise nginx" >> /etc/apt/sources.list
# update the repositories
apt-get update
apt-get install -y nginx
Nginx unter Ubuntu 12.10 Quantal Quetzal installieren
#!/bin/bash
##################################################
# Install Nginx on Ubuntu 12.10 Quantal Quetzal #
##################################################
# allways update the sources first
apt-get update
apt-get upgrade -y
# change to root directory
cd /root
# get the nginx repository key
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
# remove the key again
rm nginx_signing.key
# add the repository to the source.list
echo
echo "# Repositories for nginx" >> /etc/apt/sources.list
echo "deb http://nginx.org/packages/ubuntu/ quantal nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/ubuntu/ quantal nginx" >> /etc/apt/sources.list
# update the repositories
apt-get update
apt-get install -y nginx
Nginx unter Ubuntu 13.04 Raring Ringtail installieren
#!/bin/bash
##################################################
# Install Nginx on Ubuntu 13.04 Raring Ringtail #
##################################################
# allways update the sources first
apt-get update
apt-get upgrade -y
# change to root directory
cd /root
# get the nginx repository key
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
# remove the key again
rm nginx_signing.key
# add the repository to the source.list
echo
echo "# Repositories for nginx" >> /etc/apt/sources.list
echo "deb http://nginx.org/packages/ubuntu/ raring nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/ubuntu/ raring nginx" >> /etc/apt/sources.list
# update the repositories
apt-get update
apt-get install -y nginx
Nginx unter Ubuntu 13.10 Saucy Salamander installieren
#!/bin/bash
##################################################
# Install Nginx on Ubuntu 13.10 Saucy Salamander #
##################################################
# allways update the sources first
apt-get update
apt-get upgrade -y
# change to root directory
cd /root
# get the nginx repository key
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
# remove the key again
rm nginx_signing.key
# add the repository to the source.list
echo
echo "# Repositories for nginx" >> /etc/apt/sources.list
echo "deb http://nginx.org/packages/ubuntu/ saucy nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/ubuntu/ saucy nginx" >> /etc/apt/sources.list
# update the repositories
apt-get update
apt-get install -y nginx
Nginx unter Ubuntu 14.04 LTS Trusty Tahr installieren
#!/bin/bash
##################################################
# Install Nginx on Ubuntu 14.04 LTS Trusty Thar #
##################################################
# allways update the sources first
apt-get update
apt-get upgrade -y
# change to root directory
cd /root
# get the nginx repository key
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
# remove the key again
rm nginx_signing.key
# add the repository to the source.list
echo
echo "# Repositories for nginx" >> /etc/apt/sources.list
echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
# update the repositories
apt-get update
apt-get install -y nginx