1. Setup Development Environment for pfSense FreeBSD port
Ricky Zhang edited this page Dec 18, 2020
·
7 revisions
See link
gpart create -s GPT ada1
gpart add -t freebsd-ufs -a 1M ada1
newfs -U /dev/ada1p1
mkdir /home
add the following to /etc/fstab:
/dev/ada1p1 /home ufs rw 2 2
mount /home
VBoxManage clonemedium "FreeBSD-11.2-rootfs-amd64.vmdk" "FreeBSD-11.2-rootfs-amd64-cloned.vdi" --format vdi
VBoxManage modifymedium "FreeBSD-11.2-rootfs-amd64-cloned.vdi" --resize 102400
VBoxManage clonemedium "FreeBSD-11.2-rootfs-amd64-cloned.vdi" "FreeBSD-11.2-rootfs-amd64-resized.vmdk" --format vmdk
Check/Recover/Resize the rootfs
Ricky@freebsd ~ $ gpart show ada0
=> 3 65013755 ada0 GPT (100G) [CORRUPT]
3 130 1 freebsd-boot (65K)
133 2097152 2 freebsd-swap (1.0G)
2097285 62914560 3 freebsd-ufs (30G)
65011845 1913 - free - (957K)
Ricky@freebsd ~ $ sudo gpart recover ada0
ada0 recovered
Ricky@freebsd ~ $ gpart show ada0
=> 3 209715189 ada0 GPT (100G)
3 130 1 freebsd-boot (65K)
133 2097152 2 freebsd-swap (1.0G)
2097285 62914560 3 freebsd-ufs (30G)
65011845 144703347 - free - (69G)
Ricky@freebsd ~ $ sudo gpart resize -i 3 -s 98G -a 1M ada0
ada0p3 resized
Ricky@freebsd ~ $ gpart show ada0
=> 3 209715189 ada0 GPT (100G)
3 130 1 freebsd-boot (65K)
133 2097152 2 freebsd-swap (1.0G)
2097285 205520763 3 freebsd-ufs (98G)
207618048 2097144 - free - (1.0G)
Ricky@freebsd ~ $ sudo growfs /dev/gpt/rootfs
Ricky@freebsd ~ $ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/gpt/rootfs 95G 18G 70G 20% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ada1p1 97G 18G 71G 20% /home
Resize the disk
-i
partition index
-s
desirable size
-a
align
Remember to add it to wheel group
Add line in /etc/rc.conf: sshd_enable="YES"
Run: service sshd start
ssh-keygen -t rsa
Copy ssh key from gtx host:
[Ricky@gtx .ssh]$ scp authorized_keys bsd:.ssh
Password for Ricky@freebsd:
authorized_keys 100% 15KB 15.8MB/s 00:00
[Ricky@gtx .ssh]$ scp config bsd:.ssh
config
chsh -s /usr/local/bin/bash
If pfSense uses outdated FreeBSD, change the URL /etc/pkg/FreeBSD.conf
to match the FreeBSD version.
pkg install sudo
Modify /usr/local/etc/sudoers
## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL
[Ricky@freebsd ~/script]$ cat install-stuffs.sh
pkg install -y bash
pkg install -y vim-console
pkg install -y git
pkg install -y poudriere-devel
pkg install -y mkfile
pkg install -y rsync
pkg install -y nginx
pkg install -y unbound
pkg install -y screen
pkg install -y the_silver_searcher
pkg install -y htop
pkg install -y tmux
pkg install -y qemu-user-static
pkg install -y subversion
pkg install -y bash-completion
pkg install -y gnupg
pkg install -y coreutils
# For Packet Sorter
pkg install -y libpcap
pkg install -y gmake
pkg install -y gsed
pkg install -y pkgconf
pkg install -y cmake
pkg install -y pkgconf
sudo portsnap auto
cd /usr/ports/security/barnyard2
make
cd /home/Ricky/repo/github/pfsense/FreeBSD-ports/security/barnyard2
make
This will build Barnyard2 and its dependencies. But you need to answer so many option settings dialog.