FreeBSD is a free, powerful Unix-like operating system known for stability, performance, and security. This guide covers essential first steps after provisioning a FreeBSD VPS at UnderHost.
## 1. Connect via SSH {#connect-ssh}
Find your VPS credentials in CustomerPanel under **My Services**. Connect using SSH:
```bash
ssh root@your.server.ip
```
Replace `your.server.ip` with your VPS IP address. If prompted, accept the key fingerprint.
## 2. Update the System {#update-system}
FreeBSD uses **freebsd-update** for security updates:
```bash
freebsd-update fetch
freebsd-update install
```
For the ports collection (software packages):
```bash
portsnap fetch
portsnap extract
```
Or update an existing installation:
```bash
portsnap fetch update
```
## 3. Configure PF Firewall {#firewall-basics}
FreeBSD includes **PF** (Packet Filter), a powerful firewall. Check if it's running:
```bash
pfctl -s rules
```
Enable PF at boot by editing `/etc/rc.conf`:
```bash
sysrc pf_enable="YES"
```
Start PF:
```bash
service pf start
```
Edit the PF configuration file at `/etc/pf.conf`. A basic configuration:
```
# Allow SSH
pass in on egress proto tcp from any to any port ssh
# Allow HTTP and HTTPS
pass in on egress proto tcp from any to any port { http, https }
# Block everything else by default
block in all
```
Apply the rules:
```bash
pfctl -f /etc/pf.conf
```
## 4. Create a Non-Root User {#create-user}
Create a regular user for day-to-day tasks:
```bash
adduser
```
Follow the prompts. Add the user to the wheel group for sudo access:
```bash
pw group mod wheel -m username
```
Enable sudo by editing `/etc/sudoers` (use `visudo`):
```bash
visudo
```
Uncomment the line: `%wheel ALL=(ALL) ALL`
Test the new user by switching to it:
```bash
su - username
sudo whoami
```
## 5. Install Software with Ports or Packages {#install-software}
FreeBSD offers two ways to install software: **Ports** (compile from source) or **Packages** (pre-compiled).
**Using Packages (faster):**
```bash
pkg install nginx
pkg install php82 php82-extensions php82-mysqli
pkg install mariadb-server
```
**Using Ports (more customization):**
```bash
cd /usr/ports/www/nginx
make install clean
```
**Web Server (Nginx):**
```bash
pkg install nginx
sysrc nginx_enable="YES"
service nginx start
```
**PHP-FPM:**
```bash
pkg install php82 php82-fpm php82-mysqli
sysrc php_fpm_enable="YES"
service php-fpm start
```
**MySQL/MariaDB:**
```bash
pkg install mariadb-server
sysrc mysql_enable="YES"
service mysql-server start
mysql_secure_installation
```
**Git:**
```bash
pkg install git
```
## Next Steps {#next-steps}
- Configure your web server (Nginx or Apache)
- Deploy your application
- Set up SSL certificates with Let's Encrypt
- Configure regular backups
- Monitor system resources with top or iostat
- Read the [OS Comparison guide](/article/os-comparison/) for other options
- Visit the FreeBSD Handbook: https://docs.freebsd.org/en/books/handbook/
For more help, see our [VPS management guide](/article/manage-vps/) or [contact support](/article/contact-support/).
**Related:** [Getting started with Ubuntu Server on your VPS](/article/ubuntu-server-guide/) | [Getting started with AlmaLinux on your VPS](/article/almalinux-guide/) | [Linux and Windows operating systems for VPS-which to choose](/article/os-comparison/) | [How to choose the right operating system for your VPS](/article/choose-os/)
Was this article helpful?
Need a server with this OS?
Deploy Linux or Windows workloads on an UnderHost Cloud VPS or dedicated server with the operating system that fits your stack.