Skip to content

Instantly share code, notes, and snippets.

@emotality
Last active August 29, 2015 14:15
Show Gist options
  • Save emotality/08243741c0212a99c3d3 to your computer and use it in GitHub Desktop.
Save emotality/08243741c0212a99c3d3 to your computer and use it in GitHub Desktop.
LAMP (Linux, Apache, MySQL, PHP)
#===================================================#
# LAMP (Linux, Apache, MySQL, PHP)
# CentOS 6.5
# Apache 2.2.15
# MySQL 5.1.73
# PHP 5.6.5 (phpMyAdmin 4.0.10.8)
#===================================================#
######################################################
## USERS & ACCESS
######################################################
## SSH
ssh root@example.com
## Change root password
passwd
## Add user
/usr/sbin/adduser <username>
passwd <username>
## Add group
groupadd staff
usermod -G staff <username>
## Edit Privileges
/usr/sbin/visudo
# root ALL=(ALL) ALL
# <username> ALL=(ALL) ALL
#
# Press Escape, :wq, then Enter to save and exit the file.
## Reload SSH
service sshd restart
######################################################
## REQUIRED DEPENDANCIES
######################################################
## wget File Downloader
yum install wget -y
## nano Text Editor
yum install nano -y
## epel Extra Packages Enterprise Linux
CentOS/RHEL 6.x:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
CentOS/RHEL 7.x:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
## Update yum
yum update
######################################################
## VMWARE
######################################################
## Install VMWare
curl -k https://support.afrihost.com/updates/VMwareTools-latest.tar.gz | tar -C /root/ -xz && ./vmware-tools-distrib/vmware-install.pl -d
######################################################
## APACHE
######################################################
## Install Apache
yum install httpd -y
## Add to startup
chkconfig --levels 235 httpd on
## Open port 80
nano /etc/sysconfig/iptables
## Insert the following
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
## Restart firewall
service iptables restart
## Start Apache
service httpd start
# Document root : /var/www/html
# Config root : /etc/httpd/conf/httpd.conf.
# Extra config : /etc/httpd/conf.d/ directory.
######################################################
## PHP
######################################################
## Install PHP
yum --showduplicates list php56w
yum install php56w php56w-opcache -y
service httpd restart
######################################################
## MYSQL
######################################################
## Install
yum install mysql mysql-server -y
## Add MySQL to startup
chkconfig --levels 235 mysqld on
## Restart server & SSH again
sudo shutdown -r now
## Configure
mysql_install_db
mysql_secure_installation
## Restart
service mysqld restart
######################################################
## PHPMYADMIN
######################################################
## Add repo
cd ~
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release*
## Install
yum install phpmyadmin -y
## Configure
nano /etc/httpd/conf.d/phpMyAdmin.conf
## Change "Require IP" to your computer IP
## Change "Allow IP" to your computer IP or "all"
service httpd restart
sudo shutdown -r now
######################################################
## THE END
######################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment