You are currently viewing First Steps with FreeBSD

First Steps with FreeBSD

I’ve decided that I want to learn a bit more about the BSD’s of today’s world.

Why? Well you see in my day-to-day I encounter a lot of ESX a bit of Windows and some Linux.  But a lot of hardware like a Force 10 switch a Compellent SAN or an Equallogic SAN appears to be running BSD under the hood.  While I’m comfortable enough with those environments there is always scope to learn.

As an aside I’ve noticed very low memory usage on a fresh FreeBSD install, so given say 4 VM’s with 256MB of RAM each I think you could quite easily provide all the required services (DHCP, DNS, LDAP, NFS) in a small amount of space and based on usage even drop the memory for each machine even lower.  Yea sure I could just buy a bigger SO-DIMM for my laptop but then what would I learn.

So I’ve started with one VM with 2x CPU’s and 512MB of RAM lets see what basics we can learn.

  1. Logging in as a user would not let me switch to root.  Solution, use vim to edit /etc/groups and add the user to the group wheel.
  2. What IP should I be connecting my ssh session too, ifconfig comes up with the goods

    root@jailhouse:~ # ifconfigem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM> ether 00:0c:29:00:c3:e0 inet 192.168.193.137 netmask 0xffffff00 broadcast 192.168.193.255 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT <full-duplex>) status: active

  3. How to update, issuing the command “freebsd-update fetch” returns an error about Fetching public key from updateX.freebsd.org failed.  So lets have a look at /etc/freebsd-update.conf shows everything is fine and also I can ping the server.  A quick google tells me that i’m running bsd-current which is effectively a future release.  People running bsd-stable (this should be called current but its called stable) can use freebsd-update.  So I’ll revisit this after I’ve had a chance to digest http://www.bsdnow.tv/tutorials/stable-current
  4. I selected dhcp when I installed, I want a fixed address now, so add a line like this ifconfig_em0=”inet 192.168.193.50 netmask 255.255.255.0″ and comment out the line ifconfig_em0=”DHCP” by placing a hash in front of it.  Then restart the interface with service netif restart and reconnect your ssh client to the new address.
  5. I can’t get on the internet now, so in rc.conf I also had to add my gateway defaultrouter=”192.168.193.2″ and also issue service routing restart  for the change to take effect.
  6. How do I install software?  pkg search mariadb, pick the package you want and pkg install  mariadb100-server, you can leave out the version number
  7. How do i find what the service is called and start it?  service -l lists all init scripts.  One on this list is called mysql-server, so service mysql-server onestart will get it going (just once), if we want to be able to issue start|stop|restart and also have it come up at boot we need to go to rc.conf and set mysql_enable to YES.   So with use vim /etc/rc.conf and add a line like this mysql_enable=”YES”
  8. We reboot with reboot, and shutdown with poweroff
  9. Checking everything works as it should after the reboot and it does

I have to say apart from the updates (my fault for going with Current and not Stable) this is all very straightforward and logical to this point.  Next on my todo list it to try out other services like apache, nfs, etc and see how small the test environment footprint could be.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.