UNIX-like Family 01-FreeBSD,OpenBSD,NetBSD 简介

[TOC]

About *BSD

BSDFocusingpkg mangertipsdocumentation
FreeBSD性能pkg install、pkg deleter、pkg info、pkg upgrade
OpenBSD安全pkg_add、pkg_delete、pkg_infoexport PKG_PATH= / pkg_add -v URLhttp://www.openbsd.org/faq/faq15.html http://www.openbsd.org/faq/ports/ports.html http://www.openbsd.org/faq/ports/
NetBSD网络pkg_admin、pkg_add、pkg_delete、pkg_info

OpenBSD

OpenBSD 简介[1]

The OpenBSD project produces a freely available, multi-platform 4.4BSD-based UNIX-like operating system. Our goals place emphasis on correctness, security, standardization, and portability.

Article

OpenBSD系统安装

OpenBSD4.4(2008-11-01)的安装方式不同于6.6(2019-10-17),尤其在磁盘分区部分,可以考虑尝试。详情请见我其他关于 OpenBSD的安装.

Article play with action

BSD System Startup Configuration

picture here-Exam 702 711.3 BSD System Startup Configuration

rcctl in OpenBSD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

openbsd66# rcctl
usage: rcctl get|getdef|set service | daemon [variable [arguments]]
rcctl [-df] check|reload|restart|stop|start daemon ...
rcctl disable|enable|order [daemon ...]
rcctl ls all|failed|off|on|started|stopped


# 检查进程状态
rcctl check service_name

# 启用或禁用后台进程
rcctl enable/disable service_name

# 启动或停止后台进程
rcctl start/stop service_name

# 列出进程默认参数
rcctl getdef service_name

# 列出进程相关的参数
rcctl get service_name

# 查看已启动、启动失败进程
rcctl ls started
rcctl ls failed

# 列出当前的顺序
rcctl order

# 把指定的进程d移到第一位
rcctl order d

# 把指定的进程d移到d1和d2之前
rcctl order d d1 d2

# 设置进程参数
# 设置ntpd的flags参数为'-s'
rcctl set ntpd flags -s

# 等价于rcctl enable service_name
rcctl set service_name status on

openbsd66# rcctl disable sshd
openbsd66# rcctl get sshd
sshd_class=daemon
sshd_flags=NO
sshd_rtable=0
sshd_timeout=30
sshd_user=root
openbsd66# rcctl getdef sshd
sshd_class=daemon
sshd_flags=
sshd_rtable=0
sshd_timeout=30
sshd_user=root
openbsd66# rcctl set sshd status pn
rcctl: invalid status "pn"
openbsd66# rcctl set sshd status on
openbsd66# rcctl get sshd
sshd_class=daemon
sshd_flags=
sshd_rtable=0
sshd_timeout=30
sshd_user=root
openbsd66# rcctl disable sshd
openbsd66# rcctl get sshd
sshd_class=daemon
sshd_flags=NO
sshd_rtable=0
sshd_timeout=30
sshd_user=root
openbsd66# rcctl enable sshd
openbsd66# rcctl get ntpd
ntpd_class=daemon
ntpd_flags=
ntpd_rtable=0
ntpd_timeout=30
ntpd_user=root
openbsd66# rcctl set ntpd flags -s
openbsd66# rcctl get ntpd
ntpd_class=daemon
ntpd_flags=-s
ntpd_rtable=0
ntpd_timeout=30
ntpd_user=root

OpenBSD Package Management

pkg package management[2]

Packages can be easily managed with the help of several utilities

  • pkg_add(1) - for installing and upgrading packages
  • pkg_check(8) - for checking the consistency of installed packages
  • pkg_delete(1) - for removing installed packages
  • pkg_info(1) - for displaying information about packages

Selecting a Mirror

There are two places pkg_add(1) will look for packages: the installurl(5) file (/etc/installurl) or the PKG_PATH environment variable. The former is the preferred method and is configured by default on new installations.
If the use of multiple mirrors is needed, PKG_PATH allows this via a colon-separated list:

1
2
3
4
5
export PKG_PATH=scp://user@company-build-server/usr/ports/packages/%a/all:https://trusted-public-server/%m:installpath

# example
export PKG_PATH=https://mirrors.cloud.tencent.com/OpenBSD/6.6/packages/amd64/:https://openbsd.hk/pub/OpenBSD/6.6/packages/amd64/

While the default should work well for most people, a list of alternate locations can be found on the mirrors page.

ports[3][4]

Once you have decided which flavor of the ports tree you want, you can get it from different sources.

1
2
3
4
5
6
7
8
9
10
11
12
13

# Look for a file named ports.tar.gz on the mirrors.

$ cd /tmp
$ ftp https://cdn.openbsd.org/pub/OpenBSD/$(uname -r)/{ports.tar.gz,SHA256.sig}
or
$ ftp https://mirrors.cloud.tencent.com/OpenBSD/$(uname -r)/{ports.tar.gz,SHA256.sig}
$ signify -Cp /etc/signify/openbsd-$(uname -r | cut -c 1,3)-base.pub -x SHA256.sig ports.tar.gz

# You want to untar this file in the /usr directory, which will create /usr/ports and all the directories under it.

$ cd /usr
$ tar xzf /tmp/ports.tar.gz

OpenBSD AnonCVS[5]

Anonymous CVS is a method of keeping your local copy of the OpenBSD source tree up to date with respect to changes made to current OpenBSD sources. In addition to following the bleeding edge of development, it is also possible to track the errata patches of a release.

The OpenBSD Project currently has four active source repositories

  • src - source code for the base system
  • ports - the ports tree
  • www - web pages
  • xenocara - xenocara

cvs(1) was designed to be a simple way to retrieve and update your sources.

OpenBSD upgrade[6]

bsd.rd

According to LPIC-Exam 702, knowing how to upgrade a bsd system is required.

😂 So, it is important.

piceture here-Exam702 bsd installation

OpenBSD network configuration

1
2
3
4
5
6
7
8
9
10
11
12

# 设置IP
/etc/hostname.nic_name

# 设置网关
/etc/mygate

# 设置DNS
/etc/myresolve.conf

# 重启网络
sh /etc/netstart

help manual

  • man trunk

Article

OpenBSD Hardware Configuration

picture here-Exam 702 Hardware Configuration

OpenBSD Kernel Parameters and System Security Level

picture here-Exam702 BSD Kernel Patameters and system Security Level

OpenBSD Storage Devices and BSD Filesystems

BSD Partitioning and Disk Labels

picture here-Exam702 BSD Partitioning and Disk Labels

Create File Systems and Maintain their Integrity

picture here-Exam702 Create File Systems and Maintain their Integrity

Control Mounting and Unmounting of File Systems

picture here-Exam702 Control Mounting and Unmounting of File Systems

Manage User Accounts and Groups

picture here-Exam702 Manage User Accounts and Groups

Mail Transfer Agents(MTA) Basics

picture here-Exam702 Mail Transfer Agents(MTA) Basics

OpenBSD Network

Network Configuration

Network Troubleshooting

Configure Client Side DNS


FreeBSD

NetBSD


  1. https://www.openbsd.org/faq/index.html ↩︎

  2. http://www.openbsd.org/faq/faq15.html ↩︎

  3. http://www.openbsd.org/faq/ports/ports.html ↩︎

  4. http://www.openbsd.org/faq/ports/ ↩︎

  5. http://www.openbsd.org/anoncvs.html ↩︎

  6. https://www.openbsd.org/faq/upgrade66.html ↩︎