Making home FreeBSD torrent+NAS server

Basically, it would be a vmware virtual machine.

Why freebsd? Just for fun 🙂 And I have a hope to save some RAM on my home-lab vmware host.

Let’s start..

FreeBSD 11 Installation
1. Download FreeBSD pre-cooked vmdk here:

Un-xz it with 7zip.

2. Create new Freebsd VM and add unpacked vmdk as an existing hard drive.

3. Power on the VM.

FreeBSD Initial Configuration
1. Add root password.
root@:~ # passwd
Changing local password for root
New Password:
Retype New Password:
root@:~ #

3. Add IP
ifconfig em0

4. Permit root login
vi /etc/ssh/sshd_config
Find and uncomment this string:
PermitRootLogin yes

5. Start SSHd
service sshd onestart

Now you should be able to login through SSH.

FreeBSD Configuration
1. Create new file /etc/rc.conf
vi /etc/rc.conf

And add this:
ifconfig_em0="inet netmask" #interface config
defaultrouter="" #gateway
sshd_enable="YES" #enabling sshd autostart
ifconfig_em0_ipv6="inet6 accept_rtadv" #enabling ipv6
rtsold_enable="YES" #enabling ipv6

2. Add DNS servers
vi /etc/resolv.conf

2. Update and upgrade.
freebsd-update fetch
freebsd-update install
pkg update && pkg upgrade

3. Install vmware tools.
FreeBSD 11 seems to be not supported by vmware tools so that I’ve istalled Open VM Tools;
pkg install open-vm-tools-nox11

To run the Open Virtual Machine tools at startup, you must add the following settings to your /etc/rc.conf


Open VM tools is set of four kernel modules (vmemctl, vmxnet, vmblock, vmhgfs) and one daemon (guestd).

vmemctl is driver for memory ballooning
vmxnet is paravirtualized network driver
vmhgfs is the driver that allows the shared files feature of VMware Workstation and other products that use it. This is not optimal to use on server therefore we do not enable it.
vmblock is block filesystem driver to provide drag-and-drop functionality from the remote console.
VMware Guest Daemon (guestd) is the daemon for controlling communication between the guest and the host including time synchronization.

Reboot your system.

Installing SAMBA and Transmission

1. Configure timezone and setup time autosync
cp /usr/share/zoneinfo/Europe/Kaliningrad /etc/localtime; ntpdate;
echo '0 0 * * * /usr/sbin/ntpdate' >> /var/cron/tabs/crontab && crontab /var/cron/tabs/crontab

2. Add ports collection to your system
# portsnap fetch
# portsnap extract

3. Install “screen” terminal manager.
cd /usr/ports/sysutils/screen/ && make install clean

4. Optimize compiler for the best performance.
Create /etc/make.conf
CFLAGS= -O3 -pipe -funroll-loops
COPTFLAGS= -O2 -pipe -funroll-loops
#turn off graphic for server

5. Create screen session and start samba installation
cd /usr/ports/net/samba46/ && make -DBATCH install clean

*screen will save your terminal session so that you could reconnect to it anytime by typing screen -r
**-DBATCH will tell the ports system that you are “batch-builing” ports and won’t be hanging around to answer config questions. It will use the default options for any ports that need configuring.

6. Add SAMBA to autostart
echo 'samba_server_enable="YES"' >> /etc/rc.conf

7. Start transmission torrent client installation
cd /usr/ports/net-p2p/transmission/ && make -DBATCH install clean

6. Add transmission to autostart
echo 'transmission_enable="YES"' >> /etc/rc.conf

Configuring SAMBA and Transmission

1. Add SAMBA config

vi /usr/local/etc/smb4.conf
workgroup = WORKGROUP
server string = Samba Server
log file = /var/log/samba4/log.%m
max log size = 500
socket options = TCP_NODELAY
os level = 1
map to guest = Bad Password
comment = Public Folder
path = /data
public = yes
writable = yes
guest ok yes
read only = no
create mask = 0777
directory mask = 0777

2. Make data dir
mkdir /data && chmod 777 /data

3. Start SAMBA
service samba_server start

Now you can try it:

4. Configure Transmission
Edit the configuration:

vi /usr/local/etc/transmission/home/settings.json
"rpc-bind-address": "",
"rpc-whitelist-enabled": false,
"download-dir": "/data",

5. Start it
service transmission start

Now you can access it through web interface by typing in your browser:

Site Footer

Sliding Sidebar

About Me

About Me

About Me

IPv6 Certification Badge for mvyudin