Linux安裝寶塔面板及WordPress完整教程
一、準備工作
在開始之前,您需要:
- 一台Linux服務器(推薦使用CentOS 7.x)
- SSH connection tools (such as Xshell, Putty, etc.)
- Server root account and password
二、安裝寶塔面板
1. Connect to the server
Connect to your Linux server using the SSH tool:
Note: The first connection will display an SSH security warning. Click "Accept and Save" to proceed.
2. 執行安裝命令
Select the corresponding installation command according to your Linux system:
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec
# Ubuntu/Deepin installation script
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh ed8484bec
#Debian installation script
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh ed8484bec
#Universal installation script
if [ -f /usr/bin/curl ];then curl -sSO https://download.bt.cn/install/install_panel.sh;else wget -O install_panel.sh https://download.bt.cn/install/install_panel.sh;fi;bash install_panel.sh ed8484bec
During the installation process, you will be asked if you want to install to the /www directory. Enter "y" and press Enter:
Step 3: Complete the installation
安裝完成後,您會看到如下信息:
請保存好這些信息,特別是面板地址、用戶名和密碼。
III. Login to the Tower Panel
1. 訪問面板
在瀏覽器中輸入安裝完成後顯示的面板地址(如http://您的服務器IP:8888),使用提供的用戶名和密碼登錄。
2. Install the required environment
首次登錄時,寶塔會推薦安裝LNMP或LAMP環境。對於WordPress,我們推薦選擇:
- Nginx 1.20+
- MySQL 5.7+
- PHP 7.4+
四、創建網站
1. Add a website
On the Tower panel, click "Website" → "Add Site":
填寫您的域名(如果沒有域名,可以先使用服務器IP),選擇創建FTP和數據庫。
2. 下載WordPress
Go to the website's root directory (usually /www/wwwroot/your domain name), delete the default files, and then download WordPress:
unzip latest.zip
mv wordpress/* ./
3. Set permissions
確保文件權限正確:
chmod -R 755 *
Five, install WordPress
1. Visit the website
在瀏覽器中訪問您的域名或服務器IP,開始WordPress安裝:
2. Configure the database
Fill in the information from the created database before using it:
Step 3: Complete the installation
Set the website title, administrator account, and other information, and click "Install WordPress":
六、安全設置(可選但推薦)
1. 修改寶塔面板端口
Modify the default 8888 port in the "Security" settings on the tower panel.
2. Install SSL certificate
In the Tower Panel, under "Website" → "SSL," you can apply for a free Let's Encrypt certificate.
3. 設置防火牆
In the "Security" section of the Tower panel, turn on the firewall and only open the necessary ports.
常見問題
Q: 安裝寶塔面板時出錯怎麼辦?
A: Make sure your server is a brand-new system with no other environments installed. If the issue persists, you can try using a different Linux distribution.
Q: WordPress無法連接數據庫?
A:檢查數據庫名稱、用戶名和密碼是否正確,確保MySQL服務正在運行。
Q: How do I back up my website?
A: The Tower panel provides a "Scheduled Tasks" feature that allows you to regularly back up website files and databases.
恭喜!您現在已經成功在Linux服務器上安裝了寶塔面板並搭建了WordPress網站。您可以開始自定義您的主題、安裝插件和發布內容了!
