First and most importantly we need to setup a root password. Type the following command:
passwd
Type in your password twice at the prompt. From now on when you login as root you will have to enter that password. Of course, this is the only time you'll ever log in as root. Root is the "administrator" account for your FreeBSD system. Configurations and installations are done with root. However, root is quite powerful and you most certainly will inadvertently mess up your system. So you'll only use root when necessary. And you'll do so with the 'su' command. It lets you become root temporarily, for the purpose of installations, and the you can exit back to your user again.
Now it's time for us to setup that user account. This is the command you'll need to use to do so:
pw user add -n xaenn -c "Dan Reinholz" -g wheel -m -h 0
The command might look a little complicated, but it's actually quite simple. pw is used for modifying groups and users on the system. xaenn is the name of the user we are creating. "Dan Reinholz" is the users full name, that being me. We also want to add xaenn to the group wheel, in order to have the ability to 'su' from the xaenn account. In order to create xaenn's home directory we add "-m." Finally "-h 0" prompts us for a password so we can set one up for this account. You'll only be prompted once for the password, so type it in carefully. In case you mess up and want to start over with your user, you can type the following command:
rmuser xaenn
That will delete xaenn from the system so you can try again.
The next step for us is to setup networking. Type the following command:
ifconfig
It is similar to the command "ipconfig" from Windows. It will output some text to the console that will look similar to this:
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=8<VLAN_MTU>
inet 192.168.1.100 netmask 0xffffff00 broadcast 255.255.255.0
inet6 fe80::20d:61ff:fe04:bc4d%rl0 prefixlen 64 scopeid 0x1
ether 00:0d:61:04:bc:4d
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
As you can see there are three entries in mine: rl0, plip0, and lo0. Don't worry about plip0 and lo0, they aren't ethernet cards, and you will have them as well. The first entry rl0 is my ethernet card. It uses a realtek chipset, hence the rl. You will have something similar to that for your ethernet card. If you have multiple cards, choose the one you want to use. We'll setup the card to use DHCP now. Unless you use a static ip address for your computer, these directions are fine. If you do use a static ip address, click here. If you don't know about static ip addresses, then continue as you most likely use DHCP.
vi /etc/rc.conf
vi is the text editor that comes with FreeBSD. It is a modal editor, with a command mode and text insertion mode. It has many advanced features, but we will not get into them here. In order to enter text, scroll down to the last line of the file with the arrow keys. If this line is blank hit 'i' to enter text. Otherwise hit 'o' in order to open a new line. Now that you're in text entering mode type the following:
ifconfig_rl0="DHCP"
hostname="bsd.domain.actdsltmp"
Replace "rl0" with whatever ethernet device you obtained from ifconfig. The second line is setting your hostname. "bsd" is the name of the computer, and "domain.actdsltmp" is the domain name. If you are on a LAN you should choose the same domain name as other computers on the LAN. Otherwise choose whatever you want. Now hit 'ESC' to get back to command mode. If you typed it in correctly hit 'ZZ' to save and exit the file. If not hit 'dd' to delete the entire line and start over again. Now we'll restart dhclient, in order to obtain an ip address and get connected to the internet.
dhclient rl0
Replace rl0 once again. Now let's hope that everything is working correctly with your ethernet device, and that we're connected to the internet. In order to test this we'll use a command called "ping."
ping -c 3 www.yahoo.com
We just sent 3 packets to www.yahoo.com to see if we get a response. If you have a valid connection, you should see a few lines of text, followed by a short summary telling you that 3 packets were sent and 3 packets received, with 0% packet loss.
PING www.yahoo.akadns.net (68.142.197.66): 56 data bytes
64 bytes from 68.142.197.66: icmp_seq=0 ttl=53 time=81.668 ms
64 bytes from 68.142.197.66: icmp_seq=1 ttl=53 time=80.671 ms
64 bytes from 68.142.197.66: icmp_seq=2 ttl=53 time=82.062 ms
--- www.yahoo.akadns.net ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 80.671/81.467/82.062/0.585 ms
If, on the other hand, you receive a message like "3 packets transmitted, 0 packets received, 100% packet loss", that means you're not really connected to the Internet. Troubleshooting your connection problems is a bit out of the scope of this configuration, but there are a few things to try. First make sure you have a compatible network card (FreeBSD network card support is in general pretty good), make sure your Cable/DSL modem is working properly, and if all else fails try posting to some FreeBSD user forums. However, if you happen to have Qwest DSL and an Actiontec gateway ("gateway" is also referred to as a "modem"), we have created a section just for solving your internet woes.
We'll assume that you've gotten online at this point. Now we'll setup the clock.
cd /usr/share/zoneinfo
ls
That command will list the possible time zone options you have. Choose whichever continent corresponds to your location. We chose America.
cd America
ls
Now we need to choose the city in our timezone. For us it was Denver.
cp Denver /etc/localtime
Now we will synchronize our clock with NASA.
ntpdate ntp.nasa.gov
Now we can set our system up so that our clock will be synchronized automatically at boot time.
vi /etc/rc.conf
Enter the following lines:
ntpdate_enable="YES"
ntpdate_flags="-b ntp.nasa.gov"
As long as we're in rc.conf let's add a few more lines:
sendmail_enable="NONE"
hald_enable="YES"
moused_enable="NO"
moused_nondefault_enable="NO"
Unless you're running a mailserver, you do not need sendmail. We are a bit baffled why it is turned on by default. Disabling sendmail will save us a little time when we boot up FreeBSD in the future. The last 3 lines are necessary if you want to be able to use your mouse while in X11 (graphical mode)!
This task is of the utmost importance.
vi /boot/loader.conf
Add these lines:
loader_logo="beastie"
autoboot_delay="5"
Let's just say you should be pleased when you reboot. The second line will decrease the timer at the boot screen from 10 to 5 seconds. There is only one final task:
vi /etc/sysctl.conf
Add one line:
kern.coredump=0
That will turn of coredumping, which is used for debugging programs when they crash. Not something we are qualified to do. With that we've finished the most essential post-installation tasks. Next we'll setup ports, one of the greatest things about FreeBSD. Before doing so however, we recommend that you logout as root, and back in as your user.
exit
Now you're back to the login prompt so become your user. Once you've logged in as user type in the following:
su
Type in your root password now. You may feel it is a bit redundant to logout and back in just to su to root, however we want to emphasize the importance of only su'ing to root, and not logging in as root from the get go. Now we can continue.
Return to our Previous Section Continue on to our Next Section