Skip to content

Instantly share code, notes, and snippets.

@ferndot
Last active November 13, 2017 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferndot/45c007d2ed3cd58ef3ea15b2e6470bef to your computer and use it in GitHub Desktop.
Save ferndot/45c007d2ed3cd58ef3ea15b2e6470bef to your computer and use it in GitHub Desktop.
Configures LAMP and other useful things on a fresh Debian 9 install
# Update Debian and installed packages
apt-get update
apt-get -y upgrade
apt-get -y dist-upgrade
# Install curl, etckeeper, and LAMP
apt-get install -y curl etckeeper apache2 mariadb-server mariadb-client mariadb-common php php-dev php-mysqli python-certbot-apache sendmail
# Configure apache2
a2enmod rewrite headers
systemctl restart apache2
# Install mod_pagespeed
curl -O https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb
dpkg -i mod-pagespeed-*.deb
apt-get -f install
rm mod-pagespeed-*.deb
# Start apache2 and mariadb if not already active
systemctl start {apache2,mariadb}
# Configure mysql (mariadb)
mysql_secure_installation
# Configure sendmail
sendmailconfig
# Install and configure phpmyadmin
apt-get install -y phpmyadmin
echo Include /etc/phpmyadmin/apache.conf >> /etc/apache2/apache2.conf
systemctl restart apache2
# Configure auto backup for databases
apt-get install -y automysqlbackup
# Set up a new non-root user with sudo and www-data
read -p "Name the new non-root user > " username && adduser $username
apt-get install -y sudo
usermod -a -G sudo $username
usermod -a -G www-data $username
systemctl restart ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment