Skip to content

Instantly share code, notes, and snippets.

@mnlcandelaria
Last active July 29, 2017 19:48
Show Gist options
  • Save mnlcandelaria/6ef769387ed4e0a4580d to your computer and use it in GitHub Desktop.
Save mnlcandelaria/6ef769387ed4e0a4580d to your computer and use it in GitHub Desktop.
LAMP on CentOS/Red Hat (RHEL) 7.1/6.7/5.11
php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '7228c001f88bee97506740ef0888240bd8a760b046ee16db8f4095c0d8d525f2367663f22a46b48d072c816e7fe19959') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
cd /;
mkdir server; chmod 777 server; mkdir server/public; mkdir server/conf; mkdir server/conf/apache;
cd server/conf/apache;
echo '# set document root' > httpd.conf
echo 'DocumentRoot "/server"' >> httpd.conf
echo '<Directory "/server">' >> httpd.conf
echo ' Options Indexes FollowSymLinks MultiViews' >> httpd.conf
echo ' AllowOverride All' >> httpd.conf
# apache 2.2
echo ' Order allow,deny' >> httpd.conf
echo ' Allow from all' >> httpd.conf
# apache 2.4
echo ' Require all granted' >> httpd.conf
echo '</Directory>' >> httpd.conf
echo '' >> httpd.conf
echo '# setup dynamic host'
echo '<VirtualHost *:80>' >> httpd.conf
echo ' ServerAlias *' >> httpd.conf
echo ' UseCanonicalName Off' >> httpd.conf
echo ' VirtualDocumentRoot /server/public/%0/current' >> httpd.conf
echo ' VirtualScriptAlias /server/public/%0/current' >> httpd.conf
echo '</VirtualHost>' >> httpd.conf
# include to httpd.conf
cd /etc/httpd/conf
echo '' >> httpd.conf
echo '# server conf' >> httpd.conf
echo 'Include /server/conf/apache/*.conf' >> httpd.conf
# restart apache
systemctl restart httpd.service
# service httpd restart
# apache 2.4 and php 5.6
cd ~
yum update -y
## Remi Dependency on CentOS 7 and Red Hat (RHEL) 7 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
## CentOS 7 and Red Hat (RHEL) 7 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# install apache and php
yum --enablerepo=remi,remi-php56 install httpd php php-common
# php 5.6 modules
yum --enablerepo=remi,remi-php56 install php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
yum install php-mysql
# install packages
yum install nano
# start and enable httpd
systemctl start httpd.service
systemctl enable httpd.service
# installing firewalld
yum install firewalld
systemctl start firewalld
firewall-cmd --get-active-zones
firewall-cmd --permanent --zone=public --add-service=http
## OR ##
firewall-cmd --permanent --zone=public --add-port=80/tcp
# restart firewalld
systemctl restart firewalld.service
# setenforce
setenforce 0
# page for browser
cd /; cd var/www/html;
echo '<?php' > index.php
echo 'phpinfo();' >> index.php
# mysql 5.7
cd ~
yum update -y
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum install mysql-community-server
systemctl start mysqld.service
systemctl enable mysqld.service
chkconfig --levels 235 mysqld on
# get your generated random root password
grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1
/usr/bin/mysql_secure_installation
yum install epel-release -y
rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm
yum search php7
yum install php70u php70u-cli php70u-json -y
# APT Repository
# debian ubuntu 14.04
deb http://www.rabbitmq.com/debian/ testing main
wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
apt-key add rabbitmq-signing-key-public.asc
apt-get update
apt-get install rabbitmq-server
# rabbitmq management
rabbitmq-plugins enable rabbitmq_management
# http://localhost:15672/
# rabbitmqctl stop (stop)
# rabbitmqctl status (status)
# rabbitmq-server (start)
# rabbitmq-server -detached (run in background)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment