How To Install NANO Editor on FreeBSD

This is a quick tutorial on how to install Nano Editor on FreeBSD UNIX. If you got used to pico or nano editor and just installed FreeBSD, in my example FreeBSD 8.2 – RELEASE version, you will find out that if you try to run nano you will get an error that it’s not found.

Make sure you are logged in as root and follow these few steps to install nano and make it work.

portsnap fetch update
cd /usr/ports/editors/nano
make install clean
ln -s /usr/local/bin/nano /usr/bin/nano

If you are using a non-default installation such as the one on Amazon AWS, it might not have the /usr/ports folder, you can just run “portsnap fetch extract update” and try the above steps again or download the package (port) directly:

pkg_add -r nano
ln -s /usr/local/bin/nano /usr/bin/nano

This is it. You can now run nano and it will work the usual way.
If you have any questions, comments or suggestions please post below.

How To Remove GUI (GDM, Gnome, X Window) from CentOS

If you planned to install a CentOS server, but mistakenly also installed Desktop Environment such as GNOME, you can easily remove the GUI packages and return back to Command Line (CLI).

There are two ways to do that. You can simply disable GUI or completely uninstall it. I will provide steps to do both.

Disable GUI (GDM)

nano /etc/inittab

change id:5:initdefault: to id:3:initdefault:

Remove GUI

If you want to remove all GUI packages completely, please still use the disable GUI steps first otherwise once Gnome, GDM, X Windows removed CentOS will still try to load X Window.

To remove GUI packages follow the steps:

yum groupremove "GNOME Desktop Environment" -y
yum groupremove "X Window System" -y

If you want to temporarily stop GDM (GUI), you can issue this command:

init 3

and then back to start GDM:

init 5

If you have any questions please post in comments.

How To Fix Xcode 4 Installation stuck issue on Mac OS X Lion

If you like many experiencing an issue while installing Xcode 4 on Mac OS X Lion where it gets stuck at the very end at 98%-99% and seems like most packages installed but Xcode alias was not created in the Applications folder, there’s a solution for that.

First of all the initial issue was with being unable to quit iTunesHelper process and Apple tried fixing it releasing Xcode 4.0.1 update to the App Store, but that did not resolve the issue to most users even if one manually kills the process via Activity Monitor (Task Manager).

Second, before proceeding with the installation that works, let’s uninstall any previous versions of xcode or orphan dev packages by running this command:

sudo /Developer/Library/uninstall-devtools --mode=all

Once everything is removed, empty Trash and Restart your Mac. You can clean the dishes as well while Mac OS X is being restarted.

Now to install Xcode without hanging or giving errors, assuming you have downloaded version 4.0.1 from the App Store, you can find “Install Xcode” icon in your Applications folder.

Right click on the “Install Xcode” and click “Show Package Contents”

Then navigate to Contents > Resources > Xcode.mpkg and double-click on it.

Next follow the installer prompts to proceed with the installation of Xcode

Once the installation is successfully complete, you can close the installer and enjoy developing your Apps.

If you have any questions or comments, please post them below.

How To Install Python 2.7 with mod_wsgi on CentOS 5.6 with cPanel

This is a step by step tutorial which will help you install Python 2.7 with mod_wsgi onto CentOS 5.6 and cPanel.


  • CentOS 5.6 32 or 64 bit with root access

  • cPanel

Note: we are not using cPanel custom modules guide because it only works with built-in Python 2.4.

Creating Python folder

mkdir /usr/src/python2.7
cd /usr/src/python2.7

If required by your project, you can install SQLite
tar zxvf sqlite-autoconf-3070701.tar.gz
cd sqlite-autoconf-3070701
make install

Installing Python 2.7 into alternate location since we don’t want to break Centos 5.6 (yum) that uses Python 2.4

cd /usr/src/python2.7/
tar zxvf Python-2.7.2.tgz
cd Python-2.7.2
./configure --prefix=/opt/python2.7 --with-threads --enable-shared
make install

Creating symbolic link to the alternate Python version

ln -s /opt/python2.7/bin/python /usr/bin/python2.7
echo '/opt/python2.7/lib'>> /etc/

Let’s test if new Python version works


If successful you will see something like this:

Python 2.7.2 (default, Sep  3 2011, 18:28:42)[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2

press control+D to exit

Now we need to install Python setup-tools

cd /usr/src/python2.7/
sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7

Installing virtualenv to our Python 2.7

cd /opt/python2.7/bin/
./easy_install virtualenv

Installing mod_wsgi (this module will work only with python 2.7)

cd /opt/python2.7/lib/python2.7/config/
ln -s ../../
cd /usr/src/python2.7/
tar zxvf mod_wsgi-3.3.tar.gz
cd mod_wsgi-3.3
./configure --with-python=/opt/python2.7/bin/python
make install

We need to avoid cPanel’s easy_apache clearing up /usr/local/apache/modules folder

mkdir /usr/local/apache/extramodules
mv /usr/local/apache/modules/ /usr/local/apache/extramodules/

Include mod_wsgi into Apache configuration

nano /usr/local/apache/conf/includes/pre_virtualhost_global.conf


LoadModule wsgi_module /usr/local/apache/extramodules/
AddHandler wsgi-script .wsgi

Before we restart Apache, lets test if we have the correct configuration

service httpd configtest

You should get this answer:

Syntax OK

Now restart Apache

/scripts/restartsrv httpd

Python 2.7 with mod_wsgi is now installed on your cPanel server.

You can create a test.wsgi file to test Python scripts

def application(environ, start_response):
"""Simplest possible application object"""
output = "Hello World"
status = '200 OK'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]

Please post your questions and comments below.

How To: Backup IIS7 ApplicationHost.config and Settings

Internet Information Services 7 (IIS7) doesn’t use metabase-like file from IIS6. Instead the settings and configuration are stored in schema files and applicationHost.config files.

Since the configuration files are different, the old IIS6 tools will not be able to backup IIS7 settings.

This is the new script that you can use to backup your IIS7 web servers.

1. Using notepad or any text editor create a file backupiis7.cmd

2. Insert the following code and save the file:

@echo off

pushd "%WinDir%System32inetsrv"

echo.| date | find /i "current">datetime1.tmp
echo.| time | find /i "current">datetime2.tmp

for /f "tokens=1,2,3,4,5,6" %%i in (datetime1.tmp) do (
echo %%n>datetime1.tmp
for /f "tokens=1,2,3,4,5,6" %%i in (datetime2.tmp) do (
echo %%m>datetime2.tmp
for /f "delims=/ tokens=1,2,3" %%i in (datetime1.tmp) do (
set TMPDATETIME=%%k%%i%%j
for /f "delims=:. tokens=1,2,3,4" %%i in (datetime2.tmp) do (

appcmd add backups %TMPDATETIME%

del datetime1.tmp
del datetime2.tmp



3. The IIS7 configuration will be backed up at the following path:


NOTE: you can also use Task Scheduler to automate backups.