钧言极客钧言极客

不因何事去制作
只因兴趣而创造

CentOS7/8编译安装kangle和easypanel

knagle简介

kangle.png

kangle是一款免费、开源、国产的web服务器软件,可以跨平台使用,性能高、访问控制功能灵活强大。相对于宝塔、AMH等等一些面板软件,kangle具有无法比拟的优势。但是官方的推荐环境还停留在centOS6的时代,但是centos 6的维护周期马上到期,今天把宝塔环境换成了kangle,原因是服务器配置太低了,并发一高就宕机。下面来说一下CentOS7/8环境怎么安装kangle和easypanel。

安装kangle

安装编译依赖包

yum -y install wget tar make automake gcc gcc-c++ pcre pcre-devel zlib-devel sqlite-devel openssl-devel libxml2 libxml2-devel libtool libtool-libs quota perl gd

下载kangle编译源码包

wget http://download.kangleweb.com/devel.php?os=src

解压

tar xzf kangle-3.5.21.tar.gz

进入kangle目录

cd kangle-3.5.21

配置编译参数

./configure --prefix=/vhs/kangle --enable-disk-cache --enable-ipv6 --enable-ssl --enable-vh-limit

编译安装

make && make check && make install

启动kangle

/vhs/kangle/bin/kangle

设置kangle开机启动

进入cd /usr/lib/systemd/system目录新建kangle.service内容如下

[Unit]
Description=Kangle Web Service
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/vhs/kangle/bin/kangle
ExecStop=/vhs/kangle/bin/kangle -q
[Install]
WantedBy=multi-user.target

创建kangle软链接

ln -s '/usr/lib/systemd/system/kangle.service' '/etc/systemd/system/multi-user.target.wants/kangle.service'

启动kangle

# 启动kangle
systemctl start kangle.service

# 关闭kangle
systemctl stop kangle.service

# kangle设置为开机自动启动
systemctl enable kangle.service

安装Mariadb数据库

# 安装mariadb
yum install mariadb-server mariadb

# 启动mariadb服务
systemctl start mariadb.service

#设置mariadb开机自动运行
systemctl enable mariadb.service

设置ROOT密码

/usr/bin/mysql_secure_installation

然后根据提示操作即可

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 安装后默认没有root密码,直接回车
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password: 输入root的新密码
Re-enter new password: 新密码确认
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] 删除匿名用户 Y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] 关闭root远程登录 Y
 ... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] 删除test数据库 Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] 确定以上所有操作 Y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

设置软链接。Mariadb完全兼容Mysql,命令基本都一样。

ln -s /usr/bin/mysql /vhs/kangle/bin/mysql
ln -s /usr/bin/mysqldump /vhs/kangle/bin/mysqldump

安装PHP

yum install php php-cli php-mysql php-gd php-xml php-pdo php-mbsring

安装ioncube

ioncube官网下载:下载链接

# 下载ioncube
cd /usr/local
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar zxvf ioncube_loaders_lin_x86-64.tar.gz
cp /usr/local/ioncube_loaders_lin_x86-64/ioncube_loader_lin_5.4.so /usr/lib64/php/modules

# 在/etc/php.d目录下新建ioncube.ini文件。内容如下
zend_extension=/usr/lib64/php/modules/ioncube_loader_lin_5.4.so

安装pureftpd

# 下载pureftpd
wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.49.tar.gz
# 解压
tar xzf pure-ftpd-1.0.49.tar.gz
# 进入目录
cd pure-ftpd-1.0.49
# 配置编译参数
./configure --prefix=/vhs/pure-ftpd with --with-extauth --with-throttling --with-peruserlimits
# 编译安装
make && make check && make install

设置pureftpd启动服务

/vhs/pure-ftpd/sbin下新建pureftpd.sh,内容如下

#!/usr/bin/bash
/vhs/pure-ftpd/sbin/pure-authd --daemonize -s /var/run/ftpd.sock -r /vhs/kangle/bin/pureftp_auth
sleep 1
/vhs/pure-ftpd/sbin/pure-ftpd --daemonize -lextauth:/var/run/ftpd.sock

/usr/lib/systemd/system/下新建pureftpd.service,内容如下

[Unit]
Description=Pure-FTPd FTP Server
After=syslog.target
[Service]
Type=forking
ExecStart=/usr/bin/sh /vhs/pure-ftpd/sbin/pureftpd.sh
[Install]
WantedBy=multi-user.target

创建软链接

ln -s '/usr/lib/systemd/system/pureftpd.service' '/etc/systemd/system/multi-user.target.wants/pureftpd.service'

pureftpd命令

启动pureftpd
systemctl start pureftpd.service
关闭pureftpd
systemctl stop pureftpd.service)

安装easypanel

# 下载easypenel
wget http://download.kangleweb.com/easypanel/easypanel-2.6.26-x86_64-6.tar.gz
# 解压
tar xzf easypanel-2.6.26-x86_64-6.tar.gz
# 关闭kangle服务
/vhs/kangle/bin/kangle -q
# 复制文件
cp -a easypanel-2.6.26-x86_64/* /vhs/kangle/

装完后开始设置php

不用ep自带的php52,打开/vhs/kangle/ext/tpl_php52/config.xml找到<cmd name="nodephp" 行,修改为:

<cmd name='nodephp' file='/usr/bin/php-cgi' listen='local' lock='0' type='mp' proto='fastcgi'>
  <env PHP_FCGI_MAX_REQUESTS='0' PHPRC='/etc/php.ini'/>
  </cmd>

防火墙放行

如果是本地防火墙放行了,不能访问建议你去看一下你的服务提供商的防火墙是否放行。

systemctl start firewalld
firewall-cmd --add-port=22/tcp --permanent
firewall-cmd --add-service=ftp --permanent
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=443/tcp --permanent
firewall-cmd --add-port=3311/tcp --permanent
firewall-cmd --add-port=3312/tcp --permanent
firewall-cmd --add-port=3313/tcp --permanent
firewall-cmd --reload
systemctl restart firewalld
systemctl enable firewalld

启动kangle和pureftpd

systemctl start kangle.service
systemctl start pureftpd.service

关于BUG

使用yum安装的php5.4,会导致在线文件管理打开一片空白,其他页面正常,还在测试解决当中。

未经允许不得转载:钧言极客 » CentOS7/8编译安装kangle和easypanel

评论 抢沙发