Skip to content

Instantly share code, notes, and snippets.

@noone0
Forked from nunorbatista/centos_php7_fresh.sh
Created February 7, 2018 19:26
Show Gist options
  • Save noone0/c00122bd0359b3692aa164ca45b1f918 to your computer and use it in GitHub Desktop.
Save noone0/c00122bd0359b3692aa164ca45b1f918 to your computer and use it in GitHub Desktop.
PHP7 Centos 7 fresh install script
#/!/bin/bash
# update system
yum update -y
# install bind-utils
sudo yum install bind-utils
# Apache
yum install nano wget curl vim git httpd -y
# Bring repos in
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# get latest mysql
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
yum localinstall mysql-community-release-el7-5.noarch.rpm -y
yum install mysql-community-server -y
systemctl enable mysqld.service
/bin/systemctl start mysqld.service
# DEV Tools
yum groupinstall 'Development tools' -y
# Install PHP7
yum install -y php70w php70w-opcache php70w-cli php70w-common php70w-gd php70w-mbstring php70w-mcrypt php70w-pdo php70w-xml php70w-mysqlnd
# Configure it
rm /etc/httpd/conf.d/php.conf -rf
rm /etc/httpd/conf.modules.d/10-php.conf -rf
# Load PHP7 into apache
touch /etc/httpd/conf.d/php7.conf
cat << EOF > /etc/httpd/conf.d/php7.conf
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
EOF
# Install NodeJS
sudo yum install nodejs -y
sudo yum install npm -y
# Start Apache
systemctl enable httpd
systemctl start httpd
# Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment