Kangle-EasyPanel一键快速安装脚本

发布于 2017-04-26  186 次阅读


    更新时间:
    2017年11月13日

    最低配置安装需求
    本教程至少需要以下配置进行安装
    CPU:单核
    内存:256M(推荐1G及以上)
    硬盘:5G或者以上
    网络:独立公网IP
    操作系统:centos 6 x64
    安装时间:普通VPS大约在2-5分钟左右

    默认登录密码是什么?
    easypanel控制面板管理员后台:ip:3312/admin
    帐号:admin
    密码:kangle
    mysql数据库管理员后台:ip:3313/mysql
    帐号:root
    密码:空
    想要用mysql的话,一定要先进去3312/admin登录,左边有个服务器设置,把数据库帐号密码填入,并且初始化服务器后即可正常登录mysql使用。

    以下安装教程带的为mysql官方5.6最新版同步更新。内存占用已经优化到70M左右。

SSH:

yum -y install wget
echo "timeout=120" >> /etc/yum.conf
yum -y update
yum -y install epel-release
rm -rf /etc/yum.repos.d/CentOS-Base.repo
wget http://github.itzmx.com/1265578519/mirrors/master/CentOS/CentOS6-Base-itzmx.repo -O /etc/yum.repos.d/CentOS6-Base-itzmx.repo
rm -rf /etc/yum.repos.d/epel.repo
rm -rf /etc/yum.repos.d/epel-testing.repo
wget http://github.itzmx.com/1265578519/mirrors/master/EPEL/epel.repo -O /etc/yum.repos.d/epel.repo
wget http://github.itzmx.com/1265578519/mirrors/master/EPEL/epel-testing.repo -O /etc/yum.repos.d/epel-testing.repo
rpm -ivh http://github.itzmx.com/1265578519/repo/master/CentOS/mysql-community-release-el6-5.noarch.rpm
rm -rf /etc/yum.repos.d/mysql-community.repo
rm -rf /etc/yum.repos.d/mysql-community-source.repo
wget http://github.itzmx.com/1265578519/repo/master/CentOS/mysql-community.repo -O /etc/yum.repos.d/mysql-community.repo
wget http://github.itzmx.com/1265578519/repo/master/CentOS/mysql-community-source.repo -O /etc/yum.repos.d/mysql-community-source.repo
yum -y install which file wget make automake gcc gcc-c++ pcre-devel zlib-devel openssl-devel sqlite-devel quota unzip bzip2
ulimit -n 1048576
echo "* soft nofile 1048576" >> /etc/security/limits.conf
echo "* hard nofile 1048576" >> /etc/security/limits.conf
wget http://github.itzmx.com/1265578519/kangle/master/ent/e.sh -O e.sh;sh e.sh /vhs/kangle
wget http://github.itzmx.com/1265578519/kangle/master/kangle/easypanel/ep.sh -O ep.sh;sh ep.sh
rm -rf /vhs/kangle/ext/tpl_php52/php-templete.ini
wget http://github.itzmx.com/1265578519/kangle/master/easypanel/php-templete.ini -O /vhs/kangle/ext/tpl_php52/php-templete.ini
rm -rf /vhs/kangle/ext/tpl_php52/etc/php-node.ini
wget http://github.itzmx.com/1265578519/kangle/master/easypanel/php-node.ini -O /vhs/kangle/ext/tpl_php52/etc/php-node.ini
wget http://github.itzmx.com/1265578519/transmission/master/2.84/libevent-2.0.21-stable.tar.gz
tar zxf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make -s -j 4
make -s install
ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
ln -s /usr/local/lib/libevent-2.0.so.5.1.9 /usr/lib/libevent-2.0.so.5.1.9
ln -s /usr/lib/libevent-2.0.so.5 /usr/local/lib/libevent-2.0.so.5
ln -s /usr/lib/libevent-2.0.so.5.1.9 /usr/local/lib/libevent-2.0.so.5.1.9
cd ..
yum -y install memcached php-pecl-memcache
yum -y install php-pecl-apc
rm -rf /etc/sysconfig/memcached
wget http://github.itzmx.com/1265578519/kangle/master/memcached/memcached -O /etc/sysconfig/memcached
service memcached start
chkconfig --level 2345 memcached on
echo "127.0.0.1 download.safedog.cn" >> /etc/hosts
setenforce 0
wget http://github.itzmx.com/1265578519/safedog/master/2.4/safedog_linux64.tar.gz
tar xzf safedog_linux64.tar.gz
cd safedog_linux64
chmod -R 777 install.py
./install.py
sdcmd webflag 0
sdcmd twreuse 1
sdcmd sshddenyflag 1
cd ..
yum -y install mysql mysql-server
rm -rf /etc/my.cnf
wget http://github.itzmx.com/1265578519/kangle/master/mysql/5.6/my.cnf -O /etc/my.cnf
service mysqld restart

 

如果你完全不需要数据库运行,比如说单独跑CDN反向代理,怕mysql占内存可以卸载

yum -y remove mysql mysql*
rm -rf /var/lib/mysql/*
yum -y install mysql-libs

 

安装后通过访问进入后台设置,默认用户名admin,密码kangle,mysql数据库用户名root,密码空,初始化后点击左边的mysql管理进行修改root密码,修改后记得去服务器设置填写新密码

http://ip:3312/admin

DDOS Firewall后台通过输入如下访问,具体参数设置不举例,可以防1G内小流量DDOS攻击和常见CC攻击,不过还是建议使用完美无误封的kangle商业版

sdui

使用说明:
切换DDOS Firewall语言包图形界面显示
F5
查看DDOS Firewall服务
service safedog status
启动DDOS Firewall服务
service safedog start
停止DDOS Firewall服务
service safedog stop
重启DDOS Firewall服务
sdstart

 

建议使用的系统计划任务
执行进入计划任务编辑
crontab -e
添加条目,打开系统定期自动更新
45 * * * * /usr/bin/yum -y update

每日自动删除服务器日志(看你硬盘是否够大,自行判断需求是否删除日志)
45 * * * * /bin/rm -rf /vhs/kangle/var/*

每日删除PHP的缓存文件(看你硬盘是否够大,自行判断需求是否删除缓存)
45 * * * * /bin/rm -rf /tmp/sess*

增加mysql守护进程,解决数据库进程闪退,内存不足自动退出
* * * * * /etc/init.d/mysqld start