Linux Console

By Andres Jaimes

Update your computer

You can update your computer from the console by executing the following commands:

apt-get update
apt-get upgrade

Installing a PDF print server on Ubuntu 7 Server

This document is too long to be here, so I moved it here: Installing a PDF print server on Ubuntu 7 Server

ISO images

How to create an iso image:

mkisofs -r -l -o dvd.iso source-folder/

How to burn a dvd image:  

growisofs -dvd-compat -Z /dev/hdc=dvd.iso

where /dev/hdc is your dvd burner device. How to mount an ISO image so it is visible from Nautilus:

mount -o loop dvd.iso /media/iso

USB drives

How to mount a USB drive:

mount -t vfat /dev/sdb1 /media/usb

If sdb1 does not work for you try typing:  


You will see something like this:

[514724.054457] SCSI device sdb: 1005568 512-byte hdwr sectors (515 MB)
[514724.055080] sdb: Write Protect is off
[514724.055084] sdb: Mode Sense: 23 00 00 00
[514724.055086] sdb: assuming drive cache: write through
[514724.057325] SCSI device sdb: 1005568 512-byte hdwr sectors (515 MB)
[514724.057949] sdb: Write Protect is off
[514724.057952] sdb: Mode Sense: 23 00 00 00
[514724.057954] sdb: assuming drive cache: write through
[514724.057974] sdb: <em>sdb1</em>
[514724.058890] sd 2:0:0:0: Attached scsi removable disk sdb

By reading one line before the last one you can see the device you must use. In this case sdb1. Now you can access the USB contents by going to the /media/usb directory.


Search for installed packages:

dpkg -S partial-package-name


dpkg -S java

Completely remove a package from your system (including configuration files):  

dpkg -P package-name

Useful packages

SSH server:

apt-get install openssh-server

Sun’s Java SDK (includes JRE)  

apt-get install sun-java6-jdk

Samba Client  

apt-get install smbclient

GCC and build tools  

apt-get install build-essential

Links – Text Mode Browser  

apt-get install links


apt-get install openssl

Samba Client

Connect to Windows computer:

smbclient server\folder -U username

Worth to note is you don’t need to write a domain name.

Network Interface Configurations

You must perform this changes in the file /etc/network/interfaces DHCP:

auto eth0
iface eth0 inet dhcp

Static IP:

auto eth0
iface eth0 inet static

Static DNS with DHCP

Open the following file:

nano /etc/dhcp3/dhclient.conf

And uncomment or add the following line:  

prepend domain-name-servers; # Replace with your DNS IP.

Enable or disable pings

If you want to block pings to your computer:

echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all

To unblock pings:  

echo "0" > /proc/sys/net/ipv4/icmp_echo_ignore_all

Or you can do it by modifying the following file:  

nano /etc/sysctl.conf

and append the following line:  

net.ipv4.icmp_echo_ignore_all = 1

now execute:

sysctl -p

Convert Images to ASCII

This is accomplished using asciiviewer and ImageMagick:

apt-get install aview
apt-get install imagemagick
asciiviewer yourimage.jpg

Apache 2, PHP 5, MySQL

It’s very easy. Start by:

apt-get install apache2
apt-get install php5
apt-get install mysql-server

next, set mysql root password on the new & nice window (March 18 2008) or if you have an older version follow the instructions at the end of the previous installation script. and finally:

apt-get install php5-mysql

Wow!, too much typing ;-), time to get a cup of coffee…

Apache 2, PHP 5 and Oracle XE

To make it work it’s necessary to install apache and php from source code. Prerequisites:

apt-get update
apt-get install build-essential
apt-get install libxml2-dev
apt-get install libxml2-utils

build-essential installs the compiler and required tools. libxml2-dev and libxml2-utils are needed by PHP in order to avoid the error: “xml2-config not found” Oracle goes first:

  1. Get the latest Oracle XE binary from
dpkg -i oracle-xe-version-number.deb
/etc/init.d/oracle-xe configure
  1. Add the following lines to your ~/.bashrc file:
export NLS_LANG
export PATH

NLS_LANG may have different values like:


For more information, check this Oracle page.

Log off and log on for your changes to take effect.

/etc/init.d/oracle-xe enable
/etc/init.d/oracle-xe start

Finally, to test your installation open a window browser and go to

Then, Apache:

  1. Get the latest Apache 2 source pre from
tar jxf httpd.X.X.X.tar.bz2
cd httpd.X.X.X
./configure --prefix=/installation/path --enable-so --enable-rewrite
make install

And finally PHP:

  1. Get the latest source from
tar jxf php-X.X.X.tar.bz2
cd php-X.X.X
  1. The trick here is to include the --with-oci8 parameter:
./configure --prefix=/installation/path --with-apxs2=/your-apache-path/bin/apxs --with-oci8=$ORACLE_HOME --enable-sigchild
make install
cp php.ini-dist /php-installation-path/lib/php.ini
nano /your-apache-path/etc/httpd.conf

and be sure you have the following lines:

LoadModule php5_module modules/
AddHandler php5-script php

Save your file.

/your-apache-path/bin/apachectl start

To get a test file for PHP go to my PHP page.