由于工作环境需要部分童鞋需要在内网尝试安装宝塔环境,本文中讲到的基本是在外网把相关插件安装完毕后转移到内网机器上(本文用到Apache 2.4.46、MySQL 5.6)
----------------------------------------------安装----------------------------------------------
需要用到python与BtSoft及相关插件,思路很简单,备份所需注册表及服务最后导入内网。
一到四步安装面板,五为安装插件。


第一步

解压拷贝(在外网机压缩拷贝过来,路径分别是C:\Program Files\python 及D:\BtSoft):
解压python(这玩意也分32跟64,64的放到32机子上启动面板会出现错误)到C盘Program Files下
解压BtSoft到D盘根目录下(你也可以换其他目录不过后续的环境变量啥的路径也要跟着变)

第二步

设置环境变量(我的电脑右键属性----高级系统设置----环境变量):

win10找到Path添加

D:\BtSoft\panel\script
C:\Program Files\python
C:\Program Files\python\Scripts

(win7用这个D:\BtSoft\panel\script;C:\Program Files\python;C:\Program Files\python\Scripts )

添加单独系统变量

变量名            变量值
BT_PANEL      D:\BtSoft\panel
BT_PYTHON     C:\Program Files\python
BT_SETUP      D:\BtSoft
UNRAR_LIB_PATH     C:\Program Files\python\Lib\site-packages\unrar\UnRAR.dll

第三步

在注册表中添加两个面板服务、如果安装位置不同要修改里面的路径;
btPanel服务
btTask服务

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

(两个注册表在外网机注册表导出 也可用我的bat,双击btPanel服务.reg与btTask服务.reg文件即可,代码如下)
btPanel服务(新建一个tet文本拷进去改个reg运行即可):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\btPanel]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,\
  6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,5c,00,70,00,79,00,74,00,68,00,6f,\
  00,6e,00,5c,00,6c,00,69,00,62,00,5c,00,73,00,69,00,74,00,65,00,2d,00,70,00,\
  61,00,63,00,6b,00,61,00,67,00,65,00,73,00,5c,00,77,00,69,00,6e,00,33,00,32,\
  00,5c,00,50,00,79,00,74,00,68,00,6f,00,6e,00,53,00,65,00,72,00,76,00,69,00,\
  63,00,65,00,2e,00,65,00,78,00,65,00,22,00,00,00
"DisplayName"="btPanel"
"ObjectName"="LocalSystem"
"Description"="用于运行宝塔Windows面板主程序,停止后面板将无法访问."
"DelayedAutostart"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\btPanel\PythonClass]
@="D:\\BtSoft\\panel\\runserver.btService"


btTask服务(新建一个tet文本拷进去改个reg运行即可)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\btTask]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,\
  6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,5c,00,70,00,79,00,74,00,68,00,6f,\
  00,6e,00,5c,00,6c,00,69,00,62,00,5c,00,73,00,69,00,74,00,65,00,2d,00,70,00,\
  61,00,63,00,6b,00,61,00,67,00,65,00,73,00,5c,00,77,00,69,00,6e,00,33,00,32,\
  00,5c,00,50,00,79,00,74,00,68,00,6f,00,6e,00,53,00,65,00,72,00,76,00,69,00,\
  63,00,65,00,2e,00,65,00,78,00,65,00,22,00,00,00
"DisplayName"="btTask"
"ObjectName"="LocalSystem"
"Description"="用于运行宝塔Windows面板安装,计划任务等队列程序,停止后软件安装,计划任务等将无法执行."
"DelayedAutostart"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\btTask\PythonClass]
@="D:\\BtSoft\\panel\\task.taskService"


第四步

服务和程序中添加两个服务用于开机自启动:

添加方法:使用bat(指令说明:管理员运行CMD–添加服务为:sc create、删除服务和程序中的服务为:sc delete 服务名),bat内容如下:

新建一个tet文本拷进去改个bat后缀管理员运行即可
sc create btPanel binpath= "C:\Program Files\python\lib\site-packages\win32\PythonService.exe" start= auto displayname= "btPanel"
sc create btTask binpath= "C:\Program Files\python\lib\site-packages\win32\PythonService.exe" start= auto displayname= "btTask"

第五步

安装插件(需要用到注册表与服务的插件(具体是哪些自己观察咯)、需要导出注册表与新增服务)
拷贝安装好的插件文件夹到相应的位置(如果是配置好的直接丢到相应目录,如果是从temp里搞出来的需要搞好相关配置),光丢进去还不行(有些直接丢就完事了,有些还的添加服务到服务和应用里面跟上面一样)
下面示例几个常用的:
第一个:apache


添加服务(新建一个tet文本拷进去改个bat后缀管理员运行即可)
sc create apache binpath= "D:\BtSoft\apache\bin\httpd.exe" start= auto displayname= "apache"

添加注册表(新建一个tet文本拷进去改个reg运行即可)
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\apache]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,44,00,3a,00,5c,00,42,00,74,00,53,00,6f,00,66,00,74,00,\
  5c,00,61,00,70,00,61,00,63,00,68,00,65,00,5c,00,62,00,69,00,6e,00,5c,00,68,\
  00,74,00,74,00,70,00,64,00,2e,00,65,00,78,00,65,00,22,00,20,00,2d,00,6b,00,\
  20,00,72,00,75,00,6e,00,73,00,65,00,72,00,76,00,69,00,63,00,65,00,00,00
"DisplayName"="apache"
"ObjectName"="LocalSystem"
"Description"="Apache/2.4.46 (Win32) OpenSSL/1.1.1g mod_fcgid/2.3.9a"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\apache\PythonClass]
@="apache"

第二个:mysql ----数据库

添加服务(新建一个tet文本拷进去改个bat后缀管理员运行即可)
sc create mysql binpath= "D:\BtSoft\mysql\MySQL5.6\bin\mysqld.exe" start= auto displayname= "mysql"

添加注册表(新建一个tet文本拷进去改个reg运行即可)
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\mysql]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,44,00,3a,00,5c,00,42,00,74,00,53,00,6f,00,66,00,74,00,\
  5c,00,6d,00,79,00,73,00,71,00,6c,00,5c,00,4d,00,79,00,53,00,51,00,4c,00,35,\
  00,2e,00,36,00,5c,00,62,00,69,00,6e,00,5c,00,6d,00,79,00,73,00,71,00,6c,00,\
  64,00,2e,00,65,00,78,00,65,00,22,00,20,00,2d,00,2d,00,64,00,65,00,66,00,61,\
  00,75,00,6c,00,74,00,73,00,2d,00,66,00,69,00,6c,00,65,00,3d,00,44,00,3a,00,\
  5c,00,42,00,74,00,53,00,6f,00,66,00,74,00,5c,00,6d,00,79,00,73,00,71,00,6c,\
  00,5c,00,4d,00,79,00,53,00,51,00,4c,00,35,00,2e,00,36,00,5c,00,6d,00,79,00,\
  2e,00,69,00,6e,00,69,00,20,00,4d,00,79,00,53,00,51,00,4c,00,00,00
"DisplayName"="mysql"
"ObjectName"="LocalSystem"
"Description"="MySQL数据库服务"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\mysql\PythonClass]
@="mysql"


第三个:FileZilla Server ----FileZilla是一个免费开源的FTP软件

添加服务(新建一个tet文本拷进去改个bat后缀管理员运行即可)
sc create FileZilla Server binpath= "D:\BtSoft\ftpServer\FileZilla_Server.exe"  start= auto displayname= "FileZilla Server"

添加注册表(新建一个tet文本拷进去改个reg运行即可)
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\FileZilla Server]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):22,00,44,00,3a,00,5c,00,42,00,74,00,53,00,6f,00,66,00,74,00,\
  5c,00,66,00,74,00,70,00,53,00,65,00,72,00,76,00,65,00,72,00,5c,00,46,00,69,\
  00,6c,00,65,00,5a,00,69,00,6c,00,6c,00,61,00,5f,00,53,00,65,00,72,00,76,00,\
  65,00,72,00,2e,00,65,00,78,00,65,00,22,00,20,00,00,00
"DisplayName"="FileZilla Server"
"ObjectName"="LocalSystem"
"Description"="FileZilla是一个免费开源的FTP软件,分为客户端版本和服务器版本,具备所有的FTP软件功能"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\FileZilla Server\PythonClass]
@="FileZilla Server"


注意事项
修改数据库密码就在宝塔数据库选项卡里root密码
Apache在网页启动时可能出现假死现象,点玩启动就不管,直接看网页能不能打开就完事,停用面板他也就跟着停止了,估计是我漏了哪个细节了(直接在服务里启动不了,后期我在看看)
本身自己就是小白从事 合同工的工作,为了生活不枯燥加上工作方便学习编程,写的可能质量很差,尽量写的详细给各位自学的童鞋


09-09 22:24