Accessing drives/partitions Commands in linux

October 10, 2009

mount See here for details on mounting drives. Examples are shown in the next commands. mount -t auto /dev/fd0 /mnt/floppy (as root) Mount the floppy. The directory /mnt/floppy must exist, be empty and NOT be your current directory. mount -t auto /dev/cdrom /mnt/cdrom (as root) Mount the CD. You may need to create/modify the /dev/cdrom file depending where your CDROM is. The directory /mnt/cdrom must exist, be empty and NOT be your current directory. mount /mnt/floppy (as user or root) Mount a floppy as user. The file /etc/fstab must be set up to do this. The directory /mnt/floppy must not be your current directory. mount /mnt/cdrom (as user or root) Mount a CD as user. The file /etc/fstab must be set up to do this. The directory /mnt/cdrom must not be your current directory. umount /mnt/floppy Unmount the floppy. The directory /mnt/floppy must not be your (or anybody else’s) current working directory. Depending on your setup, you might not be able to unmount a drive that you didn’t mount.


Welcome to Red Hat Linux

October 10, 2009

Linux Hardware Requirements

  • Pentium Pro or better with 256 MB RAM Or 64-bit Intel/AMD with 512 MB RAM
  • 2-6 GB disk space
  • Bootable CD
  • Other processor architectures supported
  • Itanium 2, IBM Power, IBM Mainframe

Fundamentals of Linux

  • Introduction
  • Linux is an open source operating system with highly advanced features.
  • Topics
  • Brief History of Linux
  • Why is Linux?
  • Linux Distributions

Brief History of Linux

  • Linux was originally developed by Linus Torvald in 1991.
  • Linux is distributed under the GNU licenses.
  • GNU stands for Gnu Not UNIX, it is an open source movement started by Richard Stallman in the year 1984.
  • The main aim of GNU is to provide the O.S and its source code freely.

Why Linux?

  • Linux is an Open Source Software
  • Multi-user and multi-tasking
  • Supports most of modern PC hardware
  • Fully supported distribution

Linux Distributions

  • To install Linux, choose a Linux Distribution
  • A distribution is the Linux kernel, plus an installation program, plus some set of applications
  • There are four general distributions
  • RedHat
  • SuSE
  • Mandriva Linux
  • Debian
  • The Red Hat and SuSE distributions are produced by companies by the same names.
  • They aim at providing an easy installation procedure, and for a pleasant desktop experience. They are also good as servers, sold in boxes, with an installation CD and printed manual. Both can also be downloaded via the network.
  • Mandriva Linux (also known as Mandrake Linux) was originated by Gael Duval.
  • Mandriva Linux is also notable for compiling its packages with optimizations for Pentium-class and more advanced processors which are incompatible with older CPU versions such as 386 and 486.
  • The Debian distribution is produced by a volunteer organization.
  • Its installation is less easy: You have to answer questions during the installation the other distributions deduce automatically. Nothing complicated as such, but requiring understanding of and information about hardware most PC users don’t want to worry about.
  • On the other hand, after installation, Debian can be upgraded to each new release without re-installing anything.

Linux and Windows XP/2000 dual boot

October 10, 2009
  1. Use fdisk to partition your drive properly.
  2. Download an burn 3 Mandrake 8.2 CDs or your favorite distro
  3. Install Windows XP/2000 on the first partition, make sure you use fat 32 as your file system, not xp ntfs
  4. Start your Linux Installation and install the /root directory into the second partition.
  5. Install GRUB into the first sector of your boot partition (usually /boot) and not in the MBR. (Note there are reported problems with lilo)
  6. Make a boot disk during the Linux installation if possible so that you can boot into it.
  7. Now boot into Linux and copy the boot image from the boot sector. To do this run:
  8. dd if=/dev/hdan of=/bootsect.lnx bs=512 count=1
  9. , where /dev/hdan is the location of /boot and /bootsect.lnx is the Linux boot image.
  10. Copy this bootsect.lnx file to a safe location where you can reach it using Windows.
  11. Reboot into Windows XP/2000 and copy this bootsect.lnx file into the root directory (C:\).
  12. Edit c:\boot.ini and append the following line: c:\bootsect.lnx=”Linux”.
  13. Reboot your system and boot directly from the hard disk.
  14. The Windows XP/2000 boot loader should now give you the option of booting into either Windows XP/2000 or Linux.
  15. Try booting into both of them to see if you were successful.
  16. Troubles and shooting
  17. What to do if if the actual boot code is *not* installed in /boot, but in the MBR?
    When the system gets ready to make the boot sector, it creates a file in /boot
    called boot.xxxx where xxxx is some number. (In his case, it was 0300 again IIRC.) This file is 512 bytes long to match the boot sector size. Copy this file into the bootsect.lnx
    and boot into Linux.
  18. Your Master Boot Record (MBR) is toast
    type: lilo -u /dev/hda in linux to remove lilo
    Boot to MS-DOS and type fdisk /mbr

How to setup PHP My Admin:

October 10, 2009

Download PHPMyAdmin from the home page:

cd /root/

wget http://internap.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.11.9.5-english.zip

cp phpMyAdmin* /var/www

cd /var/www/

unzip phpMyAdmin-2.11.9.5-english.zip

ln -s phpMyAdmin-2.11.9.5-english phpmyadmin

chown apache:apache phpMyAdmin* -R

rm -f phpMyAdmin-2.11.9.5-english.zip

Edit the create tables file , and enable the GRANT line with proper password:-

vi /var/www/phpmyadmin/scripts/create_tables_mysql_4_1_2+.sql


CREATE DATABASE IF NOT EXISTS `phpmyadmin`

DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

USE phpmyadmin;


– Privileges

– (activate this statement if necessary)

GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO ‘pma’@localhost identified by ‘phpsecret’;

Create PHPMyAdmin schema in MySQL server:-

[root@www scripts]# mysql -u root -psecretpassword < create_tables_mysql_4_1_2+.sql

Create Apache config file for PHPMyAmdin:-

vi /etc/httpd/conf.d/phpmyadmin.conf

Alias /phpmyadmin /var/www/phpmyadmin

<Location /phpmyadmin>

Order allow,deny

Allow from all

</Location>

Create web server writable folder config in phpMyAdmin toplevel directory:

cd /var/www/phpmyadmin

mkdir /var/www/phpmyadmin/config

mkdir /var/www/imports

mkdir /var/www/exports

chown apache:apache /var/www/phpmyadmin/ -R

Now run the phpmyadmin setup script, from the browser:

http://example.com/phpmyadmin/scripts/setup.php

Once the setup starts, select secure connection.

Features-Security : Force SSL

Upload Directory: /var/www/phpmyadmin/imports

Save Directory: /var/www/phpmyadmin/exports

Configuration-Save: Save the config file.

Configuration will be saved to file config/config.inc.php in phpMyAdmin top level directory, copy it to top level one and delete directory config to use it.

[root@www phpmyadmin]# mv config/config.inc.php .

[root@www phpmyadmin]# rm -fr config

Once completed. Open this URL and start using PHPMyAdmin:

https://example.com/phpmyadmin/

Each user can login using the name of his own DB user and password.

Manual steps:

[root@www phpmyadmin]# mv config.sample.inc.php config.inc.php

vi config.inc.php

$cfg[‘blowfish_secret’] = ’secret’; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

/* Authentication type */

$cfg[‘Servers’][$i][‘auth_type’] = ‘http’;

/* Server parameters */

$cfg[‘Servers’][$i][‘host’] = ‘localhost’;

$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;

$cfg[‘Servers’][$i][‘compress’] = false;

/* Select mysqli if your server has it */

$cfg[‘Servers’][$i][‘extension’] = ‘mysql’;

/* User for advanced features */

$cfg[‘Servers’][$i][‘controluser’] = ‘pma’;

$cfg[‘Servers’][$i][‘controlpass’] = ‘phpsecret’;

/* Advanced phpMyAdmin features */

$cfg[‘Servers’][$i][‘pmadb’] = ‘phpmyadmin’;

$cfg[‘Servers’][$i][‘bookmarktable’] = ‘pma_bookmark’;

$cfg[‘Servers’][$i][‘relation’] = ‘pma_relation’;

$cfg[‘Servers’][$i][‘table_info’] = ‘pma_table_info’;

$cfg[‘Servers’][$i][‘table_coords’] = ‘pma_table_coords’;

$cfg[‘Servers’][$i][‘pdf_pages’] = ‘pma_pdf_pages’;

$cfg[‘Servers’][$i][‘column_info’] = ‘pma_column_info’;

$cfg[‘Servers’][$i][‘history’] = ‘pma_history’;

$cfg[‘Servers’][$i][‘designer_coords’] = ‘pma_designer_coords’;

That should be all !

Regards,

Kamran (wbitt.com)