本帖最后由 chln 于 2023-12-22 20:42 编辑
# 安装ubuntu
官方链接 https://ubuntu.com/tutorials/install-ubuntu-desktop
## 下载镜像
https://ubuntu.com/download/desktop
## U盘烧写
烧写工具 https://etcher.balena.io/
## 启动
将 USB 闪存驱动器插入要用于安装 Ubuntu 的笔记本电脑或 PC,然后启动或重新启动设备。它应该自动识别安装介质。如果没有,请尝试在启动过程中按住 F12(或者其他),然后从系统特定的启动菜单中选择 USB 设备。
## 其他操作
!!! 最好能访问外网
修改默认密码:
- sudo apt-get install openssh-server
- sudo systemctl status/enable ssh
- vim/etc/ssh/sshd_config
- #PermitRootLogin yes
- #PubkeyAuthentication no
- PasswordAuthentication yes
复制代码 必要软件:- sudo apt-get install vim htop tree git lrzsz
复制代码 用户提权:- 指sudo 不用输入密码
- su root
- cd /etc
- chmod 777 sudoers
- vim sudoers
- # 添加
- xxxx ALL=(ALL:ALL) ALL
- # 这里的xxx为其他用户名
- chmod 440 sudoers
复制代码 # 安装docker
- # su root 必须
- apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
- # 可能会出现文件已存在问题,直接回车就行
- curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg <<EOF
- y
- EOF
- 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
- apt-get update
- apt-get install -y docker-ce docker-ce-cli containerd.io
复制代码- mkdir -p /etc/docker
- mkdir -p /data/docker_data
- mkdir -p /data/docker_v
- cd /etc/docker
- touch daemon.json
- bash -c 'cat > daemon.json <<EOF
- {
- "data-root":"/data/docker_data"
- }
- EOF'
- service docker start
- #service docker status
- apt install -y docker-compose-plugin
- docker compose version
- apt install -y python3-pip
- pip install docker-compose
复制代码 开机自启:
systemctl enable docker
# 安装ha
- docker pull homeassistant/home-assistant
复制代码 运行ha:- docker run -d --name="home" -v /data/docker_v/home/config:/config -p 8123:8123 homeassistant/home-assistant
- # ha 容器自启
- sudo docker update --restart=always home
复制代码 检查是否运行正常: docker ps
查看ha: 浏览器 http://ip:8123
配置ha: 查看之前帖子
ha折腾之升级ha https://bbs.ai-thinker.com/forum.php?mod=viewthread&tid=43736
|