Notes on Post Installation of FreeBSD

Monday, June 1, 2009

Setting up FreeBSD KDE3 Japanese input

http://www.freebsd.org/doc/en/books/handbook/

Various tips and tricks picked up when trying to install FreeBSD. I am relatively new to BSD. Much of this is copy and pasted directly from the FreeBSD handbook and other sites, forums and posts. Very little content here is of my own composition.

Things to do upon successful installation of FreeBSD.

rc.conf file # ee /etc/rc.conf (paste below)
# Created: Mon Apr 27 20:24:20 2009
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
# -- sysinstall generated deltas -- # Tue Apr 28 05:29:04 2009
#ifconfig_re0="inet 192.168.x.x netmask 255.255.255.0"
#ifconfig_re0="DHCP"
#moused_enable="YES"
#defaultrouter="192.168.x.x"
#hostname="hostname.domainname"
# -- sysinstall generated deltas -- # Mon Apr 27 20:43:31 2009
#linux_enable="YES"
#dbus_enable="YES"
#hald_enable="YES"
#ntpdate_enable="YES"
#ntpdate_hosts="jp.pool.ntp.org"
#new (09-03-2010)

#PPPoE
hostname="freebsd663.domain"
ifconfig_alc0="inet 192.168.1.3 netmask 255.255.255.0"
ppp_enable="YES"
ppp_mode="ddial"
ppp_nat="NO"
ppp_profile="dsl_provider"
hald_enable="YES"
dbus_enable="YES"

/etc/ppp/ppp.conf (paste below)#(lines must be indented after "default: and dsl_provider:"

default:
set log Phase Chat LCP IPCP CCP tun command
ident user-ppp VERSION
dsl_provider:# substitute provider name
set device PPPoE:alc0
set authname 614*****.jp
set authkey password
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
add default HISADDR # Add a (sticky) default route


#add mirror for pkg_add

setenv PACKAGEROOT="ftp://ftp.jp.freebsd.org"


# shutdown -r now

upgrade to RELEASE (if you have RC release candidate )

# freebsd-update upgrade -r 7.2-RELEASE

During this process, FreeBSD Update may ask the user to help by merging some configuration files or by confirming that the automatically performed merging was done correctly.

# freebsd-update install

The system must be rebooted with the newly installed kernel before continuing.

# shutdown -r now

After rebooting, freebsd-update needs to be run again to install the new userland components, and the system needs to be rebooted again:

# freebsd-update install
# shutdown -r now

X windows
# Xorg -configure
(creates /root/xorg-conf-new)
copy to /etc/X11/xorg.conf
# cp /root/xorg-conf-new /etc/X11/xorg.conf

# pkg_add -r kdebase
# pkg_add -r fluxbox

add window manager to ~/.xinitrc
exec startkde
#exec fluxbox etc

$ echo 'exec startkde' >> ~/.xinitrc

To enable kdm, the ttyv8 entry in /etc/ttys has to be adapted. The line should look as follows:
#ee /etc/ttys
ttyv8 "/usr/local/bin/kdm -nodaemon" xterm on secure

$ startx

Ports
(two ways)
either ::

# portsnap fetch
# portsnap extract
# portsnap update

or::

# csup -L 2 -h cvsup.jp.FreeBSD.org /usr/share/examples/cvsup/ports-supfile

To upgrade:

# cp /usr/share/examples/cvsup/ports-supfile /usr/home/ports-supfile
# cd /usr/home
change entry in ports-supfile *default host=cvsup.jp.FreeBSD.org
# csup -P m ports-supfile

various commands regarding sound but just add ** to /boot/loader.conf
# dmesg | grep -i ^pcm
# kldstat
# cat /dev/sndstat
# pkg_add -r aumix // adjusts sound levels
# pkg_add -r xmms // media player
# kldload snd_hda // don't need this if you **

** add to /boot/loader.conf
sound_load="YES"
snd_hda_load="YES" // choose appropriate module for your sound card ( mine is snd_hda )

compile kernel
# cd /usr/src/sys/i386/conf
# mkdir /root/kernels
# cp GENERIC /root/kernels/MYKERNEL
# ln -s /root/kernels/MYKERNEL
# ee /root/kernels/MYKERNEL
# cd /usr/src
Compile the kernel:
# make buildkernel KERNCONF=MYKERNEL
Install the new kernel:
# make installkernel KERNCONF=MYKERNEL

Extras
enable su
# ee /etc/pam.d/su
Look for following line and comment it out:
auth requisite pam_wheel.so no_warn auth_as_self noroot_ok exempt_if_empty

enable back-space delete keys in terminal:

# cd /usr/ports/shells/bash
# make install clean
# cp /usr/compat/linux/etc/inputrc /etc/inputrc
# echo “export INPUTRC=/etc/inputrc” >> /etc/profile
# reboot

How to install flash 10 with native Firefox:

http://crnl.org/blog/2008/11/01/flash-9-for-freebsd-71
http://freebsd.langhans.com.pl/af/index.html

Step 1: Enable Linux compatibility and linprocfs

Add linux_enable="YES" to /etc/rc.conf.
echo 'compat.linux.osrelease=2.6.16' >> /etc/sysctl.conf

echo 'OVERRIDE_LINUX_BASE_PORT=f8' >> /etc/make.conf
echo 'OVERRIDE_LINUX_NONBASE_PORTS=f8' >> /etc/make.conf

to /etc/make.conf.

Add this line to /etc/fstab:

linproc /usr/compat/linux/proc linprocfs rw 0 0

Then run these commands:

mkdir -p /usr/compat/linux/proc
mount /usr/compat/linux/proc
/etc/rc.d/abi start
/etc/rc.d/sysctl start

Step 2: Update ports and install all the needed software

You will now need to install the following ports and their dependencies:

cd /usr/ports/emulators/linux_base-f8 && make install clean
cd /usr/ports/www/linux-f8-flashplugin10 && make install clean
cd /usr/ports/www/nspluginwrapper && make install clean

$ nspluginwrapper -v -a -i

$ nspluginwrapper -l

it should have created a file like this:

/home/username/.mozilla/plugins/npwrapper.libflashplayer.so

Restart firefox and check the Flash sample on: http://www.adobe.com/shockwave/welcome/

ntp time server:

# pkg_add -rv ntp
# ntpdate -v -b jp.pool.ntp.org
# date // to check
File permissions:: Allow read/write on dos partition
/dev/da0s2 /mnt/F msdosfs rw,-m=777 0 0

Fonts

To install the above Type1 font collections from the ports collection, run the following commands:

# cd /usr/ports/x11-fonts/urwfonts
# make install clean
And likewise with the freefont or other collections. To have the X server detect these fonts, add an appropriate line to the X server configuration file (/etc/X11/xorg.conf), which reads:
# cd /usr/ports/japanese/font-kochi/
# make install clean
FontPath "/usr/local/lib/X11/fonts/URW/"
To enable the freetype module for TTF just add the following line to the "Module" section of the /etc/X11/xorg.conf file.
Load "freetype"
# cd /usr/ports/x11-fonts/ttmkfdir/
# make install clean
# mkdir /usr/local/lib/X11/fonts/TrueType
# cd /usr/local/lib/X11/fonts/TrueType
# ttmkfdir -o fonts.dir

To have the X server detect these fonts, add an appropriate line to the X server configuration file (/etc/X11/xorg.conf), which reads:

FontPath "/usr/local/lib/X11/fonts/TrueType/"

After adding new fonts, and especially new font directories, you should run the following command to rebuild the font caches:

# fc-cache -f

Japanese input ref::
# cd /usr/ports/japanese/scim-anthy
# make install clean

add before window manager in ~/.xinitrc

export XMODIFIERS='@im=SCIM'
export LC_CTYPE=ja_JP.UTF-8
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"
scim -d