≡ Menu

freebsd server

Upgrade FreeBSD 7.x to 7.2 Stable Release

I tried a binary upgrade method, but it failed due to custom kernel installed on my FreeBSD 7.1_p5 64 bit AMD systems. How do I upgrade my FreeBSD server using source code method?
[click to continue…]

Update FreeBSD Using Proxy Server (csup / portsnap proxy update)

Question: How do I upgrade my FreeBSD server and ports tree using our proxy server, which requires username and password based authentication?
[click to continue…]

FreeBSD: How To Add A Second Hard Disk

Q. How do I add a second hard disk to my FreeBSD server? How do I partition, label and mount a new hard disk under FreeBSD for backup or additional data?
[click to continue…]

FreeBSD Install and Configure Webmin Web-based Interface ( Control Panel )

Q. How do I install webmin control panel for my FreeBSD server?
[click to continue…]

FreeBSD Stop IPFW Firewall

Q. How do I IPFW firewall in FreeBSD using a shell prompt or over remove ssh login?
[click to continue…]

FreeBSD List All Outdated Package

Q. How do I know what packages are available to be updated on my FreeBSD Server system? How do I list all outdated packages under FreeBSD / OpenBSD operating system?
[click to continue…]

Linux List All Outdated Packages Which Could be Updated and Applied to System

Q. How can I know what packages are available for binary update under Fedora / RHEL / CentOS Linux version 5 server? How do I list all outdated packages? How do I apply update / patches to system?
[click to continue…]

FreeBSD Start / Stop / Restart MySQL Server

I am a new FreeBSD version 6.x/7.x/8.x/9.x/10.x server user. How do I start / stop or restart MySQL server from a shell prompt over ssh session?
[click to continue…]

FreeBSD install VIM text editor

Q. Quick question – How do I install VIM text editor for my FreeBSD server? Currently it has old version of vi. I like vim as it is a highly configurable text editor and efficient one.

A. VIM (Vi IMproved ) is not installed by default under FreeBSD. Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs. You can install vim binary package or use FreeBSD's ports system.

Task: Install vim binary package

Type the following command to install vim lite version:
# pkg_add -r -v vim-lite

You can also use FreeBSD ports system to install vim:
# cd /usr/ports/editors/vim-lite/
# make install clean

To start vim type command:
$ vim

You can also create a alias using alias command:
$ alias vi='vim'

Add above alias to your shell start up file such as ~/.bashrc / ~/.cshrc

Task: Setup global vimrc file

You need to copy default vimrc file from /usr/local/share/vim/vim71/vimrc_example.vim to /usr/local/share/vim:
# cp /usr/local/share/vim/vim71/vimrc_example.vim /usr/local/share/vimrc

Task: Personal ~/.vimrc file

You can customize ~/.vimrc as per your requirements. Here is my own file:
$ cat ~/.vimrc
Sample output:

set nocompatible " must be the first line
filetype on
filetype indent on
filetype plugin on
set laststatus=2
set statusline=%<%f\%h%m%r%=%-20.(line=%l\ \ col=%c%V\ \ totlin=%L%)\ \ \%h%m%r%=%-40(bytval=0x%B,%n%Y%)\%P

How do I install and search FreeBSD ports or a package?

Q. I’ve just moved from a Linux server to a new FreeBSD server. I'm confused with FreeBSD ports system. Can you tell me - how do I find a package file (port) and install the same?

A. Under Linux you use rpm / up2date / yum or apt-get command to install a package. Under FreeBSD you can use pkg_add command or ports system.

The FreeBSD Ports Collection is a package management system that provides an easy and consistent way of installing software packages on the FreeBSD. Usually ports is located at /usr/ports directory.

Task: Find out FreeBSD port name or package name

There are 3 different methods available to search a port name. Use any one of the following method only.

#1 : Using whereis command

If you know the exact name of the port, but just need to find out which category it is in, you can use the whereis(1) command. Simply type whereis file, where file is the program you want to install.
# whereis php5

php5: /usr/ports/lang/php5

# whereis lighttpd

lighttpd: /usr/ports/www/lighttpd

#2: Using make command

Change directory to /usr/ports
# cd /usr/ports

To search type the command as follows:
# make search name="package-name"
For example search a package called lighttpd or php
# make search name="php"
# make search name="lighttpd"

Port:   lighttpd-1.4.13_2
Path:   /usr/ports/www/lighttpd
Info:   A secure, fast, compliant, and very flexible Web Server
Maint:  mnag@FreeBSD.org
B-deps: autoconf-2.59_2 libtool-1.5.22_4 m4-1.4.8_1 pcre-7.0_1 perl-5.8.8
R-deps: pcre-7.0_1
WWW:    http://www.lighttpd.net/

#3: Using locate command

You can also use locate command:
# locate php
# locate php | grep php5

Task: Install FreeBSD port

Above output displays port Path - /usr/ports/www/lighttpd. Just change directory to /usr/ports/www/lighttpd
# cd /usr/ports/www/lighttpd
Now install a port:
# make; make install
Clean the source code tree:
# make clean