Web Server Install

by fkp-trevork
9 deployments · 0 still active · last rev. 4 years ago

Install Nginx, PHP

Compatible with: No distros currently supported
Includes: private-script
						#!/bin/bash

######################
# START Base Install #
######################
# <UDF name="name" Label="System Hostname" />
# <UDF name="public_ip" Label="System IP address Public" />
# <UDF name="public_gateway" Label="Public Gateway" />
# <UDF name="private_ip" Label="System IP address Private" />
source <ssinclude StackScriptID="4269">

apply_hostname -f "$NAME"
setup_network -f "$NAME" "$PUBLIC_IP" "$PUBLIC_GATEWAY" "$PRIVATE_IP"
install_keys
set_timezone
update_system
####################
# END Base Install #
####################

###############################
# START Install Nginx and PHP #
###############################

function remi_rpm {
	## Import the REMI rpm
	
	## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
	rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
 
	## CentOS 6 and Red Hat (RHEL) 6 ##
	rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
}

function nginx_repo {
	echo -e "[nginx] \nname=nginx repo \nbaseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/ \ngpgcheck=0 \nenabled=1" > /etc/yum.repos.d/nginx.repo
}

function install_php {
	yum -y --enablerepo=remi install nginx php php-fpm php-common
	yum -y --enablerepo=remi install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
}

function setup_nginx {
	chkconfig httpd off
	chkconfig --add nginx
	chkconfig --levels 235 nginx on
	chkconfig --add php-fpm
	chkconfig --levels 235 php-fpm on
	
	mkdir /etc/nginx/sites-available
	mkdir /etc/nginx/sites-enabled
	
	# Configure PHP
	wget -N -P /etc/php-fpm.d/ 192.168.129.23/etc/php-fpm.d/www.conf
	wget -N -P /etc/ 192.168.129.23/etc/php-fpm.conf
	wget -N -P /etc/ 192.168.129.23/etc/php.ini
	
	# Download the nginx config ** SHOULD PASSWORD PROTECT THIS, FOR NOW ITS PRIVATE NETWORK **
	wget -N -P /etc/nginx/ 192.168.129.23/etc/nginx/nginx.conf
}

# Run these once everything has been configured No reason to do it till then
function restart_service {
	/etc/init.d/httpd stop
	/etc/init.d/nginx restart
	/etc/init.d/php-fpm restart
}

remi_rpm
nginx_repo
install_php
setup_nginx
restart_service

#############################
# END Install Nginx and PHP #
#############################

# GlusterFS
yum -y install wget fuse fuse-libs
cd /tmp
wget http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/6/glusterfs-core-3.2.6-1.el6.x86_64.rpm
wget http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/6/glusterfs-fuse-3.2.6-1.el6.x86_64.rpm
wget http://download.gluster.com/pub/gluster/glusterfs/LATEST/CentOS/6/glusterfs-geo-replication-3.2.6-1.el6.x86_64.rpm

rpm -Uvh glusterfs-core-3.2.5-2.el6.x86_64.rpm
rpm -Uvh glusterfs-fuse-3.2.5-2.el6.x86_64.rpm
rpm -ivh glusterfs-geo-replication-3.2.5-2.el6.x86_64.rpm

/etc/init.d/glusterd start
chkconfig glusterd on