【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
相关推荐
ltl7 小时前
eBPF 可观测性全景:bcc、bpftrace、libbpf 的工程路径
linux
2401_868534787 小时前
数仓开发落地手册
linux·运维
正在走向自律8 小时前
使用atop工具监控Linux系统指标
linux·运维·php·实时监控·atop分析内存
果果燕10 小时前
实习笔记(一):NFS、Samba、VNC、Git、CMake、systemd、内核、交叉编译
linux·arm开发·c++·笔记·git
yyy(十一月限定版)10 小时前
017【入门】最小栈
linux·运维·服务器
不负岁月无痕11 小时前
简单理解操作系统结构
java·linux·c语言·开发语言·c++·面试
Zguigo12 小时前
第25-26讲:计算机操作系统存储管理——分页机制、页表与快表(TLB)
linux·windows·笔记
golang学习记12 小时前
Go 项目使用docker compose的正确方式
开发语言·docker·golang
常乐か13 小时前
VMware Workstation Pro 17 搭建 Ubuntu 24.04 完整指南
linux·运维·ubuntu
2401_8582861114 小时前
OS82.【Linux】设计线程池
java·linux·运维·服务器·开发语言·算法·线程池