Tag Archives: guide

Switching from MD5 to Blowfish/SHA512 password hashes in FreeBSD

By default, FreeBSD uses MD5 hashes for its encrypted passwords for users (SHA512 for FreeBSD 9.1+).  However, blowfish is available in all recent versions of FreeBSD and it’s really easy to change the default…

edit the file /etc/login.conf and change the following line:

:passwd_format=md5:\

To read the following:

:passwd_format=blf:\

Then rebuild the login database with the following command:

cap_mkdb /etc/login.conf

Now all passwords you change or set when adding a user will be encrypted using blowfish.  You can change your current password with passwd and when changed, your password will be blowfish encrypted.

If your system uses MD5, it’s preferrable to change over to Blowfish as it’s more secure… However, if your system supports SHA512 you should prefer this (passwd_format=sha512) – except for very few situations. (SHA512 is supported in FreeBSD 9.1+ only)

DirectAdmin requires the system to use md5 not blowfish or sha512, otherwise you will never be able to login to your DA web console.

 

Installing Flash Plugin 10 for Firefox in FreeBSD 8

Flash is annoying.  Adobe seem to have forgotten that other operating systems exist outside of windows, mac and linux.  Because of this, we have to use the linux-based flash plugin for FreeBSD.

However, this is (mostly) easy enough to configure if you know how.  Here’s a guide to do it.

First of all, update your ports tree (see other posts on my blog on how to do this)

Next we need to install the linux compatibility base system (if you haven’t already) – to do this, type the following as root:

cd /usr/ports/emulators/linux_base-f10
make install distclean

This will take a while as it installs a few helpers (like rpm), and downloads many linux RPM packages.

Once it is complete, we can install the linux flash plugin by typing:

cd /usr/ports/www/linux-f10-flashplugin10
make install distclean

This will fetch the linux flash plugin.  If it complains about size mismatches or MD5 checksum failures, then you have likely not updated your ports tree like you were told!

Once this is installed, we need to install a plugin wrapper to make it work… To do this, we type:

cd /usr/ports/www/nspluginwrapper
make install distclean

Now we need to make a quick file link.  To do this, type the following:

cd /usr/local/lib/browser_plugins/
ln -fs /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so

Ok, just one final step now (honest!).  For each user that you want to use the plugin, open a terminal as that user and DO NOT “su root”.  Then type:

nspluginwrapper -v -a -i

If all is well, you’ll see some mention of flash.  Next time you open firefox, flash will be enabled and fully working – including sound.

Feel free to complain to Adobe about the existence of other Operating Systems 🙂

Updating the ports tree in FreeBSD 8

After you have installed your system, you will no doubt want to update your ports tree regularly.

To do this, edit/create a file called /root/bsdports which contains the following:

*default tag=.
*default host=cvsup2.us.freebsd.org
*default prefix=/usr
*default release=cvs delete use-rel-suffix compress

ports-all

You should change the host “cvsup2.us.freebsd.org” to be one of your local mirrors.  You can see a list of mirrors at http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvsup.html#CVSUP-MIRRORS

Now to update your ports tree, type:

csup /root/bsdports

This takes quite a while, and will report any files it is updating as it goes.  Once it completes, your ports tree will be up to date.

Loading soundcard drivers in FreeBSD

By default, FreeBSD does not load any sound card drivers for you.

However, almost all soundcards are supported.  First you need to identify your soundcard.  You can do this with:

pciconf -lv | more

This shows a list of PCI devices in your system.  You are looking for a device which has a “class” of “multimedia”.

Mine, for example, shows the following:

none0@pci0:0:27:0:      card=0x022e1028 chip=0x284b8086 rev=0x02 hdr=0x00
vendor     = ‘Intel Corporation’
device     = ‘Intel audio controller embedded with the 82801H chipset ( ICH8 chipset ) (82801H)’
class      = multimedia
subclass   = HDA

If “subclass” says “HDA” (most new soundcards do) then the driver you will need later is snd_hda.  If not, most likely you will want the snd_ich driver.  If your system is really old, you may need another driver – check the list of drivers available by typing:

ls -al /boot/kernel/snd_*.ko

and select the one that looks most promising.

To test the driver is correct, we need to manually load it.  Do this with the following command:

kldload snd_hda

(substitute snd_hda with your required driver)

If all is well, your console screen (or type tail /var/log/messages if you’re not using the console – e.g. if you’re using SSH) will show a few messages about “pcm”.  If the driver is incorrect, nothing will be shown.

If you’re happy with your selection, we need to tell FreeBSD to load the driver on boot every time.  Edit the file /boot/loader.conf and add:

snd_hda_load=”YES”

If you’re using another driver (e.g. snd_ich) then alter the above line to match the driver name followed by _load=”YES”

Everytime you reboot, your computer will load the driver automatically.

Installing gnome GUI on FreeBSD 8

Most people seem to think installing a GUI on FreeBSD is a difficult task.  Here’s how to do it, including little tweaks to make it work even better 😉

Login to your computer as root (or su to root from a regular user)

Use your favourite editor (check my blog for instructions on using ‘ee’ which is included in FreeBSD) to edit /boot/loader.conf – add the following lines:

linux_load=”YES”

linprocfs_load=”YES”

atapicam_load=”YES”

This will load the linux compatibility layer, and linux procfs compatibility modules (these will most likely be used later when you need to install flash plugins) and also the ATAPI scsi emulation driver.  This is used for cd/dvd recording tools within gnome.

Next make sure that the linux proc folder exists by typing:

mkdir -p /compat/linux/proc

And now we will edit the /etc/fstab file.  Add the following lines if they do not exist already:

proc /proc procfs rw 0 0

linproc /compat/linux/proc linprocfs rw 0 0

Next, we will tell FreeBSD to initialise the linux compatibility layer on boot-up.  Edit /etc/rc.conf and add:

linux_enable=”YES”

Ok, now you’re ready to install gnome.  Make sure you’re connected to the internet, and type:

pkg_add -r xorg gnome2

This will install xorg (if needed) and gnome.  It will fetch all dependencies it needs, so it may take a while.  You will be returned to a prompt when it’s finished.

Now to help things move along smoothly, you need to find out your computer’s hostname and add it to your hosts file…  Run the following command to get your hostname:

hostname

Next edit /etc/hosts and add the following line at the bottom (replace ‘hostname’ with the output of the above command):

127.0.0.1 hostname

Now just one thing left to do, and that is to tell FreeBSD to load the gnome components next reboot… Edit /etc/rc.conf and add:

gnome_enable=”YES”

hald_enable=”YES”

gdm_enable=”YES”

dbus_enable=”YES”

reboot, and you will be presented with the gnome login prompt 🙂

Step-by-Step guide to install FreeBSD 8.1

A few people have asked me recently how to install FreeBSD 8.1.  A few managed it by themselves, but using auto defaults which can cause various problems.  So I decided to publish this guide.  It uses the simplest method for users (not always “the best”, but certainly working) – I have taken screenshots throughout the entire process to assist you in installing.

First of all, download and burn the installation CD (disc1) or DVD (dvd1) image from your nearest FreeBSD mirror.  For our purposes, there is no difference between the two images.

Boot from the CD/DVD, and you will reach the following screen:

Choose your language from the list.  As i’m in the UK I will select United Kingdom with the cursor keys, and press Enter.  You will see the next screen:

You need to select your keyboard layout here.  I will choose UK ISO for me and press Enter.  This will bring us to the next screen:

Select ‘Standard’ from the menu and press enter to move to the next screen:

This is just an information screen so press enter to move to the next screen:

NOTE: you will only see this screen if you have more than one disk drive in your computer.  If you do not see this screen, skip to the next screenshot.

Select the first disk (either ad0 or ad4 or da0 depending on your computer setup) using the space bar to go to the next screen (if you have a single disk only, you will automatically go to the next screen):

If you are using an existing disk, you will have more than one line shown here.  Use the cursor keys to go down to all the entries and press D to delete them.  Repeat until you only have one line (unused).  Press A for use entire disk followed by Q to go to the next screen.  (If you have multiple disks, you will go back to the previous image – press TAB then enter to continue to the next screen if so)

This page allows you to select a boot manager.  You don’t need a boot manager for FreeBSD, so choose ‘Standard’ and press enter to continue to the next page:

This is an informational page again, press enter to continue to the next screen:

This is where most people choose Auto defaults – but this is almost always not suitable for you.  Instead, press C to create which goes to this screen:

Delete the number with the backspace key.  We need to enter a suitable value for swap space here.  Take your memory size to the nearest 1GB and double the figure. (e.g. if you have 1GB ram, use the figure 2G) – note you must only put G not GB.  press enter to go to this screen:

Use the cursor keys to go to “Swap” and press enter.  This will take you back to the black screen again.  Press C again to go to this screen:

Leave the number that is given in the box for you and press Enter to go to the next screen:

Select “FS” and press enter to go to the next screen:

Enter “/” into this box and press enter to go back to the black screen.  On this screen, use the cursor keys to go down to the entry listed as mount “/” and press the S key.  You will see the newfs item change to “UFS+S” like this image:

On this screen, you should now just have the “swap” and “/” entries.  Press Q to continue to the next step:

Use the cursor keys to go down to “Custom” and press the space bar to continue to the next step:

Using the cursor keys and space bar, select the following items on this page: base, lib32, man, catman, proflibs, ports, kernels. When you press space on “kernels”, you will be shown this screen:

Go down to GENERIC and press space, then back up to Exit and press space.  This will return you to the previous screen.

Select SRC using the space bar, when you do, you will be shown the following screen:

Go down to ALL and press space to select all items, then go to Exit and press space to return to the previous screen like this:

Go back up to Exit at the top of the page and press space to move onto the next step:

Go up to Exit and press space to move onto the next page:

Select CD/DVD here and press enter to move to the next step:

Ok, up to this point you haven’t made any changes to your disks.  This is your last chance (as it says) to change your mind.  Press enter to start formatting your drives:

After formatting (only takes a minute or two – similar to a quick format), you will see the following page as it installs files:

Once all the files have been copied, it will start to install the ports collection.  This has no progress bar and will take a while so be patient.  The screen looks like so:

Once everything is installed, and ports copied over – it will confirm the installation with the following page:

Press enter to move onto the post-installation questions.  You will enter the next step:

This will allow you configure WIRED networking (if you have wireless networking and do not wish to configure a wired network select NO here!)

If you would like to configure wired networking, select yes and press enter to move to the next step:

Your network card(s) will be shown here.  Network card names depend on your specific card.  If you have multiple network cards, you will see multiple lines here.  Ignore the plip0 device.

Select the network card you wish to configure and press enter to go to the next step:

Select NO here and press enter.  (If you want to use IPv6, enable it after installation).  This will bring you to the next step:

If your network uses DHCP for IP assignments, select YES and continue.  Otherwise select NO for static configuration.  The next page is identical regardless of which you choose – except with DHCP it will part-fill out IP addresses for you as given by DHCP.  The next page looks like this:

Fill out the host name and press tab.  This will auto-populate the domain section unless DHCP already did it for you.  If you chose not to use DHCP (or no DHCP servers were found), you will need to fill out gateway, nameserver, ip address and netmask fields.  Use the tab key to move between fields.  When done, tab until OK is highlighted and press enter to move onto the next screen:

Select NO here and press enter to move to the next step:

Select NO and press enter to move to the next step:

If you require access from outside of your computer (e.g. if it is a server, or if you like to remote access it from other computers etc), select YES here.  Otherwise select NO.  Either choice will move to the next screen:

Select NO here and press enter to continue to the next step:

Select NO here as we can configure this later if you want to use it.  This will continue onto the next stage:

Select NO here to move onto the next step:

Select YES here as we want to configure our console settings to something a little nicer.  This will move onto the next page:

Move down to FONT and press space to move to the next page:

Select the best font for you.  For me, this is IBM 437.  Press enter to return to the previous page.

Select KEYMAP and press space to move to the next page:

Select the best codepage for you.  For me, this is UK ISO.  Press enter to return to the previous page.

Select REPEAT and press space to move to the next page:

Select FAST and press enter to return to the previous page.

Select SCREENMAP and press space to move onto the next page:

Select the best screenmap for you.  For me, this is ISO 8859-1 TO IBM437.  Press enter to return to the previous screen.

Move up to EXIT and press enter to move onto the next page:

Select YES to set our timezone, this will move onto the next screen:

Select NO here to move onto the next screen:

Select your region from the list.  For me, this is EUROPE.  Press enter to go to the next screen:

Select your country/region from the list.  For me, this is UNITED KINGDOM.  Press enter to move to the next screen:

Check the timezone abbreviation is correct and say YES if it is.  For me, this is BST or GMT depending on summer time.  If you select NO you will go back to the previous page to reselect.  Selecting YES moves to the next step:

Select YES to move to the next step:

Don’t bother selecting any details in this page (they will be autodetected) – just go to EXIT and press enter to move to the next screen:

Select NO so that we do not install any packages.  This will move to the next page:

Select YES to add a user to the system.  This will move onto the following page:

Move down to USER and press enter to move onto the next page:

Add your username (all in lowercase) and use TAB to move between fields.  Enter a password and confirm in the relevant boxes.  In ‘Member groups’ put wheel (in lowercase).  Your home directory will automatically be set based on your login id.  The default shell is /bin/sh however I prefer /bin/tcsh.  TAB to OK and press enter to continue.

This will go back to the add user menu, select EXIT and press enter to move onto the next page:

Select OK to set a new root password for your computer.  The screen will look like this:

Enter your new root password twice to continue to the next page:

Select NO to continue to the next screen (the original installation screen):

Use the right cursor key to select EXIT INSTALL and press enter to continue.

Select YES to confirm you want to reboot.

Remove the CD/DVD from the drive and press ENTER to reboot.

When the computer as rebooted (assuming no problems) you will be presented with a login prompt like this:

Your computer is now installed and ready to use.  See my other posts for information on how to perform other tasks.

I hope this helps anyone hoping to install FreeBSD, and I welcome any questions.