TawfikDaim / home_automation

home automation user stories
0 stars 0 forks source link

Obselete_Install VM on this hardware (preferable Debian Linux version) #2

Open TawfikDaim opened 1 year ago

TawfikDaim commented 1 year ago

check the Linux version that will allow HACS to be installed with now issues

TawfikDaim commented 1 year ago

Linux Debian ((like the one I did on old Microsoft surface laptop))

https://www.youtube.com/watch?v=poCSq_0OmjE

TawfikDaim commented 1 year ago
  1. download: https://github.com/home-assistant/operating-system/releases/download/9.5/haos_ova-9.5.vdi.zip
  2. install Oracle VM VirtualBox Manager
  3. Create a new virtual machine Select Type “Linux” and Version “Linux 2.6 / 3.x / 4.x (64-bit)”

Image

Image

  1. unzip file downloaded in 1 -> haos_ova-9.5.vdi
  2. Select “Use an existing virtual hard disk file”, select the unzipped VDI file from above; haos_ova-9.5.vdi
  3. Edit the “Settings” of the VM and go “System” then “Motherboard” and select “Enable EFI”

Image

  1. Then go to “Network” “Adapter 1” choose “Bridged Adapter” and choose your Network adapter

Image

TawfikDaim commented 1 year ago

Another Method (but this was not completely successful yet, as I can't ping or ssh from another PC to the Windows with Debian WSL - what I will do now is to try to install homeassistant on Debian to see if its accessible (hoping the issue is with firewall or ssh but it will not be with 8123 port for homeassistant)

  1. install WSL from windows
  2. install debian on WSL from windows
  3. add needed packages using sudo apt install, like net-tools, ssh openssh-server and more
  4. create a file sudo nano /etc/wsl.conf and add line [boot] and systemd=true
  5. restart debian
  6. now you should be able to ssh to the debian WSL from the same host (only from same host)
  7. to extend this beyond ....https://medium.com/geekculture/enable-ssh-access-into-wsl-from-a-remote-computer-f2e4a962430

Route Port 22 (SSH port) Traffic to WSL Distro (e.g., Ubuntu 22.04) Session This is where the tutorial becomes kludgy because there are a few problems with WSL as follows:

The IP address is assigned to the WSL distro (e.g., Ubuntu 22.04) session dynamically, so every time the WSL session starts or restarts, a new IP address is assigned. If you issue a command like ‘wsl — shutdown’ to shut down the WSL session(s) and start a new WSL session, a new IP address gets assigned. The IP address assigned to the WSL distro (e.g., Ubuntu 22.04) session is only accessible by the host computer (i.e., Windows computer). It is not accessible by remote computers. The only way a remote computer can SSH into the WSL session is by creating a network port proxy rule on a Windows computer that maps port 22 to the WSL distro (e.g., Ubuntu 22.04) session. This means that every time the WSL IP address changes, we will need to delete the existing network port proxy rule and replace it with a new one.

Step 3: Delete the Existing Network Port Proxy Rule and Create a New Network Port Proxy Rule

This information was provided by Scott Hanselman on his blog “How to SSH into WSL2 on Windows 10 from an external machine”.

From PowerShell in administrator mode or run as administrator, issue the following command to delete/add network port proxy rules where it uses $wsl_ipaddress1 variable:

netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=22 netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=22 connectaddress=$wsl_ipaddress1 connectport=22 Issue the following command to validate network port proxy rule has been changed:

netsh interface portproxy show v4tov4 which should return the following information:

You can also remove all port proxy rules:

netsh int portproxy reset all

Step 4: Open the Firewall

By default, port 22 is blocked by Windows Defender’s firewall. From the same PowerShell in administrator mode or run as administrator, issue the following command to open port 22.

netsh advfirewall firewall add rule name=”WSL SSH” dir=in action=allow protocol=TCP localport=22.

Test SSH Access to WSL from a Remote Computer Finally, restart the computer then log into the computer. You should see two activities:

Windows Terminal window starting with selected WSL Distro (Ubuntu 22.04) Flash of Powershell terminal executing Powershell script. Using the remote computer, SSH into the Windows computer using its IP address:

ssh sungkim@192.168.1.100