Administrator
发布于 2022-06-28 / 851 阅读
0
0

自动化开发环境搭建 -- 1. 虚拟机准备

创建虚拟机

环境: win10 + vbox + ubuntu20 server img
网卡: 桥接,从路由获取内网地址
前置: 配置国内源,安装docker
创建一个之后再复制出来2个,一个准备3个

启用 root 账户

# 设置 root 密码
sudo passwd root

# 设置 root ssh登录
nano /etc/ssh/sshd_config
---
PermitRootLogin yes
PasswordAuthentication yes
PubkeyAuthentication yes
---

修改虚拟机 hostname

nano  /etc/hostname
# 修改成对应的名称 eg: hf00 hf01 hf02
reboot

修改虚拟机ip

# 改ip
nano /etc/netplan/00-installer-config.yaml
--
network:
  ethernets:
    enp0s3:
      addresses:
      - 192.168.31.190/24
      gateway4: 192.168.31.1
      nameservers:
        addresses:
        - 223.5.5.5
        - 223.6.6.6
        search: []
  version: 2
--

# 应用新的网络配置
sudo netplan apply

# 设置时区
timedatectl set-timezone Asia/Shanghai

免密 ssh

# 生成 Pub key, 会在 ~/.ssh/ 下生成ssh的公钥和私钥
ssh-keygen -t rsa
# 添加本地公钥到需要需要免密登录的服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub root@hf00

其他

# 关闭 swap, 对 k8s 的安装做准备
swapoff -a
# 关闭防火墙
ufw status
ufw disable

评论