发帖
7 0 0

ha折腾之笔记本安装docker版的ha

chln
高级会员

15

主题

18

回帖

698

积分

高级会员

积分
698
智能家居 735 7 2023-12-21 20:49:41
本帖最后由 chln 于 2023-12-22 20:42 编辑

# 安装ubuntu
官方链接 https://ubuntu.com/tutorials/install-ubuntu-desktop
## 下载镜像
https://ubuntu.com/download/desktop
## U盘烧写
烧写工具 https://etcher.balena.io/
select-iso.png
## 启动
将 USB 闪存驱动器插入要用于安装 Ubuntu 的笔记本电脑或 PC,然后启动或重新启动设备。它应该自动识别安装介质。如果没有,请尝试在启动过程中按住 F12(或者其他),然后从系统特定的启动菜单中选择 USB 设备。
e650ba8eeab98bbe9ab5adbfa7708d18a5a468c6_2_690x490.png

## 其他操作
!!! 最好能访问外网
修改默认密码:
  1. sudo passwd
复制代码
  1. sudo apt-get install openssh-server
  2. sudo systemctl status/enable ssh

  3. vim/etc/ssh/sshd_config
  4. #PermitRootLogin yes
  5. #PubkeyAuthentication no
  6. PasswordAuthentication yes
复制代码
必要软件:
  1. sudo apt-get install vim htop tree git lrzsz
复制代码
用户提权:
  1. 指sudo 不用输入密码

  2. su root
  3. cd /etc
  4. chmod 777 sudoers

  5. vim sudoers
  6. # 添加
  7. xxxx    ALL=(ALL:ALL) ALL
  8. # 这里的xxx为其他用户名

  9. chmod 440 sudoers
复制代码
# 安装docker
  1. # su root 必须
  2. apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
  3. # 可能会出现文件已存在问题,直接回车就行
  4. curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg <<EOF
  5. y
  6. EOF

  7. echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]  https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
  8. apt-get update
  9. apt-get install -y docker-ce docker-ce-cli containerd.io


复制代码
  1. mkdir -p /etc/docker
  2. mkdir -p /data/docker_data
  3. mkdir -p /data/docker_v
  4. cd /etc/docker
  5. touch daemon.json
  6. bash -c 'cat > daemon.json <<EOF
  7. {
  8. "data-root":"/data/docker_data"
  9. }
  10. EOF'

  11. service docker start
  12. #service docker status

  13. apt install -y  docker-compose-plugin
  14. docker compose version

  15. apt install -y python3-pip
  16. pip install docker-compose
复制代码
开机自启:
systemctl enable docker

# 安装ha
  1. docker pull homeassistant/home-assistant
复制代码
运行ha:
  1. docker run -d --name="home" -v /data/docker_v/home/config:/config -p 8123:8123 homeassistant/home-assistant

  2. # ha 容器自启
  3. sudo docker update --restart=always home
复制代码
检查是否运行正常: docker ps
Snipaste_2023-12-21_20-47-41.png
查看ha: 浏览器 http://ip:8123
配置ha: 查看之前帖子
         ha折腾之升级ha    https://bbs.ai-thinker.com/forum.php?mod=viewthread&tid=43736




──── 0人觉得很赞 ────

使用道具 举报

2023-12-21 20:53:24
再来个HAOS的?
2023-12-21 20:59:08

没机器折腾了,haos太重了
2023-12-22 08:33:42
学到了
2023-12-22 08:42:23
2023-12-22 09:03:26
整个智能全屋一条龙
2023-12-22 09:04:04
不错
2024-4-6 10:15:38
学习
您需要登录后才可以回帖 立即登录
高级模式
返回
统计信息
  • 会员数: 27951 个
  • 话题数: 39404 篇