MiscWorld

A MiscWorld Experience

Linux Console

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:

dmesg

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: sdb1
[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.

dpkg

Search for installed packages:

dpkg -S partial-package-name

example:

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

OpenSSL

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.

Static DNS with DHCP

Open the following file:

nano /etc/dhcp3/dhclient.conf

And uncomment or add the following line:

prepend domain-name-servers 4.2.2.4; # Replace 4.2.2.4 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

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

and then:

apt-get install php5

followed by:

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:

  1. apt-get update
  2. apt-get install build-essential
  3. apt-get install libxml2-dev
  4. 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 http://otn.oracle.com/xe
  2. dpkg -i oracle-xe-version-number.deb
  3. /etc/init.d/oracle-xe configure
  4. Add the following lines to your ~/.bashrc file:
    ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/X.X.X/server
    export ORACLE_HOME
    ORACLE_SID=XE
    export ORACLE_SID
    NLS_LANG='AMERICAN_AMERICA'
    export NLS_LANG
    PATH=$ORACLE_HOME/bin:$PATH
    export PATH
    LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export LD_LIBRARY_PATH

    NLS_LANG may have different values like:

    'GERMAN_GERMANY'
    'MEXICAN SPANISH_MEXICO'
    'BRAZILIAN PORTUGUESE_BRAZIL'

    For more information, check this Oracle page.

  5. Log off and log on for your changes to take effect.
  6. /etc/init.d/oracle-xe enable
  7. /etc/init.d/oracle-xe start
  8. Finally, to test your installation open a window browser and go to http://127.0.0.1:8080/apex

Then, Apache:

  1. Get the latest Apache 2 source pre from http://httpd.apache.org/.
  2. tar jxf httpd.X.X.X.tar.bz2
  3. cd httpd.X.X.X
  4. ./configure --prefix=/installation/path --enable-so --enable-rewrite
  5. make
  6. make install

And finally PHP:

  1. Get the latest source from http://www.php.net/
  2. tar jxf php-X.X.X.tar.bz2
  3. cd php-X.X.X
  4. 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
  5. make
  6. make install
  7. cp php.ini-dist /php-installation-path/lib/php.ini
  8. nano /your-apache-path/etc/httpd.conf

    and be sure you have the following lines:

    LoadModule php5_module modules/libphp5.so
    AddHandler php5-script php

    Save your file.

  9. /your-apache-path/bin/apachectl start
  10. To get a test file for PHP go to my PHP page.

3 Comments so far

  1. Karan January 10th, 2008 5:43 am

    I found your blog via Google while searching for enable java and your post regarding looks very interesting to me. I was impressed by your site and offerings. I was looking at some of the articles and it really impressed me. All I can say is congratulations on creating this site and what took you so long? I look forward to returning.

  2. Apache Php Mysql April 16th, 2008 5:49 pm

    I found your site on faves.com bookmarking site.. I like it ..gave it a fave for you..ill be checking back later

  3. andres April 17th, 2008 11:19 am

    Thank you! :-)

Leave a reply