Forked from adampiotrowski/gist:ccf6342d9308a3abd897
Last active
June 29, 2017 23:03
-
-
Save drmzio/499528b722d37b8ae2ee5dcc9a21c912 to your computer and use it in GitHub Desktop.
Install LEMP (PHP 7.0, MariaDB) on Ubuntu 16.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install updates | |
sudo apt-get update && sudo apt-get upgrade | |
# Update kernel | |
sudo apt-get update && sudo apt-get dist-upgrade | |
# Install LEMP | |
sudo apt-get update && sudo apt-get install software-properties-common | |
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db | |
sudo add-apt-repository 'deb http://mariadb.kisiek.net//repo/10.0/ubuntu trusty main' | |
sudo add-apt-repository ppa:nginx/stable | |
sudo apt-get update | |
sudo apt-get install htop nginx-extras mariadb-server ntp php7.0 php7.0-fpm php7.0-mysql php7.0-gd php7.0-cli php7.0-curl libssh2-php rsync ufw unzip | |
# Start services | |
sudo systemctl start nginx | |
sudo systemctl start mysql | |
sudo systemctl php7.0-fpm | |
# Tweak PHP settings | |
sudo sed -i "s/^expose_php = On/expose_php = Off/g" /etc/php/7.0/fpm/php.ini | |
sudo sed -i "s/^;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.0/fpm/php.ini | |
sudo sed -i "s/^session.gc_probability = 0/session.gc_probability = 1/g" /etc/php/7.0/fpm/php.ini | |
sudo sed -i "s/^;display_errors = Off/display_errors = Off/g" /etc/php/7.0/fpm/php.ini | |
sudo sed -i "s/^max_input_time = -1/max_input_time = 60/g" /etc/php/7.0/fpm/php.ini | |
sudo sed -i "s/^disable_functions = /disable_functions = passthru,shell_exec,proc_open,popen,show_source,/g" /etc/php/7.0/fpm/php.ini | |
sudo sed -i "s/^;listen.mode = 0660/listen.mode = 0660/g" /etc/php/7.0/fpm/pool.d/www.conf | |
sudo systemctl restart php7.0-fpm | |
# Setup MariaDB | |
sudo killall mysqld | |
sudo rm /var/lib/mysql/aria_log_control | |
sudo mysql_install_db | |
sudo service mysql start | |
sudo mysql_secure_installation | |
# Clock | |
sudo dpkg-reconfigure tzdata | |
sudo ntpdate pool.ntp.org | |
sudo service ntp start | |
# Set swap and reboot | |
sudo chmod 600 /swapfile | |
sudo chown root:root /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab' | |
sudo sysctl -w vm.swappiness=15 | |
sudo sh -c 'echo "vm.swappiness = 15" >> /etc/sysctl.conf' | |
sudo reboot | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment