Thursday, 31 May 2007

NFS quick guide

NFS - Network File System

Get NFS installed via Synaptic Package Manager on 2 PCs, sourcePC and destPC.

/nfsdir is created on both PCs and /nfsdir contains files on sourcePC which need to be shared.

Edit /etc/exports file on sourcePC:

# two machines which share files under /nfsdir

/nfsdir sourcePC(rw) destPC(rw)

sourcePC is the PC which runs NFS server and shared files are stored under /nfsdir.

For security, add two files under /etc, hosts.deny and hosts.allow:

#hosts.deny

portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL

#hosts.allow

service: sourcePC , destPC

#sourcePC 192.168.10.2; destPC 192.168.10.3
portmap: 192.168.10.2 , 192.168.10.3
lockd: 192.168.10.2 , 192.168.10.3
rquotad: 192.168.10.2 , 192.168.10.3
mountd: 192.168.10.2 , 192.168.10.3
statd: 192.168.10.2 , 192.168.10.3

Start NFS server by /etc/init.d/nfs-kernel-server start

Check the status of NFS, rpcinfo -p.

Go to destPC. To view the contents of /nfsdir on sourcePC, mount remote directory first.

sudo mount sourcePC:/nfsdir /nfsdir

Now the contents of /nfsdir on sourcePC could be available on destPC.

Here is a link about NFS.

Wednesday, 30 May 2007

NoMachine NX and FreeNX

NXServer and NXClient are very good software to log into Linux system remotely. You could download the free edition from NoMachine. The free edition limits the number of users, so only 2 users can use the NX.

There is another option to use NX, which is FreeNX. How to install FreeNX could be found at Ubuntu help. FreeNX is an open source software and has no limitation on number of users.

FreeNX has the problem of colour missing. This could be solved by add a symbolic link.

ln -s /etc/X11/rgb.txt /usr/X11R6/lib/X11/rgb.txt

Because nxagent is looking for rgb.txt in /usr/X11R6/lib/X11, which does not exist.

LAMP under Ubuntu

Installation is really easy. Just use Synapitc Package Manager to choose the packages you need, like Apache2, php5, MySQL server/client, etc. If you like to add more features for your LAMP, just add more packages.

For seucrity purpose, it is necessary to add root password for MySQL. (Initially the root password is blank. When it asks password, just press the return key and it log into the MySQL directly.)

Log into mysql as root:

fish@pool:~$mysql -u root -p
Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>set password for 'root'@'localhost'=password('newpassword');
mysql>flush priviledges;

If root needs log into the MySQL from other machine, add a line,
mysql>set password for 'root'@'hostname'=password('newpassword');

If root needs log into the MySQL from any remote host, add a line,
mysql>set password for 'root'@'%'=password('newpassword');

END of MySQL root setting.

After Apache2 installation, the default Apache2 directory is
/var/www/apache2-default
You could save your HTML, php documents under this directory and view from other machine. If you like to have it from other directory, some changes need to be done on file
/etc/apache2/sites-available/default
OR generate a new file
/etc/apache2/sites-available/newsite

The contents of the file should be,

##############################
NameVirtualHost *
<VirtualHost *>

    ServerAdmin webmaster@localhost
    DocumentRoot /path/dirname/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /path/dirname/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
        # This directive allows us to have apache2's default start page
        # in /apache2-default/, but still have / go to the right place
        #RedirectMatch ^/$ /apache2-default/
    </Directory>

    ScriptAlias /cgi-bin/ /path/dirname/cgi-bin/
    <Directory "/path/dirname/cgi-bin">
        AllowOverride None
        Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

#################################################

To make the new site work, a symbolic link needs to be created under
/etc/apache2/sites-enabled
And you can remove the default-000 under this directory and then restart Apache,
sudo apache2ctl restart

To test php, a short php file could be saved under /path/dirname. (test.php)


Use browser to view the file. (http://localhost/test.php)

Tuesday, 29 May 2007

Ubuntu Installation

There is really no much to talk about. Download ISO from www.ubuntu.com and burn the image onto a CD.

Reboot the computer and then set "boot from CD" in your computer's BIOS, and insert the Ubuntu CD into the CD-ROM.

Click installation icon and keep on click 'next', 'next', 'next' ......

It is done!

Monday, 28 May 2007

Red hot Rainbow Trout (Szechuan)

Prepare:

Whole Rainbow trout with head and tail, cleaned and scaled
1 tablespoons white wine
1 cloves garlic, coarsely chopped
3 teaspoons sugar
3 teaspoons salt
5 tablespoons vegetable oil
1 tablespoons soy sauce
2 teaspoons red hot chili sauce

Cooking:

Heat the oil in a wok or saucepan, and when it is hot (light smoke comes out) put garlic into the wok. (Smell so good. If you do not like, you can use spring onion.)

Once the garlic turns into golden, put the fish into the wok. Turn it gently to make sure both sides cooked.

When the skin of fish starts peeling off, add wine, soy sauce, sugar, salt and red hot chili sauce. Finally add 3 tablespoons cold water and put the cover on the wok, and using medium fire to cook it for 10 minutes. DONE and EAT.

(If you do not have the chili sauce, it is so easy to make it. Buy 2 or 3 small and red chili from Tesco. YES, the hottest one if you want to have real Szechuan dish. Chop it coarsely and keep all the seeds. Put all chopped chili into the hot oil in the wok or pan. Cook 2 minutes and you could have the sauce with red oil. NOTE, it is really spicy.)

Sunday, 27 May 2007

My old Skoda

I just said good-bye to my old and reliable friend Skoda Felicia yesterday and had a 2004 Citroen Xsara. Unfortunately I just own it for one day and it stops working.

Called a pal from AA and he told me Skoda is really a good and reliable car. I told him I was happy with Skoda and the reason I changed it is that it does not have air-conditioning. He told me only two months in a year maybe I need to use air-conditioning. Now I start to regret to let my Skoda go.

Love Ubuntu

I started to use Linux from 2001. I was using Redhat 6.0, then I tried Redhat 7.2, Redhat 9.0, Fedora 1, Fedora 2, Fedora 3. Every time I was trying to install some software, it took me ages to find the dependant packages from the Internet.

From 2005, one of my colleagues told me about Ubuntu. I found it is really easy to use and manage. Software installation becomes more convenient. Using APT, you can install the software you need and it looks for dependant packages automatically. If you have not tried, I can tell you it is worth to have a go.

Using Linux

Why use Linux? Is Microsoft not good?

To be honest, Microsoft provides good and quality products but they are not cheap and unfortunately due to the long history of its operating system most viruses are developed for making Microsoft system crash.

If you are going to have a system with Microsoft products, you need to buy Microsoft Windows, Microsoft Office, and some anti-virus software. How much does it cost? I am sure it could be more expensive than the computer you've built.


Why not try Linux? It is free. It is completely free. You can get support from all Linux users. You can have OpenOffice which has similar functions as MS-Office. You can have everything free under Linux.