Considering that many users have provided feedback that some configurations in the "Fun Docker Projects" series of articles are too cumbersome, resulting in long articles, I will separate the content of the configuration part into a separate article.
If you have any comments or suggestions, please feel free to provide feedback in the comments section. I will promptly make improvements based on reasonable suggestions or opinions.
Preparation#
- Server: Tencent Hong Kong Lightweight Application Server, 24 yuan/month for one VPS. I personally use Tencent Lightweight Application Server. (It is recommended to choose a server outside mainland China, such as Hong Kong). If you are a beginner, you can also purchase a server from Racknerd (select the US West region). The minimum cost is less than 100 yuan per year (Racknerd server introduction: click to view).
- System: Debian 10 or above (Ubuntu 20.04 or above). It is not recommended to use CentOS. For specific reasons, please see: Explanation of why Debian is preferred over CentOS.
Log in to the server#
Choose an SSH connection software.
Mac or Linux users can directly use the built-in terminal (also called Terminal) to log in to the server.
Enter:
ssh your_username@your_server_ip -P 22
If you haven't changed the SSH port, the default is 22. However, for server security, it is recommended to change to a different port.
Upgrade Packages#
sudo -i # Switch to the root user
apt update -y # Upgrade packages
apt install wget curl sudo vim git -y # Debian system is relatively clean, install commonly used software
Add SWAP virtual memory#
You can use the script to set up SWAP:
wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh
Select 18, and then enter the value you want to expand.
Install Docker environment#
Install Docker (non-mainland servers)#
wget -qO- get.docker.com | bash
docker -v # Check Docker version
systemctl enable docker # Set to start automatically on boot
Install Docker-compose (non-mainland servers)#
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Check Docker-compose version
Install Docker (domestic servers)#
curl -sSL https://get.daocloud.io/docker | sh
docker -v # Check Docker version
systemctl enable docker # Set to start automatically on boot
Install Docker-compose (domestic servers)#
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.1.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version # Check Docker-compose version
Reprinted from:
VPS Basic Configuration - I am not a pigeon - Incomplete record of VPS tinkering