Tengxun Cloud International Agent: Quickly Build Development Environment with Docker Pagoda Panel on Tengxun Cloud Server
After buying a cloud server, the first thing is to match the environment. According to the traditional method, typing commands line by line to install Nginx, MySQL, PHP and Java is not only slow, but also often stuck in various dependency conflicts. Today, let's not engage in those fancy, directly on the modern development of efficient combination boxing:
Docker Pagoda Panel
.
Where is this program cool?
BaoTa Panel
It provides you with an extremely comfortable graphical interface, and you can manage files and match sites with a little mouse. And throw the pagoda
Docker containers
Running inside can not only keep your host (the server itself) absolutely clean, but also "one-click backup and migration at any time". After the server expired, the container was directly taken away and resurrected on the new server for a second.
Don't talk nonsense, prepare your Tengxun cloud server (CentOS 7.9 or Ubuntu 22.04 is recommended), and let's speed up directly.
The first stage: pure host installation Docker
Whether you buy CVM (cloud server) or Lighthouse (lightweight application server), the system is the cleanest when it is installed. We first need to install the "container engine" of Docker.
in the mainstream
The Ubuntu system
For example (CentOS process is almost the same), after connecting to the server with SSH tool, directly copy and execute the following command:
1. Update the system software package
Bash
sudo apt-get update && sudo apt-get upgrade -y
2. Install the official Docker script with one click
Tengxunyun has its own mirror source in China, and the official quick installation script is very fast:
Bash
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
3. Start and set the boot self-start
Bash
sudo systemctl start docker
sudo systemctl enable docker
4. Verify Installation
Input
docker --version
If you see something like
Docker version 27.x.x
The words indicate that the underlying engine has been steadily completed.
Phase II: Soldering a "pagoda panel" in Docker"
Ordinary Docker containers are thrown away when they are used up, but the pagoda panel is to run for a long time and save data. So, when we start the pagoda container,
Port mapping and data persistence must be done (mount directory)
.
Execute the following string of carefully optimized container startup commands directly in the terminal:
Bash
docker run -d \
--name baota-dev
\
--restart unless-stopped \
-p 8888:8888 \
-p 80:80 \
-p 443:443 \
-p 3306:3306 \
-p 888:888 \
-v /www/wwwroot:/www/wwwroot \
-v /www/server/data:/www/server/data \
-v /www/vhost:/www/vhost \
--privileged=true \
pch18/baota:lnmp
Core parameter big decryption (why so match):
-p 8888:8888: map the default 8888 management port of the pagoda in the container to the 8888 port of your server.
-p 80:80 -p 443:443: This is the HTTP and HTTPS facade port for your website to go online in the future and must be mapped out.
-v /www/wwwroot:/www/wwwroot: Spirituality. Mount the web page root directory to the host's/www/wwwroot. This means that even if the container is accidentally deleted, your code files will still lie safely on the server's hard drive.
-- privileged = true: Give the container full system permissions, because the pagoda needs to start system services such as Nginx and MySQL inside the container.
pch18/baota:lnmp: This is a pagoda image that is well received by the community and deeply optimized for the Docker environment, integrating the basic environment.
The third stage: tengxun cloud security group release (novices are most likely to step on pits)
The container is running, but at this point you enter.
ht
Tp: // Your server IP:8888
The probability is not open. Because there is a layer of "security group (firewall)" outside tengxunyun blocking the port.
Log in to the Tengxun cloud console and enter your cloud server/lightweight server details page.
Click the Security Group or Firewall tab and click Add Rule ".
Release the following ports (TCP is selected for application type):8888 (pagoda panel background) 80 and 443 (website access) 888(phpMyAdmin database management, optional)
Click Save. The security group takes effect in real time.
The fourth stage: initialization pagoda and development environment construction
1. Obtain login credentials
After the security group is released, return to the SSH terminal, we need to go into the container to see the initial account password given to us by the pagoda. Execution:
Bash
docker exec -it baota-dev bt default
The terminal prints a message similar to the following:
Pagoda panel outside Internet
Network address: ht
Tp: // your public network IP:8888/a string of random characters user name: adminXXXX password: passwordXXXX
2. First login and one-click environment installation
Copy the external network address to the browser to open, enter the account password just obtained to log in.
The first time you enter, the pagoda will pop up a window recommending the installation environment. As a development environment, it is strongly recommended to select the left
LNMP environment (Linux, Nginx, MySQL, PHP)
:
Nginx selects the latest stable version.
MySQL is recommended to 5.7 or 8.0 (commonly used for development).
PHP choose 7.4 or 8.x (depending on your project).
Select "Fast Installation" and click one-click deployment.
At this time, you can make a cup of tea. The pagoda will automatically help you compile and install all the necessary software for development in the background of the container. You don't need to worry about it at all.
The fifth stage: actual combat exercise -5 minutes to launch a local development project
After the environment is installed, let's simulate how to run a local front-end or back-end project.
1. Create a site
Click on the left menu of the pagoda
Website-> Add Site"
.
Domain Name: If you do not have a domain name, directly fill in the "public network IP" of your server ".
Root: The system will automatically generate/www/wwwroot/your IP.
Database: Check "Create Database" conveniently, it will automatically help you build MySQL library and generate account password.
2. Pass code
Click on the left
"File"
, click into the root directory of the website just now and delete the default file inside. Click "Upload" to package your locally written static HTML page or Vue/React
distance
The contents of the folder are dragged in.
3. View the results
Now, directly enter your server public network IP in the browser, and you will find that your own project has been running perfectly online!
The ultimate advance: how to pack this environment away?
At the beginning of the article, the biggest advantage of using Docker is
Good move.
. Suppose your Tengxun cloud server expires next month, and you get another cheaper server, how can you migrate with one click?
On the old server, only two lines of command were required:
Bash
#1. Save the currently running pagoda container as a new image
docker commit baota-dev my-perfect-env:v1
#2. Export the image as a package file
docker save -o /root/my_env.tar my-perfect-env:v1
You only need to put
my_env.tar
This file is transferred over the network to the new server and executed on the new machine.
Okay
docker load -i my_env.tar
import, and then use the second phase
docker run
Command to start, your entire pagoda, configuration, and even installed software are all revived intact.
As for
/www/wwwroot
In the code file, because we did the mount, directly put the old server's
/www/wwwroot
The folder is compressed and packaged and decompressed to the directory with the same name of the new server. The code is perfectly separated from the environment, which is the elegant modern development genre.

