Skip to content

Instantly share code, notes, and snippets.

@anilcancakir
Created October 13, 2017 13:42
Show Gist options
  • Select an option

  • Save anilcancakir/a2d9e15e9590680596b2fb19c3e46e41 to your computer and use it in GitHub Desktop.

Select an option

Save anilcancakir/a2d9e15e9590680596b2fb19c3e46e41 to your computer and use it in GitHub Desktop.
Install PHP 7.0 with FPM, Nginx stable, PostgreSQL 10
#!/bin/bash
# Swith to root
sudo su;
echo "Swithed root.";
echo "Show your system information";
lsb_release -a;
# Add the nginx source
# IMPORTANT: Change the "trusty" name for your version (14.04: trusty, 16.04: xenial)
rm -r /etc/apt/sources.list.d/nginx.list;
echo "deb http://nginx.org/packages/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/ubuntu/ trusty nginx
deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main" > /etc/apt/sources.list.d/nginx.list;
echo "Added the nginx sources.";
# Add the php ppa
add-apt-repository ppa:ondrej/php -y;
echo "Added the php ppa.";
# Add postgresql repository
# IMPORTANT: Change the "trusty" name for your version (14.04: trusty, 16.04: xenial)
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list;
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -;
echo "Added postgresql repository.";
# Update
apt-get -y update;
echo "Updated the package lists.";
# Install nginx
apt-get -y install nginx;
nginx -v;
echo "Installed nginx.";
# Install postgresql
apt-get install -y postgresql postgresql-contrib;
echo "Installed postgresql.";
# Install php and extensions
apt-get install -y php7.0 php7.0-fpm php7.0-mcrypt php7.0-xml php7.0-pgsql;
php -v;
echo "Installed php.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment