【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
相关推荐
雪域迷影2 小时前
PostgreSQL Docker Error – 5432: 地址已被占用
数据库·docker·postgresql
韩楚风3 小时前
【linux 多进程并发】linux进程状态与生命周期各阶段转换,进程状态查看分析,助力高性能优化
linux·服务器·性能优化·架构·gnu
莹雨潇潇3 小时前
Docker 快速入门(Ubuntu版)
java·前端·docker·容器
陈苏同学3 小时前
4. 将pycharm本地项目同步到(Linux)服务器上——深度学习·科研实践·从0到1
linux·服务器·ide·人工智能·python·深度学习·pycharm
Ambition_LAO3 小时前
解决:进入 WSL(Windows Subsystem for Linux)以及将 PyCharm 2024 连接到 WSL
linux·pycharm
Pythonliu74 小时前
茴香豆 + Qwen-7B-Chat-Int8
linux·运维·服务器
你疯了抱抱我4 小时前
【RockyLinux 9.4】安装 NVIDIA 驱动,改变分辨率,避坑版本。(CentOS 系列也能用)
linux·运维·centos
追风赶月、4 小时前
【Linux】进程地址空间(初步了解)
linux
栎栎学编程4 小时前
Linux中环境变量
linux
挥剑决浮云 -4 小时前
Linux 之 安装软件、GCC编译器、Linux 操作系统基础
linux·服务器·c语言·c++·经验分享·笔记