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: <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.
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.
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
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
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
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:
- Get the latest Oracle XE binary from http://otn.oracle.com/xe
dpkg -i oracle-xe-version-number.deb
/etc/init.d/oracle-xe configure
- 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.
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 http://127.0.0.1:8080/apex
Then, Apache:
- Get the latest Apache 2 source pre from http://httpd.apache.org/.
tar jxf httpd.X.X.X.tar.bz2
cd httpd.X.X.X
./configure --prefix=/installation/path --enable-so --enable-rewrite
make
make install
And finally PHP:
- Get the latest source from http://www.php.net/
tar jxf php-X.X.X.tar.bz2
cd php-X.X.X
- 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
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/libphp5.so
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.