Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Centos 6.5 LAMP setup - Includes Jenkins setup.
#!/bin/bash
##
## Install MySQL - MariaDB is cool too, but let's stick with MySQL for all intensive purposes.
##
yum -y install mysql mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
mysql_secure_installation
##
## Install Apache
##
yum -y install httpd
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
## Check for Apache Placeholder
## Visit your IP in a browser: http://x.x.x.x
##
## IF YOU HAVE FIREWALL ISSUES
##
iptables -F # Flush that bish - also your @fallback
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT # For jenkins
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 465 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 110 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 995 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 143 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 993 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # For outgoing connections
iptables -P OUTPUT ACCEPT
iptables -P INPUT DROP
iptables -L -n # Review that bish
iptables-save | sudo tee /etc/sysconfig/iptables # Save that bish
service iptables restart # Restart that bish
##
## Install Java
##
yum -y install java-1.6.0-openjdk
/etc/init.d/httpd restart
##
## Install PHP
##
yum -y install php
/etc/init.d/httpd restart
##
## Create a test file with phpinfo.php in it
##
vi /var/www/html/info.php
##
## Now, back to PHP Module Install
##
yum -y install php-mysql
yum -y install memcached # Memcached and memcache are two different things, peepo. For high performing sites, let's use memcached until we can make Redis standard
yum -y install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel
yum -y install php-pecl-memcached
##
## Install PHPMyAdmin - Only if you can be careful with it
##
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
yum -y install phpmyadmin # Again, ONLY if you can be careful with it.
service httpd restart # Restart that bish
##
## Install Jenkins for Continuous Integration
##
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo;
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key;
yum -y install jenkins
chkconfig --levels 235 jenkins on # Start jenkins when we boot
service httpd restart # Restart that bish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.