FreeBSD

Introduction

FreeBSD is a high performance operating system that is suitable for a variety of server roles. This article will cover some common system administration tasks with a FreeBSD server.

Environment

root@:/home/will # uname -a</code>
FreeBSD  10.2-RELEASE FreeBSD 10.2-RELEASE #0 r286666: Wed Aug 12 19:31:38 UTC 2015     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  i386

Install

System Config

Boot Loader

/boot/loader.conf

autoboot_delay="0"

Network

/etc/rc.conf

ifconfig_em0="inet 192.168.249.170 netmask 255.255.255.0"
defaultrouter="192.168.249.2"
hostname="freebsd.vmg"

/etc/resolv.conf
server 192.168.249.2

Services

ssh server

1. server auto start
/etc/rc.conf
sshd_enable="YES"
2. config file
/etc/ssh/sshd_config

AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
AuthenticationMethods publickey

3. public key

mkdir .ssh
vi .ssh/authorized_keys
chmod 0600 .ssh/authorized_keys

4. start/stop
service sshd start/stop/status

NFS

1. setup
/etc/rc.conf

nfs_server_enable="YES"
nfsv4_server_enable="YES"
nfsuserd_enable="YES"

2. share
/etc/exports
V3:

/var/nfs -ro

V4:

V4: /
/

3. service start/stop
there's a bug when restart, you need to reload mountd manually. otherwise the share won't be aviable
service nfsd start/stop/restart
/etc/rc.d/mountd reload
4. inspect

linux-qxrh:/home/will # showmount -e 192.168.249.170
Export list for 192.168.249.170:
/var/nfs (everyone)

5. mount
Local
mount -t nfs localhost:/var/nfs /mnt
Remote
mount -t nfs -o nfsvers=3 192.168.249.170:/var/nfs /mnt