Linux(Ubuntu)安装Unity

Unity官方提供了安装的教程,可以参考这一篇文章:https://docs.unity3d.com/hub/manual/InstallHub.html#install-hub-linux

注意,只要是官方提供的安装流程,Unity也都是需要首先安装UnityHub再安装UnityEditor的,而且Linux版本相对Bug比较多,还要面对众多的发行版本,因此教程的具体步骤可能会略有不同。

第一步:需要生成公用的注册key

wget -qO - https://hub.unity3d.com/linux/keys/public | gpg --dearmor | sudo tee /usr/share/keyrings/Unity_Technologies_ApS.gpg > /dev/null

第二步:将这个key添加到Unityhub中

sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/Unity_Technologies_ApS.gpg] https://hub.unity3d.com/linux/repos/deb stable main" > /etc/apt/sources.list.d/unityhub.list'

第三步:使用apt命令安装UnityHub

sudo apt update
sudo apt-get install unityhub

第四部:通过Unity安装UnityEditor

打开终端terminal,输入命令unityhub,等待Unityhub加载启动。此时登陆自己的Unity账户密码,就可以当作正常的UnityHub来使用,并且下载安装UnityEditor并运行。

证书问题导致无法update

在执行上述步骤的第三步,在执行apt update时,很可能会遇到一个gpg的证书问题,导致update无法进行,更别说后面的添加Unityhub了,详细的报错类似于:

Err:6 https://hub-dist.unity3d.com/artifactory/hub-debian-prod-local stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BE3E6EA534E8243F
Fetched 2,739 B in 3s (1,079 B/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://hub-dist.unity3d.com/artifactory/hub-debian-prod-local stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BE3E6EA534E8243F
W: Failed to fetch https://hub.unity3d.com/linux/repos/deb/dists/stable/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BE3E6EA534E8243F
W: Some index files failed to download. They have been ignored, or old ones used instead.

需要注意的是:有遗传Public Key的代码:BE3E6EA534E8243F,这个public key就是Unity官方发布在apt里面的key,我们主动去搜索,但是无法进行验证。

此时,我们可以改成使用手动下载并且复制配置的方法处理这个public key,首先先从官方的linux key中下载public key证书文件。

wget -o- https://hub.unity3d.com/linux/keys/public

再使用gpg命令将其和unity keyring进行倒入注册

gpg --no-default-keyring --keyring ./unity_keyring.gpg --import public
gpg --no-default-keyring --keyring ./unity_keyring.gpg --export > ./unity-archive-keyring.gpg
sudo mv ./unity-archive-keyring.gpg /etc/apt/trusted.gpg.d/

最后验证安装,重复使用apt命令进行安装

sudo apt update
sudo apt-get install unityhub

参考文献

https://stackoverflow.com/questions/68992799/warning-apt-key-is-deprecated-manage-keyring-files-in-trusted-gpg-d-instead/71384057#71384057

https://askubuntu.com/questions/1395684/unity3d-installation-issues-gpg-error-repository-not-signed

分类: LinuxUnity3D

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用 * 标注