【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
相关推荐
angushine1 小时前
Docker方式安装Prometheus+Grafana+Node Exporter
docker·grafana·prometheus
wdfk_prog2 小时前
[Linux]学习笔记系列 -- [kernel][time]alarmtimer
linux·笔记·学习
小志biubiu2 小时前
【Linux】Ext系列文件系统
linux·服务器·c语言·经验分享·笔记·ubuntu·操作系统
ha20428941943 小时前
Linux操作系统学习之---基于环形队列的生产者消费者模型(毛坯版)
linux·c++·学习
南林yan5 小时前
Debian、Ubuntu、CentOS:Linux 三大发行版的核心区别
linux·ubuntu·debian·linux内核
码界奇点6 小时前
通往Docker之路从单机到容器编排的架构演进全景
docker·容器·架构
阿Y加油吧6 小时前
Docker从入门到实战——含容器部署、docker基础、项目部署
运维·docker·容器
Wang's Blog7 小时前
Linux小课堂: NGINX反向代理服务器配置与实践
linux·运维·nginx
zhilin_tang7 小时前
对比select和epoll两种多路复用机制
linux·c语言·架构
showker7 小时前
ecstore等产品开启缓存-后台及前台不能登录原因-setcookie+session问题
java·linux·前端