Description
TODO: Firewall dependency
Dependency
- Setup Timezone
- Initialized CentOS Server
Option
Script
# Setup Timezone
function isinstalled {
if yum list installed | grep "$@"; then
true
else
false
fi
}
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
if isinstalled "ntp"; then
echo "Install ntp .......... [${GREEN}OK${RESET}]";
else
yum install ntp -y;
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
ntpd
chkconfig ntpd on
echo "Install ntp .......... [${GREEN}Installed${RESET}]";
fi
# Initialized CentOS Server
yum groupinstall "Development tools" -y
yum install nano wget -y
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel -y
yum install libjpeg-devel freetype-devel libpng-devel -y
yum install libxml2-devel libxslt-devel -y
yum install epel-release -y
setenforce 0
# TODO: disable
# nano /etc/selinux/config
# SELINUX=disabled
# Setup NginX
function isinstalled {
if yum list installed | grep "$@"; then
true
else
false
fi
}
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
if isinstalled "nginx"; then
echo "Install nginx .......... [${GREEN} OK ${RESET}]";
else
yum install nginx -y;
cat <<EOT > /etc/nginx/nginx.conf
user nginx;
worker_processes {{ NGINX_PROCESSES }};
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;
server_names_hash_bucket_size 64;
}
EOT
mkdir -p /etc/nginx/sites-available
chkconfig nginx on
service nginx start
echo "Install nginx .......... [${GREEN} Installed ${RESET}]";
fi