宝塔面板安装使用常见问题收集
安装方法
使用 SSH 连接工具,如堡塔SSH终端连接到您的 Linux 服务器后,挂载磁盘,根据系统执行相应命令开始安装(大约2分钟完成面板安装):
Centos安装脚本
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
Ubuntu/Deepin安装脚本
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
Debian安装脚本
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
Fedora安装脚本
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
注意:必须为没装过其它环境如Apache/Nginx/php/MySQL的新系统,推荐使用centos 8.X的系统安装宝塔面板
安装要求:
- 内存:512M以上,推荐768M以上(纯面板约占系统60M内存)
- 硬盘:300M以上可用硬盘空间(纯面板约占20M磁盘空间)
- 系统:CentOS 7.1+ (Ubuntu16.04+.、Debian9.0+),确保是干净的操作系统,没有安装过其它环境带的Apache/Nginx/php/MySQL/pgsql/gitlab/java(已有环境不可安装)
- 架构:x86_64(主流服务器均是此架构),ARM不完整兼容(面板环境安装慢,部分软件可能安装不上)
宝塔Linux面板7.4.7版本是基于Centos开发的,为了最好的兼容性,请优先考虑使用Centos8.x系统
系统兼容性顺序:
Centos8.x > Centos7.x > Ubuntu18.04 > Debian10 > Ubuntu 20.04 > 其它系统
以下主机商必看(开端口教程,不开不能用):
腾讯云:https://www.bt.cn/bbs/thread-1229-1-1.html
阿里云:https://www.bt.cn/bbs/thread-2897-1-1.html
华为云:https://www.bt.cn/bbs/thread-3923-1-1.html
推荐先安装 堡塔SSH客户端 (免费/简单/中文/多屏)
Linux面板7.4.7安装命令:
使用SSH 连接工具(查看使用方法),挂载磁盘后(查看),根据系统执行框内命令开始安装(大约2分钟完成面板安装)
Centos安装命令:
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
试验性Centos/Ubuntu/Debian安装命令 独立运行环境(py3.7) 可能存在少量兼容性问题 不断优化中
curl -sSO http://download.bt.cn/install/install_panel.sh && bash install_panel.sh
Ubuntu/Deepin安装命令:
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
Debian安装命令:
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
Fedora安装命令:
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
去除强制绑定手机
sed -i "s|bind_user == 'True'|bind_user == 'XXXX'|" /www/server/panel/BTPanel/static/js/index.js
Linux面板7.4.7升级命令:
curl http://download.bt.cn/install/update6.sh|bash
以上节点无法使用的情况下,请使用下面的备用节点:
备用节点【江苏】:
yum install -y wget && wget -O install.sh http://180.101.160.68:5880/install/install_6.0.sh && sh install.sh
备用节点【香港】:
yum install -y wget && wget -O install.sh http://103.224.251.67:5880/install/install_6.0.sh && sh install.sh
备用节点【美国】:
yum install -y wget && wget -O install.sh http://128.1.164.196:5880/install/install_6.0.sh && sh install.sh
若点击更新后没生效,请尝试重启面板服务:
bt restart
面板特色功能:
- 一键配置服务器环境(LAMP/LNMP)
- 一键安全重启
- 一键创建管理网站、ftp、数据库
- 一键部署SSL证书
- 一键部署源码(discuz、wordpress、dedecms、z-blog、微擎等等)
- 一键配置(定期备份、数据导入、伪静态、301、SSL、子目录、反向代理、切换PHP版本)
- 一键安装常用PHP扩展(fileinfo、intl、opcache、imap、memcache、apc、redis、ioncube、imagick)
- 数据库一键导入导出
- 系统监控(CPU、内存、磁盘IO、网络IO)
- 防火墙端口放行
- SSH开启与关闭及SSH端口更改
- 禁PING开启或关闭
- 方便高效的文件管理器(上传、下载、压缩、解压、查看、编辑等等)
- 计划任务(定期备份、日志切割、shell脚本)
- 软件管理(一键安装、卸载、版本切换)
卸载宝塔面板
注:卸载环境可能会影响服务器数据 请谨慎操作!
1.进入ssh 输入以下命令下载脚本
wget http://download.bt.cn/install/bt-uninstall.sh
2.执行脚本 (若是ubutnu用户请在前面加sudo 例子sudo sh bt-uninstall.sh)
sh bt-uninstall.sh
3.根据提示输入1或2后按回车清理面板或环境 (若输入其他值或不输入直接回车则只卸载面板)
安装宝塔linux面板时出现错误的解决方法
1、如果安装时出现以下截图中的错误
一般都是yum源有问题,进入ssh 输入解决
yum clean all
如果还是不行 请更换yum源
2、安装后错误/usr/bin/bt: line 129: syntax error: unexpected end of file 解决办法
1.网络波动导致无法将宝塔文件写入到/etc/init.d/bt 这个系统文件
2.源文件缺失
下面是解决办法:
mv /etc/init.d/bt /tmp/bt_back
cp /www/server/panel/init.sh /etc/init.d/bt && chmod +x /etc/init.d/bt
/etc/init.d/bt restart
或者复制下面的代码后使用命令vim /etc/init.d/bt
粘贴下面代码:
#!/bin/bash
# chkconfig: 2345 55 25
# description: bt Cloud Service
### BEGIN INIT INFO
# Provides: bt
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts bt
# Description: starts the bt
### END INIT INFO
panel_init(){
panel_path=/www/server/panel
pidfile=$panel_path/logs/panel.pid
cd $panel_path
env_path=$panel_path/pyenv/bin/activate
if [ -f $env_path ];then
source $env_path
pythonV=$panel_path/pyenv/bin/python
chmod -R 700 $panel_path/pyenv/bin
else
pythonV=/usr/bin/python
fi
reg="^#\!$pythonV\$"
is_sed=$(cat $panel_path/BT-Panel|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Panel
fi
is_sed=$(cat $panel_path/BT-Task|head -n 1|grep -E $reg)
if [ "${is_sed}" = "" ];then
sed -i "s@^#!.*@#!$pythonV@" $panel_path/BT-Task
fi
chmod 700 $panel_path/BT-Panel
chmod 700 $panel_path/BT-Task
log_file=$panel_path/logs/error.log
task_log_file=$panel_path/logs/task.log
if [ -f $panel_path/data/ssl.pl ];then
log_file=/dev/null
fi
port=$(cat $panel_path/data/port.pl)
}
panel_init
get_panel_pids(){
isStart=$(ps aux|grep -E '(runserver|BT-Panel)'|grep -v grep|awk '{print $2}'|xargs)
pids=$isStart
arr=$isStart
}
get_task_pids(){
isStart=$(ps aux|grep -E '(task.py|BT-Task)'|grep -v grep|awk '{print $2}'|xargs)
pids=$isStart
arr=$isStart
}
panel_start()
{
isStart=`ps aux|grep 'runserver:app'|grep -v grep|awk '{print $2}'`
if [ "$isStart" != '' ];then
kill -9 $isStart
fi
get_panel_pids
if [ "$isStart" == '' ];then
rm -f $pidfile
panel_port_check
echo -e "Starting Bt-Panel...\c"
nohup $panel_path/BT-Panel >> $log_file 2>&1 &
isStart=""
n=0
while [[ "$isStart" == "" ]];
do
echo -e ".\c"
sleep 0.5
get_panel_pids
let n+=1
if [ $n -gt 8 ];then
break;
fi
done
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $log_file
echo '------------------------------------------------------'
echo -e "\033[31mError: BT-Panel service startup failed.\033[0m"
fi
echo -e " \033[32mdone\033[0m"
else
echo "Starting Bt-Panel... Bt-Panel (pid $(echo $isStart)) already running"
fi
get_task_pids
if [ "$isStart" == '' ];then
echo -e "Starting Bt-Tasks... \c"
nohup $panel_path/BT-Task >> $task_log_file 2>&1 &
sleep 0.2
get_task_pids
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $task_log_file
echo '------------------------------------------------------'
echo -e "\033[31mError: BT-Task service startup failed.\033[0m"
return;
fi
echo -e " \033[32mdone\033[0m"
else
echo "Starting Bt-Tasks... Bt-Tasks (pid $isStart) already running"
fi
}
panel_port_check()
{
is_process=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $1}'|sort|uniq|xargs)
for pn in ${is_process[@]}
do
if [ "$pn" = "nginx" ];then
/etc/init.d/nginx restart
fi
if [ "$pn" = "httpd" ];then
/etc/init.d/httpd restart
fi
if [ "$pn" = "mysqld" ];then
/etc/init.d/mysqld restart
fi
if [ "$pn" = "superviso" ];then
pkill -9 superviso
sleep 0.2
supervisord -c /etc/supervisor/supervisord.conf
fi
if [ "$pn" = "pure-ftpd" ];then
/etc/init.d/pure-ftpd restart
fi
if [ "$pn" = "memcached" ];then
/etc/init.d/memcached restart
fi
if [ "$pn" = "sudo" ];then
if [ -f /etc/init.d/redis ];then
/etc/init.d/redis restart
fi
fi
if [ "$pn" = "php-fpm" ];then
php_v=(52 53 54 55 56 70 71 72 73 74);
for pv in ${php_v[@]};
do
if [ -f /etc/init.d/php-fpm-${pv} ];then
if [ -f /www/server/php/%{pv}/sbin/php-fpm ];then
if [ -f /tmp/php-cgi-${pv}.sock ];then
/etc/init.d/php-fpm-${pv} start
fi
/etc/init.d/php-fpm-${pv} restart
fi
fi
done
fi
done
is_ports=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
if [ "$is_ports" != '' ];then
kill -9 $is_ports
sleep 1
fi
}
panel_stop()
{
echo -e "Stopping Bt-Tasks...\c";
get_task_pids
arr=($pids)
for p in ${arr[@]}
do
kill -9 $p
done
echo -e " \033[32mdone\033[0m"
echo -e "Stopping Bt-Panel...\c";
get_panel_pids
for p in ${arr[@]}
do
kill -9 $p &>/dev/null
done
if [ -f $pidfile ];then
rm -f $pidfile
fi
echo -e " \033[32mdone\033[0m"
}
panel_status()
{
port=$(cat $panel_path/data/port.pl)
get_panel_pids
if [ "$isStart" != '' ];then
echo -e "\033[32mBt-Panel (pid $(echo $isStart)) already running\033[0m"
else
echo -e "\033[31mBt-Panel not running\033[0m"
fi
get_task_pids
if [ "$isStart" != '' ];then
echo -e "\033[32mBt-Task (pid $isStart) already running\033[0m"
else
echo -e "\033[31mBt-Task not running\033[0m"
fi
}
panel_reload()
{
isStart=$(ps aux|grep 'runserver:app'|grep -v grep|awk '{print $2}')
if [ "$isStart" != '' ];then
kill -9 $isStart
sleep 0.5
fi
get_panel_pids
if [ "$isStart" != '' ];then
get_panel_pids
for p in ${arr[@]}
do
kill -9 $p
done
rm -f $pidfile
panel_port_check
echo -e "Reload Bt-Panel.\c";
nohup $panel_path/BT-Panel >> $log_file 2>&1 &
isStart=""
n=0
while [[ "$isStart" == "" ]];
do
echo -e ".\c"
sleep 0.5
get_panel_pids
let n+=1
if [ $n -gt 8 ];then
break;
fi
done
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $log_file
echo '------------------------------------------------------'
echo -e "\033[31mError: BT-Panel service startup failed.\033[0m"
return;
fi
echo -e " \033[32mdone\033[0m"
else
echo -e "\033[31mBt-Panel not running\033[0m"
panel_start
fi
}
install_used()
{
if [ ! -f $panel_path/aliyun.pl ];then
return;
fi
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 12)
username=$($pythonV $panel_path/tools.py panel $password)
echo "$password" > $panel_path/default.pl
rm -f $panel_path/aliyun.pl
}
error_logs()
{
tail -n 100 $log_file
}
case "$1" in
'start')
install_used
panel_start
;;
'stop')
panel_stop
;;
'restart')
panel_stop
sleep 1
panel_start
;;
'reload')
panel_reload
;;
'status')
panel_status
;;
'logs')
error_logs
;;
'panel')
$pythonV $panel_path/tools.py cli $2
;;
'default')
port=$(cat $panel_path/data/port.pl)
password=$(cat $panel_path/default.pl)
if [ -f $panel_path/data/domain.conf ];then
address=$(cat $panel_path/data/domain.conf)
fi
if [ -f $panel_path/data/admin_path.pl ];then
auth_path=$(cat $panel_path/data/admin_path.pl)
fi
if [ "$address" = "" ];then
address=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
fi
pool=http
if [ -f $panel_path/data/ssl.pl ];then
pool=https
fi
echo -e "=================================================================="
echo -e "\033[32mBT-Panel default info!\033[0m"
echo -e "=================================================================="
echo "Bt-Panel-URL: $pool://$address:$port$auth_path"
echo -e `$pythonV $panel_path/tools.py username`
echo -e "password: $password"
echo -e "\033[33mWarning:\033[0m"
echo -e "\033[33mIf you cannot access the panel, \033[0m"
echo -e "\033[33mrelease the following port (8888|888|80|443|20|21) in the security group\033[0m"
echo -e "=================================================================="
;;
*)
$pythonV $panel_path/tools.py cli $1
;;
esac
然后按ESC输入:wq
宝塔一键迁移API版本 3.0版本教程
本文最后更新于2021年05月26日15时18分15秒,已超过355天没有更新,若内容或图片失效,请留言反馈
本文链接:https://love2wind.cn/archives/2174.html(转载时请注明本文出处及文章链接)
作品采用:《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
发表评论

涅槃博客
Love2wind's blog
今日诗词
热门文章
## iframe嵌入BiliBili视频方法B站....
## 前言 前面我们给大家介绍了怎么申请甲骨....
![Snipaste_2021-02-01_12-....
![](https://images.weserv....
binge Lv.1
1月9日
运行一遍脚本测试一下 python3 oracle_arm.py main.tf
测试正常,测试怎么一直运行,怎么停?