Skip to content

Instantly share code, notes, and snippets.

@mikepfeiffer
Last active June 20, 2021 15:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save mikepfeiffer/c0c3b32287a25404122331c7d37f3973 to your computer and use it in GitHub Desktop.
Save mikepfeiffer/c0c3b32287a25404122331c7d37f3973 to your computer and use it in GitHub Desktop.
Setup Apache on Amazon Linux
#!/bin/bash
yum update -y
yum install -y httpd24 php70 mysql php70-mysqlnd
service httpd start
chkconfig httpd on
usermod -a -G apache ec2-user
sudo chown -R ec2-user:apache /var/www
sudo chmod 2775 /var/www
@be-aws-architect
Copy link

The yum-install commands no longer work.

Use the following command to enable PHP for your WordPress instance:
yum -y install httpd mysql
amazon-linux-extras install epel -y
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php73
amazon-linux-extras install php7.3 -y

@nicholaschaung
Copy link

Agree with @Chainshark those no longer work. Alternatively, this might be simpler:
sudo yum install -y httpd php mysql php-mysqlnd

@bureku
Copy link

bureku commented May 20, 2020

Agree with @Chainshark those no longer work. Alternatively, this might be simpler:
sudo yum install -y httpd php mysql php-mysqlnd

WordPress requires PHP 7, on EC2 using Amazon Linux instance, this command will install PHP 5.

Copy link

ghost commented Jun 18, 2020

@nicholaschaung @Chainshark the yum install -y httpd24 php70 mysql php70-mysqlnd command works fine on an Amazon Linux AMI instance.

[root@ip-10-0-0-60 ec2-user]# cat /etc/os-release
NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
...

You might want to check if your Linux instance has yum installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment