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
# Install phpMyAdmin, PHP (default) to CentOS 7
yum install php php-devel -y
yum install mysql -y
yum install mariadb mariadb-devel -y
yum install phpmyadmin -y
cat <<EOT >> /etc/httpd/conf.d/phpMyAdmin.conf
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Allow from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>
EOT
chkconfig httpd on
chkconfig mariadb on
service httpd start
service mariadb start