使用 SSH 连接工具,如 堡塔SSH终端连接到您的 Linux 服务器后, 挂载磁盘,根据系统执行相应命令开始安装(大约2分钟完成面板安装):
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
注意:必须为没装过其它环境如Apache/Nginx/php/MySQL的新系统,推荐使用centos 8.X的系统安装宝塔面板
宝塔Linux面板7.4.7版本是基于Centos开发的,为了最好的兼容性,请优先考虑使用Centos8.x系统
系统兼容性顺序:
Centos8.x > Centos7.x > Ubuntu18.04 > Debian10 > Ubuntu 20.04 > 其它系统
提示:Centos官方已宣布在2020年停止对Centos6的维护更新,各大软件开发商也逐渐停止对Centos6的兼容,新服务器不建议使用Centos6
以下主机商必看(开端口教程,不开不能用):
腾讯云: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客户端 (免费/简单/中文/多屏)
使用SSH 连接工具(查看使用方法),挂载磁盘后(查看),根据系统执行框内命令开始安装(大约2分钟完成面板安装)
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
curl -sSO http://download.bt.cn/install/install_panel.sh && bash install_panel.sh
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
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
注:卸载环境可能会影响服务器数据 请谨慎操作!
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后按回车清理面板或环境 (若输入其他值或不输入直接回车则只卸载面板)
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
https://www.bt.cn/bbs/thread-42566-1-1.html
.shang_content { width:80%; margin:40px auto 10px auto; text-align:center; text-indent: 0; } } .hide_box { z-index:999; filter:alpha(opacity=50); background:#666; opacity:0.5; -moz-opacity:0.5; left:0; top:0; height:99%; width:100%; position:fixed; display:none; } .shang_box { color:#fff; width:800px; height:550px; padding:10px; background-color:#d8d7d7; border-radius:10px; position:fixed; z-index:1000; left:40%; top:45%; margin-left:-280px; margin-top:-280px; border: 2px solid #dc5f06; display:none; } .shang_box img { border:none; border-width:0; display: initial;} .dashang { display:block; width:100px; margin:10px auto; height:auto; padding:10px 18px; text-align:center; text-decoration:none; font-size:16px; transition:all 0.3s; font-weight:400; outline:0!important; color:#fff!important; background-color:#f05050; border-color:#f05050; border-radius:30px; margin-bottom:20px; text-indent: 0; } .shang_close { float:right; display:inline-block; } .shang_logo { display:block; text-align:center; margin:20px auto; } .shang_tit { width:100%; color:#000000; margin:10px auto 30px auto; } .shang_tit p { color:#000; text-align:center; font-size:18px; font-weight:900; text-indent: 0; } .shang_payimg { width:640px; text-align:center; margin:10px auto; border-radius:3px; height:365px; } .pay_explain { text-align:center; margin:10px auto 25px auto; font-size:14px; color:#333; } .radiobox { width:16px; height:16px; background:url('https://love2wind.cn/usr/themes/spzac/img/shang/radio2.jpg'); display:block; float:left; margin-top:5px; margin-right:14px; } .checked .radiobox { background:url('https://love2wind.cn/usr/themes/spzac/img/shang/radio1.jpg'); } .shang_payselect { text-align:center; margin:0 auto; margin-top:40px; cursor:pointer; height:60px; width:320px; } .shang_payselect .pay_item { display:inline-block; margin-right:10px; float:left; } .shang_info { clear:both; text-indent: 0; } .shang_info p,.shang_info a { color:#ff0000; text-align:center; font-size:16px; text-decoration:none; line-height:0em; text-indent: 0; }
赞 赏
如果觉得我的文章对你有用,请随意赞赏
感谢您的支持,我会继续努力的!