May 26

Checklist of applications to install

A reference list of all installed apps required for use on FreeBSD 8.0 or later

abiword – Word processing application

aterm – Better alternative to xterm

firefox – browser

fluxbox – window manager

filezilla – ftp client

gcolor2 – color picker utility

gkrellm – system monitoring util

linux-base-f10  – fedora linux compatibility base libraries

linux-f10-flashplugin – flash plugin for firefox and other browsers

mysql 5.x – mysql server and client

apache22 – apache http server

php5.x – php

opera – browser

portsnap – port updater tool

portaudit – port security tool

portmaster – port installer

putty – ssh tool

subversion – svn version control

vim – editor

xpdf – pdf viewer

xnview – image capture and processing utility

ffmpeg – audio/video conversion tool

xmms – mp3 player

mplayer – video player

Selenium – Firefox add-on for automated web testing

siege – web stress testing tool fromn joe dog sofware

May 17

Installing Mysql 5.x

The commands are given below. Though this was used to install mysql 5.5.4 , it is applicable to older versions also (and perhaps newer ones as well).

cd /usr/ports/databases/mysql55-server/
make install clean
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe –user=mysql &
/usr/local/bin/mysqladmin -u root password newpassword

Edit /etc/rc.conf to start mysql server at startup by putting the line

mysql_enable=”YES”

After this, restart FreeBSD.

Apr 23

Setting Background Wallpaper in Fluxbox

First of all you need images to show as wallpaper. You can easily get them from various wallpaper sites on the web. Make sure you store the files in a single directory – you can organize them into sub-directories if there are too many.

Install feh which is an application for viewing images. This is in /usr/ports/graphics .
There are other wallpaper setting applications which can be used:

  • Esetroot
  • wmsetbg
  • feh
  • hsetroot
  • chbg
  • display
  • qiv
  • xv
  • xsri
  • xli
  • xsetbg

Once installed, run fbsetbg (fluxbox set background) . Run it first with fbsetbg -i which makes sure that there is a suitable application to set the wallpaper. You can now set the background wallpaper by using the command

fbsetbg -f /path/to/graphic/file

Eg. fbsetbg -f /var/data/wallpaper.jpg

You can even specify wildcards and fbsetbg will set the first matching file as the wallpaper.

Given below is a sample full-blown fluxbox installation.

screen_lynucs_46828721040bd81f35dc42_2

Apr 21

Installing FreeBSD over an old installation

A crucial part in installing FreeBSD again over a corrupt or existing FreeBSD installation is knowing how to recreate the disk partitions. By default, even if you change the disk geometry and slicing configuration, the actual changes will be written to the disk, only when installation of files is about to start.

In such a case, if your existing partitions have data, you may very well end up with a situation where FreeBSD says that there is not enough space to install the new files.

To make FreeBSD ignore existing data on the disk, once you have completed configuration press W either in the FDisk screen or in the Disk Labelling screen.

FDisk Screen

FDisk Screen

W is not a key that is listed in the help commands but it works. It ‘W’rites the new disk configuration to the disk and thereby invalidates all existing partition configuration and data.
screen_disk_label

FreeBSD will warn you once before committing the Write. For obvious reasons, this step should not be taken if you are installing FreeBSD for the first time in your disk.

Dec 23

Installing PHP 5 on FreeBSD

A tutorial on installing PHP from the FreeBSD ports for Apache and MySQL.

What you need to add to the httpd.conf file and which of the PHP5 ports to choose.

Choosing which port to use
In the past there were several ports for PHP such as /www/mod-php5, /lang/php5-cli, and /lang/php5. Since the release of PHP 5.1.14 there is now only /lang/php5 This port now allows you to choose if you want to install the CLI, CGI, and Apache module.
CLI stands for command line interpreter. It is used for running PHP scripts from the command line and makes creating shell scripts very simple if you already know PHP. The Apache PHP Module is disabled by default, so make SURE that if you plan to use this for web work that you enable it.
Installing the port
Since all PHP ports are now combined you will need to configure it to be sure the parts you need are built.
# cd /usr/ports/lang/php5
# make config
# make install
When you run make config you will be shown a list of options. To use PHP with Apache make sure the Apache Module box is selected.
Once php has installed you will need to install the extra modules for things such as MySQL. These modules are all located in the ports. Some of the most common modules are
/usr/ports/databases/php5-mysql – MySQL Database
/usr/ports/www/php5-session    – Sessions
/usr/ports/graphics/php5-gd – Graphics Library
Adding the PHP 5 module to Apache
Apache needs the following lines in the httpd.conf file to use php. These lines should already be added by the port but if you have problems you should double check your httpd.conf file. Note that Apache 2.x does not need the AddModule line.
# Apache 1.3.x
LoadModule php5_module        libexec/apache/libphp5.so
AddModule mod_php5.c
# Apache 2.x
LoadModule php5_module        libexec/apache/libphp5.so
If you installed using the port and had apache installed already it should do this automatically for you.
Next find your DirectoryIndex section in your httpd.conf file. Apache is set up for PHP 4, but not PHP 5 currently so you will need to modify it and change the 4s to 5s like this.
<IfModule mod_dir.c>
<IfModule mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.php3 index.html
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.php3 index.html
</IfModule>
</IfModule>
<IfModule !mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.html index.htm
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.html
</IfModule>
</IfModule>
</IfModule>
This code is telling Apache to open index.php first you have the PHP 5 module loaded. You can change the order as you wish. Or if you just wanted to skip it you could simply add the following line to the httpd.conf file since you know you are going to have php 5.
DirectoryIndex index.php index.html index.htm
Now apache just needs to know what it should parse the PHP files with. These two lines should be added to the httpd.conf file, and can be put at the bottom if needed.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
If want to use PHP code inside of .htm files you can just add on those extensions.
AddType application/x-httpd-php .php .htm .html
Configuring PHP
Settings for PHP are stored in /usr/local/etc/php.ini You will need to create this file by copying it from /usr/local/etc/php.ini-dist
# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
In this file you can set the memory limit for programs. Turn on global variables if you must, set the max file upload size, and everything else you need.
Testing PHP
Once you have restarted Apache so the changes take effect you are ready to test it. To test it run the following command to create a php file that you can attempt to run
# echo “<? phpinfo(); ?>” >> /usr/local/www/data/test.php
Then point your web browser to http://yourdomain.com/test.php and if it works you will see several pages of information on your PHP settings. If it did not work you will see only the text you typed in.