---
# System prepended metadata

title: SA Freebsd Setup
tags: [SA]

---

# SA Freebsd Setup
###### tags: `SA`

## Installation
![](https://i.imgur.com/dirk0RL.png =x360)
* Enable ports. 
* base-dbg can be disabled.

![](https://i.imgur.com/xKCF6Jx.png =x360)
* 4K Sectors can be disabled.

![](https://i.imgur.com/M26493Q.png =x360)
* Enable ZFS.

![](https://i.imgur.com/ZIrE6G1.png =x360)
* Enable sshd to connect to VM via SSH.
* We don't need dumpdev.
* ntpd and ntpdate are required. 

Remove the disk to complete the installation.

## Post-installtation
### sudo
```shell=
su - # Switch to root
pkg install -y sudo vim-console wireguard gnuls
setenv EDITOR /usr/local/bin/vim
echo 'hyperbola ALL=(ALL) ALL' >> /usr/local/etc/sudoers
exit
```

### Surroundings
#### ~/.cshrc
```shell
alias vim    sudo -E vim
alias ls     gnuls -AF --color
alias ll     gnuls -AlF --color
```

#### ~/.vimrc
```shell
:set tabstop=4
:set shiftwidth=4
:set expandtab
:set number
:set statusline+=%F
```

### Wireguard
#### /usr/local/etc/wireguard/sahw1.conf
```
[Interface]
PrivateKey=2LY/QKL4VR7izHrysQeGNO/tmsu5wftmn1sE9jurWk4=
Address=10.113.0.97/25

[Peer]
PublicKey=H3gvGHwK2MIRsqzJCVPzuOJDALcaUtIbl57PSvMFcQw=
AllowedIPs=10.113.0.0/16
Endpoint=savpn.nctu.me:51820
PersistentKeepalive=25
```

#### /usr/local/etc/wireguard/sahw4.conf
```
[Interface]
PrivateKey=AH0pkLzPmR6BYzIvhLC8cDN5xB85X8LDGCTapWtr/VI=
Address=10.113.128.97/25

[Peer]
PublicKey=H3gvGHwK2MIRsqzJCVPzuOJDALcaUtIbl57PSvMFcQw=
AllowedIPs=10.113.0.0/16
Endpoint=savpn.nctu.me:51820
PersistentKeepalive=25
```

### command
```
sudo wg-quick up|down interface
```

