echo “*******安装源并更新*******”
echo “**************************”
yum install -y epel-release
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum update -y
echo “************************”
echo “********安装mysql*******”
echo “************************”
yum install -y mysql-community-server mysql-devel mysql-connector-odbc libdbi-dbd-mysql
echo “**********************”
echo “*******安装wget*******”
echo “**********************”
yum -y install wget
echo “********************************”
echo “*******添加防火墙过滤规则*******”
echo “********************************”
firewall-cmd –permanent –zone=public –add-service=https
firewall-cmd –permanent –zone=public –add-service=http
firewall-cmd –permanent –zone=public –add-service=mysql
firewall-cmd –permanent –zone=public –add-port=10000/tcp
#firewall-cmd –permanent –zone=public –add-port=10/udp
firewall-cmd –permanent –zone=public –add-service=openvpn
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j MASQUERADE
echo “************************”
echo “*******重启防火墙*******”
echo “************************”
systemctl restart firewalld.service
echo “***********************”
echo “*******安装mysql*******”
echo “***********************”
yum install -y mysql-community-server mysql-devel mysql-connector-odbc libdbi-dbd-mysql
echo “***************************”
echo “*******创建mysql密码*******”
echo “***************************”
#mysql_secure_installation
#mysqladmin -uroot password “radiusmysql”
echo “****************************”
echo “*******安装FreeRadius*******”
echo “****************************”
yum install -y freeradius freeradius-utils freeradius-mysql
echo “*************************”
echo “*******清除yum缓存*******”
echo “*************************”
yum clean all
echo “**************************”
echo “*******安装监测系统*******”
echo “**************************”
yum install -y sysstat
echo “**************************”
echo “*******安装授时服务*******”
echo “**************************”
yum install -y ntpd
yum install -y ntp
yum install -y mod_ssl haproxy squid httpd dnsmasq exim
echo “*************************”
echo “*******安装Apache2*******”
echo “*************************”
yum install -y httpd
echo “**********************”
echo “*******安装PHP********”
echo “**********************”
yum -y install unzip zip php php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-mysql php-gd php-pear-DB gcc gcc make vim-enhanced libxml2 libxslt pkgconfig zlib-devel gcc-c++ libgcrypt-devel crypt*
echo “***************************************”
echo “*******apache添加目录权限**************”
echo “***************************************”
chown apache.apache -R /var/www/html
echo “*********************************”
echo “*******安装Squid代理服务器*******”
echo “*********************************”
yum install squid -y
yum install iptables-services -y
#function openvpn_install
#{
#wget https://github.com/Nyr/openvpn-install/blob/master/openvpn-install.sh
#cd /root
#chmod 777 /root/openvpn-install.sh
#./openvpn-install.sh
#cd /root
#wget http://www.nongnu.org/radiusplugin/radiusplugin_v2.1a_beta1.tar.gz
#tar -zxvf radiusplugin_v2.1a_beta1.tar.gz
#cd radiusplugin_v2.1a_beta1
#make > /dev/NULL
#cp radiusplugin.so /etc/openvpn > /dev/NULL
#cp radiusplugin.cnf /etc/openvpn > /dev/NULL
#cd /root
#}
function web_install
{
wget http://nchc.dl.sourceforge.net/project/daloradius/daloradius/daloradius0.9-9/daloradius-0.9-9.tar.gz
mkdir /var/www/html/daloradius
tar zxvf daloradius-0.9-9.tar.gz
mv daloradius-0.9-9/* /var/www/html/daloradius/
mkdir /var/www/html/daloradiususers/
mv /var/www/html/daloradius/daloradius-users/* /var/www/html/daloradiususers/
#修改权限
chmod 644 /etc/raddb/dictionary
chown apache /etc/raddb
chown apache /etc/raddb/clients.conf
chown -R apache:apache /var/www/html/daloradius/*
chown -R apache:apache /var/www/html/daloradiususers/*
cd /root/
echo “********************************”
echo “*******安装webmin管理面板*******”
echo “********************************”
echo “[Webmin]
name=Webmin Distribution Neutral
baseurl=http://download.webmin.com/download/yum
enabled=1
gpgcheck=1
gpgkey=http://www.webmin.com/jcameron-key.asc” >/etc/yum.repos.d/webmin.repo;
yum -y install webmin
echo “************************************”
echo “*******安装PHPMyAdmin管理面板*******”
echo “************************************”
cd /root/
wget https://files.phpmyadmin.net/phpMyAdmin/4.4.15.10/phpMyAdmin-4.4.15.10-all-languages.zip
unzip phpMyAdmin-4.4.15.10-all-languages.zip
mkdir /var/www/html/PHPMyAdmin
mv /root/phpMyAdmin-4.4.15.10-all-languages/* /var/www/html/PHPMyAdmin
}
#####################################################################################
function delete_file
{
#移除下载残留文件daloradius-0.9-9.tar.gz
rm -rf /root/daloradius-0.9-9.tar.gz
rm -rf /root/daloradius-0.9-9
#移除下载残留文件phpMyAdmin-4.4.15.10-all-languages.zip
rm -rf /root/phpMyAdmin-4.4.15.10-all-languages
rm -rf /root/phpMyAdmin-4.4.15.10-all-languages.zip
#rm -rf /root/radiusplugin_v2.1a_beta1
#rm -rf /root/radiusplugin_v2.1a_beta1.tar.gz
#apache删除默认测试页
rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html
}
###############调用安装命令######################################################################
web_install
openvpn_install
delete_file
echo “+———————————————————————+”
echo “+ 运行启动命令: +”
echo “+ 启动Squid代理 +”
echo “+ 启动Apache2 :systemctl restart httpd.service +”
echo “+ 启动mysql :systemctl restart mysqld.service +”
echo “+ 启动radius :systemctl restart radiusd.service +”
echo “+ 启动firewalld: systemctl restart firewalld.service +”
echo “+———————————————————————+”
echo “*******启动Squid代理服务器*******”
service squid start
echo “开机启动Apache2”
systemctl enable httpd.service
echo “*******启动Apache2*******”
systemctl restart httpd.service
echo “*******开机启动mysql*******”
systemctl enable mysqld.service
echo “*******启动mysql*******”
systemctl restart mysqld.service
echo “*******开机启动radius*******”
systemctl enable radiusd.service
echo “*******启动radius*******”
systemctl restart radiusd.service
echo “*******启动openvpn*******”
systemctl enable openvpn@servic.service
#systemctl status openvpn@server.service
systemctl start openvpn@server.service
echo “*******开机启动firewalld*******”
systemctl enable firewalld.service
echo “*******启动firewalld*******”
systemctl restart firewalld.service