Tuesday, July 11, 2006

Reinstalling Grub without reinstalling the whole linux distribution.

Hi i tried to install Debian 3.1 in my friend's laptop. he had Windows XP,Suse and fedora core5. i installed Debian overriding Suse. there were problem with loading fedora through the debian boot loader. So i tried to reinstall only the grub of fedora. This is how i did it.

Use installation CD/DVD(Fedora core5) to boot the system. When the CD is booted it asks for boot option. most distributions provide the "linux rescue" option.
Type "linux rescue" (without the quotes) and press enter. this will usually provide you with a shell/command prompt.
This will also load the linux partition in the location /mnt/syslinux

This rescue mode is like booting into a live CD with only a console
Fedora was installed in /dev/hda5

now we need to install the grub.
grub-install /dev/hda5 --root-directory=/mnt/syslinux

if you face any problem like
"grub not found of grub:comand not found
then copy the executable grub from the following location
/usr/sbin/grub to
/sbin
And the command to do it is cp /usr/sbin/grub /sbin

The output would show that grub installation is successful

this will install your grub. type exit. this will reboot your system with the boot loader correctly configured.

Wednesday, June 21, 2006

MYSQL Explorations....

To create a database:

mysql> CREATE DATABASE smrpnm;

--> database name is case sensitive, unlike SQL keywords.

We should use the db...to make a database the current one...

mysql> USE smrpnm;

Alrernate at shell level, # mysql -h host -u user -p smrpnm
password: *********** (or)
# mysql -h host -u user -pmypassword smrpnm // not recommended
---------------------
No tables are present, so the following will not return anything...

mysql> SHOW TABLES;

So time to create a table now,

mysql> CREATE TABLE members (name VARCHAR(20), dob DATE, email VARCHAR(30), bg VARCHAR(20), mobile VARCHAR(14), locality VARCHAR(20), bagh VARCHAR(20), phone VARCHAR(14));

--> Character length: 1-255 char.

---------------------
But now, give,

mysql> SHOW TABLES;

To verify that the table was created as expected..

mysql> DESCRIBE members;

---------------------
Loading data:

mysql follows yyyy-mm--dd format

A single record at a time...

mysql> INSERT INTO members VALUES ('Sample',NULL,'sample@sample.com',NULL,NULL,'Vadapalani','Vadapalani','2222222');

Load data provides chances to get bulk data to the table..

mysql> LOAD DATA LOCAL INFILE '/root/Desktop/loadtosql.txt' INTO TABLE members;

--> In loadtosql.txt each value of a record seperated by tab witn \N representing NULL. In window '\n\r' has to be used as line seperator.
---------------------
SELECT statement:

Syntax:

SELECT what_to_select FROM which_table WHERE conditions_to_satisfy;

mysql> SELECT * FROM members;

To update a record, which has got erroneous value in table....or replace a NULL value....

mysql> UPDATE members SET name = 'Seshadri' Where locality = 'Ashok Nagar';
---------------------

To DELETE record from a table....

mysql> DELETE FROM members;

---------------------

More SELECT staements examples:

Option: All columns

mysql> SELECT * from members WHERE locality = 'T Nagar';

mysql> SELECT * from members WHERE bagh = 'Medavakkam' AND locality = 'Medavakkam';

mysql> SELECT * from members WHERE bagh = 'Medavakkam' OR bagh = "Mylapore";

mysql> SELECT * from members WHERE (bagh = 'Medavakkam' OR bagh = "Mylapore") AND (bg = 'B+ve');
------
Option: Few columns

mysql> SELECT name, mobile from members WHERE locality = 'T Nagar';

Selecting distinct value to get displayed when there is a repitition,'

mysql> SELECT DISTINCT bg FROM members;

mysql> SELECT name from members WHERE (bagh = 'Medavakkam' OR bagh = "Mylapore") AND (bg = 'B+ve');
------
Sorting:

mysql> SELECT locality, name, mobile from members ORDER BY locality;

For desecding order sort..

mysql> SELECT locality, name, mobile from members ORDER BY locality DESC;

Multi-column sort,

mysql> SELECT locality, name, mobile from members ORDER BY locality, name;
------

Monday, June 05, 2006

Fonts in GNU/Linux

In a GNU/Linux system fonts are generally located in three places,

1) /usr/share/fonts,
2) /usr/local/share/fonts and
3) /home//.fonts

These are defined in /etc/fonts/fonts.conf

To add a True type font,

# cd /usr/local/share/fonts # or /usr/share/fonts, but this is less safe
# sudo mkdir truetype
# cd truetype
# sudo cp /path/to/your/fonts/*.ttf .
# sudo cp /path/to/your/fonts/*.TTF .
# sudo chown root:root *.ttf
# sudo chown root:root *.TTF
# sudo mkfontscale

>> Note: For fedora do # ttmkfdir before fc-cache

# sudo mkfontdir
# sudo fc-cache


(mkfontscale and mkfontdir creates fonts.scale and fonts.dir files within /usr/local/share/fonts/truetype, and fc-cache updates fonts.cache-1 files within all font directories.)

Now we need to create sym links to other fonts folders,

# ln -s /usr/local/share/fonts/truetype /usr/share/fonts/truetype/myfonts
# ln -s /usr/local/share/fonts/truetype /home//.fonts

Fonts can also be added directly to /user/.fonts

But this way its available only to particular user(s).

Also we can open the virtual fonts folder thru nautilus for GNOME, by Open Locatiom --> fonts:

or by,

# nautilus fonts:

Again this restricts to particular user(s).

For bitmapped fonts,

Please refer https://wiki.ubuntu.com/FontInstallHowto

Friday, June 02, 2006

Installation Procedure for IITM Multi-Lingual Editor...

Download the following iitmeditor gzipped files into your desired directory
(i) iitmed_linux.tar.gz
(ii) support_files.tar.gz

Link: http://acharya.iitm.ac.in/software/Linux_ed.html

Unzip these downloaded files using gunzip command
(i) gunzip iitmed_linux.tar.gz
(ii) gunzip support_files.tar.gz

Become root (su) and do the following.

(i) mv support_files.tar /usr/local/share/
(ii) cd /usr/local/share/
(iii) tar -xvf support_files.tar

Untar 'iitmed_linux.tar' into your desired directory (/ directory is chosen)

$ tar -xvf iitmed_linux.tar [please note $ is shell prompt]

Now add the IITM Fonts(Multi-lingual fonts) to the set recognized by X11.

$ cd multlingeditor/
$ cd LLfonts/
$ ./addfonts.sh
$ cd ..
$ ./iitmeditor

Now the editor is ready for use.

Wednesday, May 31, 2006

Drupal.. beginning...

Download " drupal-4.7.1.tar.gz" from drupal.org

Uncompress using,

# tar xvfz drupal-4.7.1.tar.gz

Put the uncompressed folder "drupal-4.7.1" to "/var/www"

/var/www/drupal-4.7.1/INSTALL.mysql.txt was useful in enabling mySQL to work with Drupal..

Already a database named "samarpanam" has been created...

So time to..do the drupal config..

edit "/var/www/drupal-4.7.1/sites/default/settings.php" and change

$db_url = "mysql://username:password@localhost/databasename"; line to suit local needs...

Save the file...

More details @ http://drupal.org/node/260

http://127.0.0.1:81/drupal-4.7.1/ in my mozilla browser gave the drupal site.... :-)

mySQL contd....

As said was a bit scared abt mySQL earlier... But Drupal demanded mySQL in place, so no other go!!

For standard configuration,

# cd /usr

# sudo ./bin/mysql_install_db --user=mysql

To know mySQL version,

# /usr/bin/mysqladmin version

To shut down,

# /usr/bin/mysqladmin -u root shutdown

To start back.

# /usr/bin/mysqld_safe --user=mysql &

Try the following,

# /usr/bin/mysqlshow

# /usr/bin/mysqlshow mysql

# /usr/bin/mysql -e "SELECT * FROM db" mysql

# mysqladmin -u root -p create samarpanam --> creates a database samarpanam...

To access database thru console:

# mysql -u root

Follow the syntax below for root password,

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');

and this to create a new user,

mysql> GRANT ALL PRIVILEGES ON *.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

'-p' has to be appended to all commands to execute since password has been set.

http://dev.mysql.com/doc/refman/5.0/en/unix-post-installation.html

is the real companion to proceed further i believe...

Java Plugin for Mozilla...

I think the file in the following path need to be linked to mozilla plugin,

/jdk1.5.0_07/jre/plugin/i386/ns7/libjavaplugin_oji.so

How to do that?

Go to,

# /usr/lib/mozilla/plugins

then create a Symbolic link using,

# ln -s /jdk1.5.0_07/jre/plugin/i386/ns7/libjavaplugin_oji.so .

Restart Mozilla. Goto Edit ---> Preferences ---> Plug-ins to check successful installation of plugin.

More details can be had from,

http://java.sun.com/j2se/1.5.0/manual_install_linux.html

Tuesday, May 30, 2006

Installing and Configuring Java+Tomcat..

Now that Apache2+PHP+MySQL is working fine up to me, its time to install and configure Java+Tomcat.

Installing and configuring Java:

http://java.sun.com/j2se/1.5.0/install-linux.html was really useful in this account.

From http://java.sun.com/j2se/1.5.0/download.jsp downloaded "jdk-1_5_0_07-linux-i586.bin"

To set permissions,

# chmod +x jdk-1_5_0_-linux-i586.bin

Copied jdk-1_5_0_07-linux-i586.bin to / directory.

# ./jdk-1_5_0_-linux-i586.bin (Execute the downloaded file, prepended by the path to it. For example, if the file is in the current directory, prepend it with "./")

Folder "jdk1.5.0_07" was created under / directory.

To Set Java environment variables:

# export JAVA_HOME=/jdk1.5.0_07/

# export PATH=$PATH:$JAVA_HOME/bin

Installation and Configuration of Tomcat:

From "http://tomcat.apache.org/download-55.cgi" downloaded apache-tomcat-5.5.17.tar.gz

# tar xvfz apache-tomcat-5.5.17.tar.gz

Copy the folder "apache-tomcat-5.5.17" to /usr/local

Open,

# gedit ~/.bashrc and add the following to the file,

#Stuff we added to make tomcat go
export JAVA_HOME=/jdk1.5.0_07/
export CLASSPATH=/usr/local/apache-tomcat-5.5.17/common/lib/jsp-api.jar:/usr/local/apache-tomcat-5.5.17/common/lib/servlet-api.jar


To start Tomcat,

# sh /usr/local/apache-tomcat-5.5.17/bin/startup.sh

and following has to appear

Using CATALINA_BASE: /usr/local/apache-tomcat-5.5.17
Using CATALINA_HOME: /usr/local/apache-tomcat-5.5.17
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-5.5.17/temp
Using JRE_HOME: /jdk1.5.0_07/

Now,

8080 is the default port and so,

http://127.0.0.1:8080/ should open the "Apache Software Foundation" properly from Mozilla.

To b contd...

Monday, May 29, 2006

Installing and Configuring Apache2+PHP+MySQL

My PC runs on Ubuntu. And just thought of configuring Apache2+PHP+MySQL

How do i do that?

https://wiki.ubuntu.com/ was really useful on this account.

Just typed PHP on the search window and it populated few results that took me to,

https://wiki.ubuntu.com/ApacheMySQLPHP?highlight=%28php%29

Installing Apache:

As root user run,

# aptitude install apache2

Installing PHP:

As root user run, and i preferred PHP4,

# aptitude install php4

Now its the turn for mySQL,

# aptitude install mysql-server
# aptitude install libapache2-mod-auth-mysql
# aptitude install php4-mysql


For want of GUI admin for mySQL and PHP admin did the following,

# aptitude install phpmyadmin

# aptitude install mysql-admin


Then follows the mySQL configuration which am yet to do and jumped to "PHP Configuration to Work With MYSQL"

To achieve this,

# gedit /etc/php4/apache2/php.ini

and remove the ";" before the line ";extension=mysql.so"

Commands used for Apache Start/ Stop/ Restart,

# /usr/sbin/apache2ctl start
# /usr/sbin/apache2ctl stop
# /usr/sbin/apache2ctl restart


To check PHP's fine funtioning,

# gedit /var/www/testphp.php

and add php phpinfo(); inside php tag and Save.

On mozilla browser, at http://127.0.0.1/testphp.php or http://localhost/testphp.php, I got the successful output.

This was working fine till i rebooted my PC.

Apache is not actually parsing the php after i rebooted my PC.

I believe port 80 used default by Apache was occupied and hence the problem.

# netstat -nap --inet|grep -w 80|grep -i listen

used the above command to plot which process is occupying port 80 and killed the process and restarted Apache and it started working fyn :-)

In order to fix this,

# gedit /etc/apache2/ports.conf

and changed "Listen 80" to "Listen 127.0.0.1:81"

This will also prevent it from listening for incoming connection attempts.

Now rebooting was not a problem and

http://127.0.0.1:81/ is running without parsing problems.

To be contd....