环境:Ubuntu20.04+有网络
结合此文章:https://www.cnblogs.com/jiumo/p/15958391.html
●设置全局代理
1.路径---
nano ~/.bashrc
2.结尾增加:
Acquire::http::Proxy "http://10.164.144.155:7890/";
Acquire::https::Proxy "http://10.164.144.155:7890/";
Acquire::ftp::Proxy "http://10.164.144.155:7890/";
●设置Docker代理
1.路径--
sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
2.增加内容
[Service]
Environment="HTTP_PROXY=http://10.164.144.155:7890"
Environment="HTTPS_PROXY=http://10.164.144.155:7890"
Environment="NO_PROXY=localhost,127.0.0.1,::1"
●安装docker
1. 卸载旧版本(如果有)--
sudo apt-get remove docker docker-engine docker.io containerd runc
2. 更新 apt 包索引---
sudo apt-get update
3. 安装必要的依赖项---
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
4. 添加 Docker 的官方 GPG 密钥---
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
5. 添加 Docker 官方的 APT 源---
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
6. 更新 APT 包索引---
sudo apt-get update
7. 安装 Docker 20.10.12 【CE版本】---
sudo apt-get install docker-ce=5:20.10.12~3-0~ubuntu-$(lsb_release -cs) docker-ce-cli=5:20.10.12~3-0~ubuntu-$(lsb_release -cs) containerd.io
8. 验证安装---
docker --version
9. 启动并启用 Docker---
sudo systemctl start docker
sudo systemctl enable docker
●安装Docker Compose
1.安装Docker Compose---
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
2.执行安装---
sudo chmod +x /usr/local/bin/docker-compose
3.查看版本---
docker-compose --version
●docker配置代理
1.打开文件---
nano /etc/systemd/system/docker.service.d/http-proxy.conf
2.添加内容:
[Service]
Environment="HTTP_PROXY=http://10.164.144.155:7890"
Environment="HTTPS_PROXY=http://10.164.144.155:7890"
Environment="NO_PROXY=localhost,127.0.0.1,::1"
3.重新加载和重启 Docker---
sudo systemctl daemon-reload
sudo systemctl restart docker
●安装portainer 【2.19.5版本】
sudo docker pull portainer/portainer-ce:2.19.5
sudo docker run -d -p 39000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.19.5
●安装Harbor
1. 下载并解压 Harbor 安装包---
wget https://github.com/goharbor/harbor/releases/download/v2.5.3/harbor-online-installer-v2.5.3.tgz
2. 配置 Harbor-----
cp harbor.yml.tmpl harbor.yml
nano harbor.yml
配置示例:
hostname: myharbor.example.com→→→→【ip:端口】
HTTPS→→→【注释掉】
http:
port: 80→→→→【38880】
harbor_admin_password: Harbor12345
data_volume: /data
database:
password: root123
3. 安装并启动 Harbor---
sudo ./install.sh
●安装node red 【2.19.5版本】
1. 检查 ufw 状态---
sudo ufw status
2. 禁用防火墙---
sudo ufw disable
3. 关闭 ufw 服务---
sudo systemctl stop ufw
sudo systemctl disable ufw
4.创建一个本地目录---
mkdir -p ~/nodered/data
5.赋予目录权限:---
chmod -R 777 ~/nodered/data
6.使用 Docker 运行 Node-RED 并挂载数据目录---
docker run -d -p 3880:1880 -v ~/nodered/data:/data --name mynodered nodered/node-red
●安装mosquito
1. 拉取 Mosquitto 镜像--
docker pull eclipse-mosquitto
2. 创建 Mosquitto 配置文件和目录---
mkdir -p ~/mosquitto/config ~/mosquitto/data ~/mosquitto/log
3. 创建一个基本的配置文件---
nano ~/mosquitto/config/mosquitto.conf
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883
allow_anonymous true
4. 运行 Mosquitto 容器---
docker run -d --name mosquitto \
-p 1883:1883 \
-p 9001:9001 \
-v ~/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf \
-v ~/mosquitto/data:/mosquitto/data \
-v ~/mosquitto/log:/mosquitto/log \
eclipse-mosquitto
●安装RabbitMQ
1.拉取 RabbitMQ 镜像---
docker pull rabbitmq:management
2.配置持久化存储---
mkdir -p ~/rabbitmq/data ~/rabbitmq/log
3.以绑定挂载的方式启动容器----
docker run -d --name rabbitmq \
-p 5672:5672 -p 15672:15672 \
-v ~/rabbitmq/data:/var/lib/rabbitmq/mnesia \
-v ~/rabbitmq/log:/var/log/rabbitmq \
rabbitmq:management