OpenBSD 6.7如何安装xbase

OpenBSD 6.7 how to install xbase

我正在将我们的集成测试环境更新到 OpenBSD 6.7(从 6.5)

我们使用ansible在目标系统上安装所有的包(openbsd 6.7,Vagrant镜像https://app.vagrantup.com/generic/boxes/openbsd6/versions/3.0.6

如上图,无法安装javaopenjdk 11.

obsd-31# pkg_add -r jdk%11     
quirks-3.325 signed on 2020-05-27T12:56:02Z
jdk-11.0.7.10.2p0v0:lz4-1.9.2p0: ok
jdk-11.0.7.10.2p0v0:zstd-1.4.4p1: ok
jdk-11.0.7.10.2p0v0:jpeg-2.0.4p0v0: ok
jdk-11.0.7.10.2p0v0:tiff-4.1.0: ok
jdk-11.0.7.10.2p0v0:lcms2-2.9p0: ok
jdk-11.0.7.10.2p0v0:png-1.6.37: ok
jdk-11.0.7.10.2p0v0:giflib-5.1.6: ok
Can't install jdk-11.0.7.10.2p0v0 because of libraries
|library X11.17.0 not found
| not found anywhere
|library Xext.13.0 not found
| not found anywhere
|library Xi.12.1 not found
| not found anywhere
|library Xrender.6.0 not found
| not found anywhere
|library Xtst.11.0 not found
| not found anywhere
|library freetype.30.0 not found
| not found anywhere
Direct dependencies for jdk-11.0.7.10.2p0v0 resolve to png-1.6.37 libiconv-1.16p0 giflib-5.1.6 lcms2-2.9p0 jpeg-2.0.4p0v0
Full dependency tree is giflib-5.1.6 lz4-1.9.2p0 tiff-4.1.0 png-1.6.37 xz-5.2.5 jpeg-2.0.4p0v0 lcms2-2.9p0 zstd-1.4.4p1 libiconv-1.16p0
Couldn't install jdk-11.0.7.10.2p0v0

我的猜测是没有安装 xbase。 但是,我无法弄清楚如何在不重新启动到可启动安装程序的情况下安装 xbase(因为我需要通过来自 ansible 的 shell 命令 运行 来完成)

有办法吗?

可以通过以下命令手动提取 xbase file set:

cd /
curl -LO https://ftp.usa.openbsd.org/pub/OpenBSD/6.7/amd64/xbase67.tgz
tar xzvf xbase67.tgz

注意:这是vagrant sources中使用的镜像。

您使用的通用 OpenBSD Vagrant 映像是作为命令行环境创建的,因此在安装过程中排除了 X windows 文件。 有很多方法可以在安装后将 X windows 添加到 OpenBSD,但我想到的最快的方法是:

sudo su -l
curl -LO 'https://ftp.usa.openbsd.org/pub/OpenBSD/6.7/amd64/x{base,serv,font,share}67.tgz'
tar xzf xbase67.tgz -C / 
tar xzf xserv67.tgz -C / 
tar xzf xfont67.tgz -C / 
tar xzf xshare67.tgz -C / 
rm -f xbase67.tgz xfont67.tgz xserv67.tgz xshare67.tgz
ldconfig /usr/local/lib /usr/X11R6/lib

如果您想在 OpenBSD 上测试 X windows 的存在,请尝试使用以下 shell 片段:

if [ -d /usr/X11R6/bin/ ] && [ -f /usr/X11R6/bin/xinit ]; then
  echo "X windows has been installed."
else
  echo "This is a command line only system."
fi

如果您足够关心安全性以使用 OpenBSD,那么您真的不应该在不检查 hashes/signatures 是否有效的情况下从互联网上获取新的软件包集。试试这个脚本:

#!/bin/ksh

echo -n "Downloading ... "
curl --silent --fail --fail-early -O "https://ftp.usa.openbsd.org/pub/OpenBSD/7.0/amd64/SHA256.sig" -O "https://ftp.usa.openbsd.org/pub/OpenBSD/7.0/amd64/x{base,font,serv,share}70.tgz"
if [ $? != 0 ]; then
  echo "X windows download failed. Terminating."
  exit 1
fi
echo "complete."

signify -Cp /etc/signify/openbsd-70-base.pub -x SHA256.sig xbase70.tgz xfont70.tgz xserv70.tgz xshare70.tgz
if [ $? != 0 ]; then
  echo "X windows signature verification failed. Terminating."
  exit 1
fi

tar -z -x -C / -f xbase70.tgz && tar -z -x -C / -f xfont70.tgz && tar -z -x -C / -f xserv70.tgz && tar -z -x -C / -f xshare70.tgz
if [ $? != 0 ]; then
  echo "X windows installation failed. Terminating."
  exit 1
fi
echo "Installation complete. Happy hacking."

另一方面,如果您只想要一个衬里:

# Install just x11 base set.
sudo ksh -c 'curl --silent https://ftp.usa.openbsd.org/pub/OpenBSD/7.0/amd64/xbase70.tgz | gzip -d -c | tar -x -C / -f - '

# Install all the x11 sets.
sudo ksh -c 'curl --silent https://ftp.usa.openbsd.org/pub/OpenBSD/7.0/amd64/xbase70.tgz | gzip -d -c | tar -x -C /-f - '

如果您已经以 root 身份登录,则可以省略 sudo 部分。对于 vagrant 人来说,懒惰的版本看起来是:


# Install just x11 base set from the host, to a vagrant guest.
vagrant ssh -c "sudo ksh -c 'curl --silent https://ftp.usa.openbsd.org/pub/OpenBSD/7.0/amd64/xbase70.tgz | gzip -d -c | tar -x -C / -f - '"

# Install all the x11 sets from the host, to a vagrant guest.
vagrant ssh -c "sudo ksh -c 'curl --silent -O \"https://ftp.usa.openbsd.org/pub/OpenBSD/7.0/amd64/x{base,font,serv,share}70.tgz\" && tar -z -x -C / -f xbase70.tgz && tar -z -x -C / -f xfont70.tgz && tar -z -x -C / -f xserv70.tgz && tar -z -x -C / -f xshare70.tgz'"