Step by step install openwrt onto edgerouter x?

1st Update to the latest stock firmware 2.xx version to get the latest bootloader.

2nd Get a OpenWrt firmwire file to prepare the device to load OpenWrt firmware and flash it through the Web interface of stock firmware:
https://github.com/stman/OpenWRT-19.07.2-factory-tar-file-for-Ubiquiti-EdgeRouter-x/blob/master/openwrt-ramips-mt7621-ubnt-erx-initramfs-factory.tar

3rd After reboot you can flash the latest official firmware:
http://downloads.openwrt.org/releases/19.07.4/targets/ramips/mt7621/openwrt-19.07.4-ramips-mt7621-ubnt-erx-squashfs-sysupgrade.bin

For reference:

  1. Operational OpenWrt 19.07.2 Factory Tar file for EdgeRouter X
  2. https://openwrt.org/toh/ubiquiti/ubiquiti_edgerouter_x_er-x_ka
  3. https://github.com/stman/OpenWRT-19.07.2-factory-tar-file-for-Ubiquiti-EdgeRouter-x

If you do not trust a built image by a "3rd party". Then you could make the image mentioned under 2nd by your own also. The steps for this are described within the 3rd referenced link.