Wednesday, 17 October 2012

Color Terminal on freeBSD/OpenBSD

This is how to get color on your freeBSD or openBSD terminal.

for freeBSD user please follow
#cd /usr/ports/misc/gnuls
#make install clean

for openBSD user please follow
#pkg_add -r http://ftp.openbsd.org/pub/OpenBSD/5.1/packages/amd64/gnuls-4.1p2.tgz

$vi ~/.profile (if you are using csh) or $vi ~/.bash_profile

FreeBSD users:
-----
alias ls="gnuls --color =always"
-----

OpenBSD users:
----
alias ls="gls --color=always"
----

Tuesday, 16 October 2012

Build OAMP Server on OpenBSD from tarball

OAMP is stands for OpenBSD Apache MySQL and PHP.

In this blog, I'm trying to use the latest version on each software, however for PHP  I'll use 5.3.x instead of 5.4.x, since it has some issue make the PHP 5.4.x not able to be compiled on openBSD. I'll use the MySQL which comes comes from openBSD it self.

However, this tutorial will works on Linux machine as well.

1.First download all the tarball first.
#mkdir -p /usr/local/source
#cd /usr/local/source
#wget http://apache.mirror.rafal.ca//httpd/httpd-2.4.3.tar.gz
#wget http://www.php.net/get/php-5.3.17.tar.gz/from/a/mirror

2.Once it's done, untar both of the tarballs, by executing the command below:
#tar -xzvf httpd-2.4.3.tar.gz
#tar -xzvf php-5.3.17.tar.gz
#cd httpd-2.4.3
# ./configure --prefix=/usr/local/apache2 --enable-so --enable-cgi --enable-info --enable-rewrite --enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic
#make && make install
#cd ../php-5.3.17
#./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --prefix=/usr/local/apache2/php --with-config-file-path=/usr/local/apache2/php --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --enable-zip --with-gettext --with-curl
#make && make install

3.Copy and edit the following file
#cp -p .libs/libphp5.so /usr/local/apache/modules
#cp -p php.ini-recommended /usr/local/apache/php/php.ini

vi /usr/local/apache2/conf/httpd.conf
---
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
DirectoryIndex index.html index.php
AddType text/html .php
---

4.Edit the following files
#cd /usr/sbin/
#mv apachectl{,.bakcup}
#mv httpd{,.bakcup}
#ln -s /usr/local/apache2/bin/apachectl /usr/sbin/apachectl
#ln -s /usr/local/apache2/httpd /usr/sbin/httpd

#vi /etc/rc.conf
---
...
httpd_flags=""
...
---

5. Test the apache configuration and run it.
#/etc/rc.d.d/apache configtest
#/etc/rc.d/apache restar

FreeBSD DESKTOP

I would assume the freeBSD installation already done. And you have one extra user account.

1. We need to upgrade the port
#portsnap upgrade
#portsnap extract

2. I would like to use bash and I like to use the latest bash. If you dont wish to use bash you can ignore step 2 and 3. Download it from here.
#mkdir -p /usr/local/source
#cd /usr/local/source
#fetch http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
#tar -xzvf bash-4.2.tar.gz
#cd bash-4.2
#./configure
#make && make install clean

3.Set the shell become bash
#chsh -s /usr/local/bin/bash username
#chsh -s /usr/local/bin/bash root
#cd /bin
#mv bash{,.original}
#ln -s /usr/local/bin/bash bash => to replace the default bash with bash 4.2 if you already previous bash. you can ignore this part if you have a fresh installation.

4. set "su -" and sudo on the user account
#pkg_add sudo
#visudo
---
...
%wheel ALL=(ALL) NOPASSWD: ALL
...
---
#pw user mod username -G wheel

5.Installing Xserver, in here I would like to use GNOME as my desktop
#pkg_add -r xorg gnome2 => It will take a while for installation.
#vi /etc/fstab
---
...
proc    /proc    procfs    rw  0  0
...
---
#vi /etc/rc.conf
---
...
hald_enable=YES
dbus_enable=YES
gnome_enable=YES
gdm_enable=YES
...
---

6. Well done the GNOME packages and Xorg has been installed, what you need to do now, is by getting the VGA driver, in this case since I installed my freeBSD under VMWare workstation. You can ignore the vmmouse if you install in the normal machine.
#cd /usr/ports/x11-driver/xf86-video-vmware
#cd /usr/ports/x11-driver/xf86-input-vmmouse

7.Once its done just execute command reboot  and there you go welcome to GNOME2 desktop.

Note : when you do some installation through port sometimes there is some error not allowed you to upgrade to the latest version, so to do this. Follow the following command.
#csh
#setenv FORCE_PKG_REGISTER
#make install clean