OpenBSD安装端口树集合

时间:2020-01-09 10:42:52  来源:igfitidea点击:

我已经安装了OpenBSD操作系统,但是/usr/ports目录中缺少端口集合。
如何在OpenBSD下从ftp/http站点安装端口?

端口收集对于OpenBSD服务器或者基于台式机/笔记本电脑的系统至关重要。
您可以使用OpenBSD端口集合为第三方应用程序创建二进制软件包。

方法1:从OpenBSD CDROM安装端口

如果您具有OpenBSD CDROM,请执行以下命令,将端口树的内容复制到/usr/ports;您可以在/cdrom上安装带有端口的CD-ROM并发出如下命令:

# mount /cdrom
# cd /usr
# tar zxf /cdrom/ports.tar.gz

方法2:从FTP/HTTP镜像站点安装OpenBSD端口

使用wget命令(在OpenBSD上默认未安装)或者ftp命令客户端并获取ports.tar.gz,执行:

$ cd ## go to home dir ##
$ wget http://ftp.usa.openbsd.org/pub/OpenBSD/$(uname -r)/ports.tar.gz
$ wget http://ftp.usa.openbsd.org/pub/OpenBSD/$(uname -r)/SHA256.sig

或者使用ftp命令:

$ cd ## go to home dir ##
$ ftp http://ftp.usa.openbsd.org/pub/OpenBSD/$(uname -r)/ports.tar.gz
$ ftp http://ftp.usa.openbsd.org/pub/OpenBSD/$(uname -r)/SHA256.sig

或者从此处使用OpenBSD镜像:

$ cd ## go to home dir ##
$ ftp ftp://mirror.planetunix.net/pub/OpenBSD/$(uname -r)/ports.tar.gz
$ ftp ftp://mirror.planetunix.net/pub/OpenBSD/$(uname -r)/SHA256.sig

输出示例:

--11:44:39--  ftp://ftp.openbsd.org/pub/OpenBSD/6.0/ports.tar.gz
           -  `ports.tar.gz'
Resolving ftp.openbsd.org... 129.128.5.191
Connecting to ftp.openbsd.org|129.128.5.191|:21... connected.
Logging in as anonymous ... Logged in!
=-  SYST ... done.    =-  PWD ... done.
=-  TYPE I ... done.  =-  CWD /pub/OpenBSD/6.0 ... done.
=-  PASV ... done.    =-  RETR ports.tar.gz ... done.
Length: 11,184,931 (11M) (unauthoritative)
 
100%[================================================================================================================- ] 11,184,931   236.83K/s    ETA 00:00
 
11:45:29 (230.09 KB/s) - `ports.tar.gz' saved [11184931]

在OpenBSD上提取端口树

使用signify命令验证ports.tar.gz文件,执行:

## match your openbsd version here (openbsd-60-base.pub) ##
$ signify -C -p /etc/signify/openbsd-60-base.pub -x SHA256.sig ports.tar.gz

输出示例:

Signature Verified
ports.tar.gz: OK

要解压缩ports.tar.gz,请以root用户身份使用tar命令:

# tar -zxvf ports.tar.gz -C /usr/

输出示例:

ports
ports/CVS
ports/CVS/Repository
ports/CVS/Entries
ports/.cvsignore
ports/INDEX
ports/Makefile
ports/README
ports/archivers
ports/archivers/CVS
ports/archivers/CVS/Repository
ports/archivers/CVS/Entries
....
..
...
ports/x11/yeahlaunch/pkg
ports/x11/yeahlaunch/pkg/CVS
ports/x11/yeahlaunch/pkg/CVS/Repository
ports/x11/yeahlaunch/pkg/CVS/Entries
ports/x11/yeahlaunch/pkg/DESCR
ports/x11/yeahlaunch/pkg/PLIST

提取后,可以使用rm命令删除ports.tar.gz文件,如下所示:

$ rm ports.tar.gz SHA256.sig

如何使用OpenBSD上的端口?

要使用端口,请使用cd进入/usr/ports /目录:

$ cd /usr/ports
$ ls

输出示例:

.cvsignore      biology         emulators       lang            productivity
CVS             books           fonts           mail            security
INDEX           cad             games           math            shells
Makefile        chinese         geo             meta            sysutils
README          comms           graphics        misc            telephony
archivers       converters      infrastructure  multimedia      tests
astro           databases       inputmethods    net             textproc
audio           devel           japanese        news            www
base            editors         java            plan9           x11
benchmarks      education       korean          print

要从端口安装bash shell(或者按照官方文档中的说明为用户配置适当的文件权限),请执行:

# cd /usr/ports/shells/bash
# make install clean all

如何搜索端口树?

使用以下语法:

$ cd /usr/ports
$ make search key={KEY-WORD-HERE}

要搜索php-gd软件包,请执行:

$ make search key=php-gd

输出示例:

Port:   php-gd-5.5.37p0
Path:   lang/php/5.5,-gd
Info:   image manipulation extensions for php5
Maint:  Robert Nagy <[email protected]>
Index:  lang www
L-deps: devel/t1lib graphics/jpeg graphics/png
B-deps: archivers/bzip2 devel/autoconf/2.69 devel/metaauto www/apache-httpd
R-deps: php-5.5.37:lang/php/5.5
Archs:  any
 
Port:   php-gd-5.6.23p0
Path:   lang/php/5.6,-gd
Info:   image manipulation extensions for php5
Maint:  Robert Nagy <[email protected]>
Index:  lang www
L-deps: devel/t1lib graphics/jpeg graphics/png
B-deps: archivers/bzip2 devel/autoconf/2.69 devel/metaauto www/apache-httpd
R-deps: php-5.6.23:lang/php/5.6
Archs:  any
 
Port:   php-gd-7.0.8p0
Path:   lang/php/7.0,-gd
Info:   image manipulation extensions for php5
Maint:  Robert Nagy <[email protected]>
Index:  lang www
L-deps: graphics/jpeg graphics/png
B-deps: archivers/bzip2 devel/autoconf/2.69 devel/bison devel/metaauto www/apache-httpd
R-deps: php-7.0.8:lang/php/7.0
Archs:  any

您可以使用以下命令安装php-gd-7.0.8p0:

# pkg_add php-gd-7.0.8p0

或者

# cd /usr/ports/lang/php/7.0/
# make install clean