Skip to content

Instantly share code, notes, and snippets.

@ipascual
Last active January 10, 2018 23:50
Show Gist options
  • Save ipascual/a48e86a46b7cd27ed173107548fb358a to your computer and use it in GitHub Desktop.
Save ipascual/a48e86a46b7cd27ed173107548fb358a to your computer and use it in GitHub Desktop.
centos7 - install LAMP
# Required Software
yum -y install git figlet gcc-c++ nfs-utils awscli firewalld mariadb psmisc mailx bzip2
# PHP 5.6.32
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://centos7.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath php56u-soap
sed -i 's/memory_limit = 128M/memory_limit = -1/g' /etc/php.ini
# Apache2
yum install -y httpd
systemctl enable httpd
systemctl start httpd
mkdir -p /var/www
chown apache:apache /var/www
chmod 755 /var/www
mkdir -p /etc/httpd/sites-available
mkdir -p /etc/httpd/sites-enabled
echo "IncludeOptional sites-enabled/*.conf" >> /etc/httpd/conf.d/talos.conf
vi /etc/httpd/sites-available/default.conf
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog "logs/default-error.log"
CustomLog "logs/default-access.log" combined
<Directory "/var/www/html">
AllowOverride All
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
Options Indexes FollowSymLinks
Require all granted
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
</Directory>
</VirtualHost>
ln -sfn /etc/httpd/sites-available/default.conf /etc/httpd/sites-enabled/default.conf
systemctl reload httpd
sudo chcon -t httpd_sys_rw_content_t /var/www -R
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
# MySQL
yum install -y mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment