FreeBSD survival manual

BSD is a very stable and secure UNIX operating system. BUT:
(On Jan 11th 2020) FreeBSD doesn’t well support Docker. This disadvantage will deter the testing procedure and deployment procedure. Spending lots of time learning this OS is not suggested now. If there is some time left, going to explore Kali Linux, Black Arch, RHEL, MacOS is more valuable.

Virtual machine environment

Try FreeBSD virtual machine on Linux.

Check kvm support

1
2
lsmod|grep kvm
lsmod|grep virtio

If not started, use sudo modprobe to load module.

1
2
3
4
wget http://mirrors.ustc.edu.cn/freebsd/releases/VM-IMAGES/12.0-RELEASE/amd64/Latest/FreeBSD-12.0-RELEASE-amd64.qcow2.xz
cp FreeBSD-12.0-RELEASE-amd64.raw.xz FreeBSD-12.0-RELEASE-amd64-copy.raw.xz
xz -d FreeBSD-12.0-RELEASE-amd64.raw.xz
xz -d FreeBSD-12.0-RELEASE-amd64-copy.raw.xz

create a shell scrpt for starting two virtual machines:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
qemu-system-x86_64 -enable-kvm \
-m 1G -name FreeBSD \
-drive file=FreeBSD-12.0-RELEASE-amd64.raw,index=1,media=disk,format=raw \
-chardev socket,path=/tmp/port1,server,nowait,id=port1-char \
-device virtio-serial \
-device virtserialport,id=port1,chardev=port1-char,name=org.freebsd.port.1 \
-net user,hostfwd=tcp::10022-:22 \
-net nic

qemu-system-x86_64 -enable-kvm \
-m 1G -name FreeBSD2 \
-drive file=FreeBSD-12.0-RELEASE-amd64-copy.raw,index=2,media=disk,format=raw \
-chardev socket,path=/tmp/port2,server,nowait,id=port2-char \
-device virtio-serial \
-device virtserialport,id=port2,chardev=port2-char,name=org.freebsd.port.2 \
-net user,hostfwd=tcp::20022-:22 \
-net nic

Link with the command:

1
2
ssh -p10022 wsd@localhost
ssh -p20022 wsd@localhost

Configure pkg and ports source

1
2
3
su
mkdir -p /usr/local/etc/pkg/repos
vi /usr/local/etc/pkg/repos/FreeBSD.conf

FreeBSD.conf

1
2
3
FreeBSD: {
url: "pkg+http://mirrors.ustc.edu.cn/freebsd-pkg/${ABI}/quarterly",
}
1
pkg update -f
1
vi /etc/make.conf

make.conf

1
2
3
4
MASTER_SITE_OVERRIDE?=\
http://mirrors.ustc.edu.cn/freebsd-ports/distfiles/${DIST_SUBDIR}/\
http://mirrors.163.com/freebsd/ports/distfiles/\
http://mirrors.aliyun.com/freebsd/ports/distfiles/
1
2
portsnap fetch
portsnap extract

Portsnap updating command is portsnap update

Once done you will find new directory tree under /usr/ports/.

C++ examples of leveldb Linux Troubleshooting

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×