How to Configure a BIND Server on Ubuntu


Introduction Within this article, we will configure a BIND server within Ubuntu. The advantages of having a local DNS server include: Reduced latency to DNS requests/responses Ability to add private addresses and full flexibility of zone names. Especially useful for VMware installations. It is important to note that the steps provided, are based on a quick setup. Due … Read more

How do I add a Space to Selected Lines within VIM?

Introduction Most likey there will be a time (for one reason or another) where you need to insert a number of spaces to a set of lines within a text file.Within this short article we will show you how via the use of VIM. Steps 1. Within VIM select blockwise visual mode, by pressing CTRL-V.2. … Read more

A Brief Explanation of Kernel Space and User Space

Introduction Within the Linux kernel, knowing how memory is separated is extremely important. As knowing what programs reside where, and the requirement on the system to move memory from one place to another, can provide a huge insight into the performance, or lack of, within a system. And when it comes to the world of … Read more

What is MacVTap?

Definition MacVTap is a Linux device driver, based upon the combination of – Macvlan and TAP (descriptions below), that allows for the creation of virtual (tap-like) interfaces. Each virtual network interface is assigned its own MAC and IP address, then attached to the physical interface (also know as the lower interface), Macvlan – Linux kernel … Read more

The Journey of a Frame through a Linux Based System

Abstract The scope of this article is to describe, at a high level, the journey a frame takes through a Linux based system. NOTE This article does not cover Linux kernel performance issues and caveats, for more information around this please see pushing the limits of kernel networking. Ingress Lets first look at the path … Read more

What is the Difference between Apt-get Upgrade and Update?

The other day I asked myself, What is the difference between apt-get update and apt-get upgrade? As I’m sure many other people, at some point may ask the same, I thought I would share the answer. Quite simply, apt-get update – updates the list of available packages, and their versions. However it does NOT upgrade … Read more

Yum Error: Thread died in Berkeley DB library | rpmdb open failed

Issue When executing Yum you receive the following error, [root@william-gce blog]# yum install npm rpmdb: Thread/process 3934/139752225695488 failed: Thread died in Berkeley DB library error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db3 – (-30974) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open … Read more

A Beginners Guide to Git

What is Git? Git is a version control system that is used for software development and other version control tasks. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows[1]. Create Repository To create a new repository, the command git init is used, within your directory. … Read more

How to Resolve a Git Merge Conflict from the Command Line

Git provides 3 types of merging, Fast-Forward, Automatic and Manual. A manual merge is required when git is unable to resolve any conflicts , this results in a merge conflict. Within this example we will generate a merge conflict and then manually resolve from within the command line. File First, lets look at the contents … Read more

How to Colorize the Git Output within your Shell

Git provides various global configuration options for colorizing the output.[1] In order to enable these options, run the following commands. This will, in turn update your ~/.gitconfig file. git config –global color.ui alwaysgit config –global color.branch alwaysgit config –global color.diff alwaysgit config –global color.interactive alwaysgit config –global color.status alwaysgit config –global color.grep alwaysgit config –global … Read more

How to Display your Local Git Branch in your BASH prompt

In order to make your life easier when working with git, this article provides the steps to display the current local git branch within your bash prompt. This not only saves you time, but also prevents the potential for human error by ensuring you are not making changes to the wrong branch. Download Script First … Read more

How to Set the Time Date and Timezone in Ubuntu

In this article we will show you how to set the time, date and timezone within Ubuntu. Steps Set the time zone Set the time and date Sync the hwclock with the current time and date Commands Below are the commands that are required. For the date command this will set the time and date … Read more

How to Configure the UFW Firewall

Introduction The Uncomplicated Firewall (ufw) is a frontend for iptables and is particularly well-suited for host-based firewalls. ufw provides a framework for managing netfilter, as well as a command-line interface for manipulating the firewall. ufw aims to provide an easy to use interface for people unfamiliar with firewall concepts, while at the same time simplifies … Read more

Linux Network Namespaces

The Linux Network Namespace (netns) is a feature within the 2.6.27+ Linux kernel. Normally a Linux process will run within a network namespace. By default this is inherited from its parent process. Network namespaces allow for the process to run within a different network namespace. This allows  for virtual instances of the Linux network stack … Read more

How do I install g++ via Yum ?

Issue How do you install g++ via Yum ? You may also be asking this due to receiving the following error when trying to compile from source, make[1]: g++: Command not found Solution To install g++ via yum run the command, yum install gcc-c++

How do I install node.js in Centos ?

Within this article we will show you how to compile node.js, version 0.10.25. Note : This article is meant as a quick, and short guide rather then full blown tutorial. Install Dependencies yum install bzip2 gcc gcc-c++ sqlite sqlite-devel Download wget Extract tar xvfz node-v0.10.25.tar.gz cd node-v0.10.25 Compile ./configure make make install  

Connect to a serial device using a USB-to-Serial Convertor in Linux

For years, I had ran my Prolific USB to Serial cable from my Windows 32bit laptop without any issues. Unfortunately, life when running Windows is never easy. After upgrading Windows 7 to 64bit I tried to install the drivers from CNET downloads. This was a HUGE mistake. Even though the CNET downloader told me it … Read more

How to Fix Unreadable Directory Listings within Shell

You may find that when listing directories within the shell and when using a black background that the directory names aren’t clearly readable. To resolve this issue the following command and then log back in.  This command will issue a find and replace against the color setting (for directory listings) within the necessary configuration file. … Read more

Configuring SSL within Apache

Within this article we will show you how to configure Apache to serve your content over a SSL based connection using a self signed certificate. Generate Certificate/Key First of all we generate a self signed certificate using openssl. This will create 2 files, a public certificate and a private key. mkdir -p /opt/ssl/crt/cd /opt/ssl/crt/openssl req … Read more

What is a umask ?

The Umask (User Mask) is a UNIX function that is used to control the permission bitmask applied to newly created files and folders.The Umask value is subtracted from the default permission value. The resulting value is then assigned as the permission bitmask to the newly created file or folder. Note : The default permission values … Read more

How to display HTTP Headers via Tcpdump

Syntax To display the HTTP Headers using just tcpdump the following syntax can be used : root@webserver1 ~]#  tcpdump -vvvs 1024 -l -A host Example [root@webserver1 ~]# tcpdump -vvvs 1024 -l -A host tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 1024 bytes 19:51:57.742793 IP (tos 0x0, ttl 64, id 39410, offset … Read more

How do I install mplayer on Centos / RHEL ?

To install mplayer onto your Centos / RHEL distro you will need to : 1. Download and install the rpmforge repository. rpm -ivh  2. Add the following text to a new file : /etc/yum.repos.d/fc6.repo. cat > /etc/yum.repos.d/fc6.repo[PASTE THE FOLLOWING] [fc6-base] name=Fedora Core 6 mirrorlist=$basearch enabled=1 gpgcheck=0 [CTRL-C]  3. Install mplayer using yum. yum install mplayer

Useful Curl Examples

Curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, TFTP, DICT,  TELNET, LDAP or FILE) and is designed to work without user interaction. Below shows some useful examples: Total Retrieval Time [root@webserver1 ~]# curl -s -w “%{time_total}\n” -o /dev/null 0.196 Host … Read more

How can I test the bandwith using a Linux shell ?

The other day I was faced with the problem of determining the networking bandwidth of a Linux system via just the shell. After some googling and some head scratching I eventually came up with the following command. echo “scale=2; `curl  –progress-bar -w “%{speed_download}” -o` / 131072″ | bc | xargs -I {} echo … Read more

Installing Apache 2.2 from Source

Below details the basic steps required to compile Apache 2.2 upon a CentOS based distro. Update System yum install gcc Download Source cd /var/tmp/wget Unzip / Untar gunzip httpd-2.2.19.tar.gzmkdir httpdcd httpdtar -xvf ../httpd-2.2.19.tarcd httpd-2.2.19/ Compile ./configuremake Install make install Confirm Install [root@localhost httpd-2.2.19]# /usr/local/apache2/bin/apachectl -vServer version: Apache/2.2.19 (Unix)Server built: Jul 10 2011 17:59:10

CentOS timezone not updating

ISSUE When configuring the timezone within Centos the correct timezone is not propagated and the output of the command date does not represent the timezone previously configured. SOLUTION This can be caused by corrupted timezone files. To resolve the issue remove the soft-link, reinstall tzdata and then recreate the soft-link to the necessary timezone. [root@server … Read more

How to Open / Extract RAR Files within Linux

To extract or open RAR files within Linux the unrar binary is used. Below provides the installation and basic operational syntax for the unrar program. 1. Installation 1.1 REDHAT yum install unrar 1.2 UBUNTU apt-get install unrar 2. Basic Syntax To extract a RAR file the following syntax is used: unrar e contents.rar 3. Example … Read more

Ubuntu Ubiquity Error: The username you entered is invalid

When Installing Ubuntu from a Live CD via the graphical installer ubiquity you may receive the following error :               The username you entered is invalid. Note that usernames               must start with a lower-case letter, which can be followed               by any combination of numbers and more lower-case letters. Solution This error can occur … Read more

How do I install a Package Manager within Cygwin ?

Though Cygwin provides the ability to update and install packages via the use of the Cygwin`s setup.exe command, the command line installer apt-cyg provides apt-get like syntax whilst still using Cygwin’s native package repository.   Below details the steps required to install the apt-cyg command line installer.   1. UPDATE CYGWIN First of all you … Read more

/bin/bash^M: bad interpreter: no such file or directory

This is caused by additional carriage returns within your script. In Windows the end of a line is denoted by CRLF (Carriage-Return, Line-Feed). In Unix-like systems, the end of a line is donated by a single LF. This means when you try to run your script, every line has an extra carriage return which in turn causes … Read more

Conditional Execution within Crontab

Conditional execution is a term used to describe the execution of processes or commands based on specfic conditions. This can also be thought of as conditional logic.  Like with most scripting or programming languages conditional logic is built upon the use of return codes. A return code (exit status)  is returned upon process completion to … Read more

Running Java Daemons within Linux

Below is a small method for running Java daemons within Linux. The syntax is as follows: nohup is used so that it doesn’t get killed when user logs off </dev/null is used so that it doesn’t require a command-promt of it’s own & is used so that the Java daemon runs as a background process. … Read more

BASH – ARP Scan command

The following syntax will scan a range of IP addresses. At the point of a ARP response being received it will show a reply message (shown in below example). Note : In this example it will scan IPs between if [ -x  /sbin/arping ] ; then for i in {1..255} ; do echo arping … Read more

BASH – Display Clock within Shell

The following command will place a clock within the top right corner of your shell. while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-25));date;tput rc;done &

Configuring Wireless Connectivity within Backtrack 4 r2

INTRODUCTION This article aims to explain the various steps required in configuring Wireless connectivity within Backtrack 4 r2. It is also worth mentioning that as Backtrack is based upon Ubuntu/Debian you may find steps and solutions within this article useful when faced with other Ubuntu/Debian based wireless issues. MY SETUP Backtrack installation consists of a … Read more

IPTables -L output displays slowly

When running the command iptables -vL you may find that : the output displays slowly. the output (appears) to have hung. You can further see what IPtables is doing via running iptables -vL. From this you will most likely see iptables trying to run a reverse DNS lookup (and failing). Solution Due to IPtables trying to … Read more

Wget – 403 Forbidden Error

Issue When trying to download a file using wget you recieve a 403 forbidden error. root@Fileserver html# wget [website] –2010-12-20 20:40:40– [website] Resolving… to||:80… connected.HTTP request sent, awaiting response… 403 Forbidden2010-12-20 20:40:41 ERROR 403: Forbidden. Solution wget -U firefox [website]

VSFTPD : 550 Failed to change directory

By default VSFTPD does not allow the browsing of symbolic links. When you try to browse sym links you will get a message saying,        550 Failed to change directory In order to overcome this you can use the mount command. Here are the steps : [root@server ftpuser]# pwd/home/ftpuser[root@server ftpuser]# mkdir NEW_DIR[root@server ftpuser]# mount –bind … Read more

How to determine the Syslog Facility using Tcpdump

Each Syslog message contains a priority value. The priority value is enclosed within the characters < >. The priority value can be between 0 and 191 and consists of a Facility value and a Level value. Facility being the type of message, such as a kernel or mail message. And level being a severity level … Read more

Oracle 11g Fedora 13 Error in invoking target ‘agent nmb nmo nmhs tclexec’

When installing Oracle 11g on Fedora 13 you may get the following error :               Error in invoking target ‘agent nmb nmo nmhs tclexec’ of makefile ‘/u01/app/oracle/product/11.1.0/db_1/sysman/lib/ Solution Within the file detailed in the error edit it and find the line that reads ‘$(MK_EMAGENT_NMECTL)’ change this to ‘$(MK_EMAGENT_NMECTL) -lnnz11’ Note : edit this file while … Read more

Build a Samba Server on Redhat / CentOS

Below shows you the basic steps in order to configure your Linux Redhat / CentOS server as a Samba server. Install and Configure yum install samba -ychkconfig –level 123 smb on cd /etc/sambamv smb.conf smb.conf.backupvi smb.confcat > /etc/samba/smb.conf [paste the text below][global]workgroup = Workgroupnetbios name = SambaServerserver string = Samba Server %vlog file = /var/log/samba/log.%mencrypt … Read more

How to set the Time / Date and Timezone in CentOS

In this article we will show you how to set the time, date and timezone within CentOS. Though I’m sure this method will remain the same through the various Linux distributions. Steps Set the time zone Set the time and date Sync the hwclock with the current time and date Commands Below are the commands … Read more

How do I set the hostname on CentOS ?

In order to set the hostname on CentOS you will need to change the HOSTNAME section within /etc/sysconfig/network Your hostname will now be updated once you logout and then back in. Its also worth noting that this will survive reboots.

How do I run apt-get when Im behind a proxy ?

In order configure your Ubuntu/Debian box to access HTTP, HTTPS and FTP via a Proxy you will need to assign some environment variables. Assign Environmental Variables Below shows you the different variables you need to declare : export HTTP_PROXY=[PROXY IP]:[PORT]export HTTPS_PROXY=[PROXY IP]:[PORT]export FTP_PROXY=[PROXY IP]:[PORT] Survive reboot To survive a reboot you need to add these … Read more

IPTables Template

Below is a basic template for setting up IPTables on a Linux box : Create LOGDROP CHAIN. Add LOG and DROP to chain. iptables -N LOGDROP iptables -A LOGDROP -j LOG –log-level 6 iptables -A LOGDROP -j DROP Create input and output policies iptables –policy INPUT DROP iptables –policy OUTPUT DROP Add inbound rules iptables … Read more

How to Encode / Decode a File

What is encoding / decoding ? Encoding refers to the process of translating a file into an ASCII based string. Decoding refers to the process of decoding the ASCII based string. In order to perform this decoding/encoding process Base64 is typically used. Base64 is a program that  converts each 6 bits and then converts this … Read more

Redhat Server Single User Mode: Enable Serial Connection

Please note : This article is based on RHEL5 and grub. Below shows the 2 methods you can use to ensure serial connectivity when booting into single user mode. You may find without changing this setting your connection is lost just after Redhat starts booting.This configuration change can be via the grub.conf or via the … Read more

Yum Update Error: ‘module object’ has no attribute ‘HTTPSHandler’

Issue When you try and run a yum update you receive the following error : root@localhost:/$ yum update Traceback (most recent call last): File “/usr/bin/yum”, line 4, in ? import yum File “/usr/lib/python2.4/site-packages/yum/”, line 42, in ? import config File “/usr/lib/python2.4/site-packages/yum/”, line 27, in ? from parser import ConfigPreProcessor File “/usr/lib/python2.4/site-packages/yum/”, line 3, in ? … Read more

Linux: Password Protect & Encrypt File Using OpenSSL

In this article we will encrypt (using AES 256 cbc) and password protect (Salt the AES) a file using the openssl binary. The file we will encrypt will be the file secretfile.txt.As you can see it is just a plain text file. [root@linux tmp]# cat  secretfile.txt This is a secret file that we do not … Read more

Want to become a Linux expert?

Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial