How To Install BT VPS Control Panel And Restore WordPress Website Into It

BT(宝塔) is a VPS control panel application, it can help you to operate and maintain a VPS server and website, it is developed by china company. It is similar to CPanel and ISPConfig etc. But it is very easy to use than them. It is free. This article will tell you how to install it, and how to use it to transfer a WordPress website into it.

1. Install BT VPS Control Panel In Linux.

  1. First, you should get a VPS server, or you can install it on your local machine.
  2. Install a Linux os on the server, the most compatible Linux version is CentOS7.
  3. SSH to the Linux server in a terminal. Then run the install script to install it. You can get a detailed install script and instructions on this page. Below is the ubuntu install script. Others are similar.
    wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
  4. After you run the BT install script in the ssh terminal, it will show you the below information at the end.
    ==================================================================
    Congratulations! Installed successfully!
    ==================================================================
    Bt-Panel: http://123.211.13.128:8888/c1018989
    username: ui89huhj
    password: i8fdsff8
    Warning:
    If you cannot access the panel, 
    release the following port (8888|888|80|443|20|21) in the security group
    ==================================================================
  5. If you do not save the above BT panel information, you can get it later from your Linux server. Just log in to the Linux server, run the command sudo su to change to the root user, then run the command bt to list all the bt panel command lines, then input number 14 to get the above information. If you forget the bt panel username and password or the username and password do not take effect, you can input number 5 to reset the password.
    # bt
    ===============宝塔面板命令行==================
    (1) 重启面板服务           (8) 改面板端口
    (2) 停止面板服务           (9) 清除面板缓存
    (3) 启动面板服务           (10) 清除登录限制
    (4) 重载面板服务
    (5) 修改面板密码           (12) 取消域名绑定限制
    (6) 修改面板用户名         (13) 取消IP访问限制
    (7) 强制修改MySQL密码      (14) 查看面板默认信息
    (22) 显示面板错误日志      (15) 清理系统垃圾
    (23) 关闭BasicAuth认证     (16) 修复面板(检查错误并更新面板文件到最新版)
    (24) 关闭动态口令认证          (17) 设置日志切割是否压缩
    (25) 设置是否保存文件历史副本  (18) 设置是否自动备份面板
    (0) 取消                   (29) 取消访问设备验证
    ===============================================
    请输入命令编号:
    
  6. The URL is just the BT admin control panel URL. It includes a unique id at the end of the URL. And it tells you to open some port number in your security group( if your VPS server sits inside a firewall such as an amazon AWS’s security group, google’s firewall ). Because the BT admin control panel will use these port numbers to process the user requests.
  7. 8888 port number is the BT panel default web admin port number, you should change it after your first login. To change this port number and username and password, you should log in to the BT control panel, then click dashboard settings ( 面板设置 ) menu item on the left side, then you can change them on the right panel(面板端口).
  8. 888 port number is used by phpMyAdmin( a MySQL management tool ). To change phpMyAdmin port number, you should first click the 软件商店 menu item on the BT admin panel left navigator pane, then click the phpMyAdmin link in the software list, then it will popup the phpmyadmin管理 window, click the 安全设置 menu item on the left side of the popup window, then you can change the 访问端口 on the right side.
  9. 80 port number is used by the website by default.
  10. 443 port number is used by HTTPS TLS.
  11. 20 port number is used by FTP to transfer data.
  12. 21 port number is used by FTP to make connections.
  13. On Ubuntu, you can run the command ufw status to list all the opened port numbers.
    # ufw status
    Status: active
    
    To                         Action      From
    --                         ------      ----
    23/tcp                     ALLOW       Anywhere                  
    29/tcp                     ALLOW       Anywhere                  
    66/tcp                     ALLOW       Anywhere                  
    80/tcp                     ALLOW       Anywhere                  
    899/tcp                    ALLOW       Anywhere                  
    9898/tcp                   ALLOW       Anywhere
  14. If the ufw service is not activated, you can run the command ufw enable to activate it.

2. Install Linux Software In BT Admin Web Panel.

  1. Login to the BT Linux control panel with the above URL ( such as http://123.211.13.128:8888/c1018989 ) use the username and password.
  2. If this is your first-time login, it will popup a dialog to let you select one recommended application to install, I choose LNMP on left. You had better check the compile installation ( 编译安装checkbox, then click the green button ( 一键安装 ). After that, the selected Nginx, MySQL, FTP Server, PHP, and phpMyAdmin software will be installed in the Linux server automatically. You should select the software version carefully that can support your WordPress and all the used plugins version ( You had better do not select the newest software version, because the newest version is not stable and not be used by so many websites, so I select MySQL 5.7, and PHP 7.4 and phpMyAdmin 4.7 ).
  3. If you want to show the installed software on the panel home page. You can click Software Shop ( 软件商店 ) menu in the left panel, then it will list all the software that can be installed in the right panel. Click the green installed ( 已安装 ) button in the right panel top area, it will list all the software that has been installed.
  4. At the end of each installed software, there is a toggle button in column 首页显示, toggle this button will decide whether display this software on the home page or not.
  5. You can also search and install other software which you need in this software shop.

3. Add Website.

  1. Click the WebSite ( 网站 ) menu in the left panel.
  2. Click Add WebSite ( 添加站点 ) button in the right panel to add a new website.
  3. You can input multiple domain names, one domain one line ( please note domain1.com and www.domain1.com are different domain names, you should add them all to make both domain names can reach your website ). You should select a related PHP version. Do not create the database. Then click the 提交 button.
  4. Now you can see the newly added website on the website list page.
  5. Click the root folder ( 根目录 ) in the website line, it will open the website root folder.
  6. Download the WordPress backup file, then click 上传 button to upload the backup file to the above website root folder.
  7. At the end of the WordPress backup file, click the 解压 link to unzip it. You can refer article How To Restore WordPress Website From Backup to learn more about WordPress backup and how to transfer those backup files.

4. Create WebSite MySQL Database And Import Exist WordPress Database Data.

  1. After you unzip the above WordPress backup file, you will find a .sql ( for example abc_xyz.sql ) file in the root folder.
  2. Open this .sql file, you will find the database name in the top text lines.
    ......
    -- Database Name: abc_xyz
    ......
  3. Open file wp-config.php in the above unzip root folder. You can find the database nameusername, and password in below source code.
    // ** MySQL settings ** //
    /** The name of the database for WordPress */
    define( 'DB_NAME', 'abc_xyz' );
    
    /** MySQL database username */
    define( 'DB_USER', 'test' );
    
    /** MySQL database password */
    define( 'DB_PASSWORD', '12345678' );
    
  4. Click the 数据库 menu in the left panel. Then click the 添加数据库 green button in the right database list panel.
  5. Input database name, username, and password in the popup dialog. Click the 提交 button to create it.
  6. After creating the MySQL database, you can find the database on the database list page.
  7. Click the 导入 link in the 备份 column of one database line, then it will popup a dialog that let you upload your SQL file. If your SQL file is too big, you can upload the big SQL file to the server use FTP, you can see a detailed explanation in the popup dialog.
  8. After import the database, you can now manage the database.

5. Manage The MySQL Database Table Data.

5.1 Get MySQL Database Root User Password.

  1. Check the checkbox at the beginning of the MySQL database line, then click root密码 button at the database list page top area, it will pop up a dialog that contains the root user password, remember the password or you can change it to your own password.
  2. Now click 管理 link at the end of the database line, then it will popup phpMyAdmin login page in a new tab. Log in to phpMyAdmin with root user and password, otherwise, you can not find the User accounts tab in phpMyadmin. If you have not installed phpMyAdmin, it will tell you to install it first. If you find the phpMyAdmin page can not be opened, you should make sure port 888 has been allowed by your VPS firewall.

5.2 Create Your WordPress User Account.

  1. Click the User accounts tab at the top of the phpMyAdmin admin web page. If you can not see the User accounts tab, click the Server:localhost link at the top left corner of the phpMyAdmin admin web page. If you still can not find the User accouts tab, first you should make sure you login with a root user account, or you can close the phpMyAdmin page, and reopen the phpMyAdmin page again, then you can find the User accounts tab.
  2. You can find the WordPress used MySql database user account in the list. If you do not find it, you can click Add user account link on the web page bottom left to add your user account.
  3. Edit the user account privileges, assign all privileges ( except  ) to user@localhost and [email protected].

5.3 Verify WordPress WebSite Database Data.

  1. Click your WordPress website database name in the phpMyAdmin left panel.
  2. Then it will list all database tables. Click the table with _options suffix. Then you can verify below two row’s data values siteurl, and home.

6. Set WebSite Pseudo-Static For WordPress To Avoid 404 Error When Browse WordPress Article.

Now your WordPress website has been set up and restored use BT(宝塔) Linux control panel. But if you browse your post, you will get a 404 error. But the website home page and admin page can be accessed. This is because you do not set the Pseudo-Static for your WordPress. Below are the steps about how to set it.

  1. Click the 网站 menu in the left panel to go to web site list page.
  2. Click website name on the website list to popup the 站点修改 window, then click Pseudo-Static ( 伪静态 ) menu item in the popup window left panel, then select wordpress in right panel drop-down list, then click save ( 保存 ) button.
  3. Now you can access your website article correctly. If the article page still returns 404, you can log in to the WordPress admin site, then click the Save Changes button in Settings —> Permalinks page.

7. Enable SSL To The WordPress Website.

Now your WordPress website is ready for users to access, but it is not a secure website. To make it secure we should enable SSL to it follow the below steps.

  1. Go to the website list page, click the website domain name to open the website edit popup dialog.
  2. Click the SSL menu in the left panel. Click the Let’s Encrypt tab, check all domains’ checkboxes, click apply ( 申请 ) button.
  3. If your website uses a CDN service such as Cloudflare, you may find the above apply SSL process fails, you can read the article How To Enable HTTPS For Nginx Website That Use CDN (Cloudflare) to learn how to fix it.
  4. After applying the SSL certificate, turn on the 强制HTTPS toggle radio button at the web page top right corner. Now your WordPress website has been changed to a secure website.

8. How To Add CloudFlare To Your Website.

  1. If you want to use Cloudflare as your website CDN. You can read the article CloudFlare Plus SSL To Make Your WordPress Fast And Secure.
  2. When you add Cloudflare in front of your website, you can not use the website domain name to access it’s BT panel, because Cloudflare does not open the special port number which is used by your BT panel. You can access your website BT panel using it’s original IP address with the BT panel port number.

9. How To Change BT(宝塔) Panel Port Number And phpMyAdmin Port Number.

The default BT panel port number is 8888, and the default phpMyAdmin port number is 888. For security reasons, you should change it at once after you install it. Below are the steps. After you change the port number, you should make sure to add the new port number in the firewall to allow them to be accessed.

9.1 Change BT(宝塔) Panel Port Number.

  1. Log in to the BT panel.
  2. Click Dashboard Settings ( 面板设置 ) in the left side panel, then you can change the panel port number, username, and password in the right panel.

9.2 Change phpMyAdmin Port Number.

  1. Log in to the BT panel.
  2. Click software shop ( 软件商店 ) in the left panel.
  3. You can see phpMyAdmin in the right installed software list. Click 设置 link at the end of the phpMyAdmin line.
  4. Then it will pop up a dialog. Click 安全设置 tab in left, then you can change 访问端口 value.
  5. You should also click the php版本 tab on left to check whether the PHP version is correct or not. This may cause the phpMyAdmin unreachable.

10. Why Can Not Access BT Panel And PhpMyAdmin.

  1. BT panel and phpMyAdmin port number are not added in the firewall rule.
  2. Do not set the phpMyAdmin PHP version correctly.
  3. Do not install phpMyAdmin.

References

  1. How To Enable HTTPS For Nginx Website That Use CDN (CloudFlare).

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.