【Linux】拿到一台新的Ubuntu系统,你需要准备些什么?

1、开启端口

查看已经开启的端口

shell 复制代码
sudo ufw status

打开端口

shell 复制代码
sudo ufw allow 3306

开启防火墙

shell 复制代码
sudo ufw enable

重启防火墙

shell 复制代码
sudo ufw reload

再次查看一下端口是否已开放

shell 复制代码
sudo ufw status

2、安装Docker

卸载旧版本 Docker

shell 复制代码
sudo apt-get remove docker \
     docker-engine \
     docker.io

apt更新

shell 复制代码
sudo apt-get update

下载安装时必要工具

shell 复制代码
sudo apt-get install \
     apt-transport-https \ 
     ca-certificates \ 
     curl \
     gnupg-agent \
     software-properties-common

添加软件源的 GPG 密钥 (Aliyun 和 官方 二选一)

Aliyun

shell 复制代码
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

官方

shell 复制代码
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sources.list 中添加 Docker 软件源 (Aliyun 和 官方 二选一)

Aliyun

shell 复制代码
sudo add-apt-repository \
     "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
     $(lsb_release -cs) \
     stable"

官方

shell 复制代码
sudo add-apt-repository \ 
     "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
     $(lsb_release -cs) \ 
     stable"

安装 Docker , 使用脚本自动安装

shell 复制代码
sudo apt-get update 

sudo apt-get install docker-ce docker-ce-cli containerd.io

curl -fsSL get.docker.com -o get-docker.sh 

sudo sh get-docker.sh --mirror Aliyun

启动 Docker

shell 复制代码
sudo systemctl enable docker

sudo systemctl start docker

3、Docker 安装 Mysql Redis Portainer

安装Mysql

shell 复制代码
# 搜索 Mysql 镜像
docker search mysql:5.7

# 拉取 Mysql 镜像
docker pull mysql:5.7
  
# 启动 Mysql 容器 
docker run -d \
  --name tcs_mysql \
  -p 3306:3306 \
  -e MYSQL_ROOT_PASSWORD=cat888 \
  --character-set-server=utf8mb4 \
  --collation-server=utf8mb4_general_ci \
  mysql:5.7

安装 Redis

shell 复制代码
# 拉取 Redis 镜像
docker pull redis

# 拉取配置
wget http://download.redis.io/redis-stable/redis.conf
  
# 启动 Reids
docker run --name redis \
-p 6379:6379 \
-v /docker-data/redis/redis.conf:/etc/redis/redis.conf \
-v /docker-data/redis:/data \
-d redis redis-server /etc/redis/redis.conf --appendonly yes
相关推荐
鸡鸭扣30 分钟前
Docker:3、在VSCode上安装并运行python程序或JavaScript程序
运维·vscode·python·docker·容器·js
A ?Charis1 小时前
k8s-对接NFS存储
linux·服务器·kubernetes
神秘_博士2 小时前
自制AirTag,支持安卓/鸿蒙/PC/Home Assistant,无需拥有iPhone
arm开发·python·物联网·flutter·docker·gitee
人工干智能4 小时前
科普:“Docker Desktop”和“Docker”以及“WSL”
运维·docker·容器
落笔画忧愁e4 小时前
FastGPT及大模型API(Docker)私有化部署指南
运维·docker·容器
一天八小时4 小时前
Docker学习进阶
学习·docker·容器
前端没钱4 小时前
前端需要学习 Docker 吗?
前端·学习·docker
Logout:4 小时前
[AI]docker封装包含cuda cudnn的paddlepaddle PaddleOCR
人工智能·docker·paddlepaddle
DC_BLOG5 小时前
Linux-GlusterFS进阶配置
linux·运维·服务器
我们的五年5 小时前
MAC地址是如何在局域网中工作的?
linux