Skip to content

Instantly share code, notes, and snippets.

@miztiik
Last active February 1, 2021 11:11
Show Gist options
  • Save miztiik/2370a40947a9d045af34d210463ac82e to your computer and use it in GitHub Desktop.
Save miztiik/2370a40947a9d045af34d210463ac82e to your computer and use it in GitHub Desktop.
Install a AMP (Apache, Maria DB, PhP) Wordpress website in Redhat
# [To Install EPEL Package](https://fedoraproject.org/wiki/EPEL)
yum -y install epel-release || cd /tmp; curl -O https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && yum -y install release-latest-7.noarch.rpm
# To enable Red Hat's Extras and Optional repos, you would then run the following:
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
# Install PHP, PHPMYADMIN, MARIADB, MYSQL CLIENT & WORDPRESS
yum install -y httpd php php-mysql mariadb-server phpmyadmin \
&& systemctl enable mariadb && service mariadb restart \
&& systemctl enable httpd && systemctl start httpd \
&& firewall-cmd --zone=public --add-port=80/tcp --permanent \
&& firewall-cmd --reload \
&& iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT \
&& /etc/init.d/iptables save \
&& setenforce 0 \
&& echo "Mystique Rox" > /var/www/html/index.html \
&& echo "<?php phpinfo(); ?>" > /var/www/html/test.php
# Download wordpress site & move to http
cd /var/www/
curl -O https://wordpress.org/latest.tar.gz && tar -zxf latest.tar.gz
rm -rf /var/www/html
mv wordpress /var/www/html
# Set the permissions
chown -R root:www /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} +
find /var/www -type f -exec chmod 0664 {} +
# SE Linux permissive
setsebool -P httpd_can_network_connect=1
setsebool httpd_can_network_connect_db on
systemctl restart httpd
# References
## Ref[1] - https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-with-apache-on-a-centos-7-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment