by LinodeApps
7 deployments · 5 still active · last rev. 2 months ago

A Linux Apache2 MySQL and PHP Stack.

The LAMP stack consists of:
- The Linux operating system
- The Apache HTTP Server
- The MySQL relational database management system
- The PHP programming language
This software environment is a foundation for popular PHP application frameworks like WordPress, Drupal, and Laravel. Upload your existing PHP application code to your new Linode or use a PHP framework to write a new application on the Linode.

Compatible with: Debian 9

# <UDF name="dbpass" Label="MySQL root password" example="s3cure_p4ssw0rd" />

# Set hostname
FQDN=$(hostname -f)
IPV4=$(hostname -I | cut -d ' ' -f 1)
IPV6=$(hostname -I | cut -d ' ' -f 2)
hostnamectl set-hostname $HOSTNAME
echo "${IPV4} ${FQDN} ${HOSTNAME}" >> /etc/hosts
echo "${IPV6} ${FQDN} ${HOSTNAME}" >> /etc/hosts

# Update system
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get upgrade -y

# Install/configure UFW
apt-get install -y ufw
ufw default allow outgoing
ufw default deny incoming
ufw allow ssh
systemctl start ufw
systemctl enable ufw

# Install/configure MySQL
apt-get install -y mysql-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation <<EOF


# Install Apache
apt-get install -y apache2

# Install PHP
apt-get install -y php php-mysql

# Configure Apache
ufw allow http
ufw allow https
rm /var/www/html/index.html
cat > /var/www/html/index.php <<EOF
<?php phpinfo(); ?>
systemctl start apache2
systemctl enable apache2

# Cleanup
rm /root/StackScript
echo "Installation complete!"