Pages

Wednesday, May 25, 2011

MYSQL BUILDING FROM THE SCRATCH

                         MYSQL INSTALLATION
# Create mysql group and user with a particular gid and uid.
/usr/sbin/groupadd -g 525 mysql
/usr/sbin/useradd -u 525 -g 525 -s /bin/bash -d /opt/mysql mysql
# Download mysql source.
cd /opt/src
wget http://www.percona.com/mysql/community/mysql-5.1.42.tar.gz
# Copy source file to mysql home directory.
cp /opt/src/mysql-5.1.42.tar.gz /opt/mysql
/bin/chown -R mysql.mysql /opt/mysql
/bin/chmod 755 /opt/mysql
# Switch to mysql user.
su - mysql
cd /opt/mysql
# Extract the source file.
tar -zxvf /opt/mysql/mysql-5.1.42.tar.gz
cd mysql-5.1.42
# Configure mysql.
./configure --prefix=/usr/local/ --enable-thread-safe-client --with-
unix-socket-path=/var/tmp/unix.sock --with-tcp-port=3306 --with-
mysqld-user=mysql --with-openssl --with-innodb --with-docs --enable-
static --localstatedir=/var/mysql/data
# Make
/usr/bin/make
# Now as root user.
cd /opt/mysql/mysql-5.1.42
/usr/bin/make install
# Copy mysql configuration file to '/etc/my.cnf'.
cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
# Uncomment innodb lines in the conf file.
/bin/sed -ie 's/#innodb/innodb/g' /etc/my.cnf
/bin/chown mysql.mysql /etc/my.cnf
/bin/chmod 600 /etc/my.cnf
# Copy the startup script to /etc/init.d/mysqld.
cp /usr/local/share/mysql/mysql.server /etc/init.d/mysqld
/bin/chmod 744 /etc/init.d/mysqld
# Add the lib files path to /etc/ld.so.conf.
/bin/echo /usr/local/lib/mysql/ >> /etc/ld.so.conf
/sbin/ldconfig
/sbin/chkconfig --add mysqld
/sbin/chkconfig mysqld on
# Create the mysql data directory.
/bin/mkdir /var/mysql
/bin/chown -R mysql.mysql /var/mysql
# As mysql user create initial databases.
su - mysql
/usr/local/bin/mysql_install_db
# Now as root start mysql daemon.
/sbin/service mysqld start
# Set a password for root user if required.
/usr/local/bin/mysqladmin -u root password 'passpass'

Sunday, May 22, 2011

SOLARIS FILE SYSTEMS

1. To mount all the file system

# mountall

2. to unmount all the file system

# umnontall

3. To display the information about the file system that are currently mounted

# mount -v  (This infoemation is taken from /etc/mnttab)

4. To list the process that are accessing trhe system

# fuser -c

5.  Steps to unmount a file system

# umount /export/home

umount: /export/home busy

# fuser -c /export/home

/export/home: 9002o

# ps -ef | grep 9002

root 9002 8979 0 20:06:17 pts/1

0:00 cat
# fuser -c -k /export/home

/export/home: 9002o
[1]+ Killed  cat >/export/home/test

# umount /export/home





6.

Saturday, May 21, 2011

REMOVING ROOT PASSWORD OF MYSQL DB

Go to mysql prompt with

# mysql -u root

> use mysql;

>Select Host,  User, Password from User;


> update user set password = '' where user = 'root' and host = 'localhost';

Friday, May 20, 2011

CONFIGURING WU-FTPD DEAMON IN SOLARIS

1. To check port 21 id listening or not.
# netstat -anP tcp | grep 21

 *.21                 *.*                0      0 49152      0 LISTENThe Output like above means that it is lis-tening in all the ip address.

2. FTPD is running and it bind to its default port 21 in Solaris by default unless you make changes to the SMF configuration. SMF controls the service configuration for FTP in Solaris.

# svcs -a | grep ftp

online         Dec_20   svc:/network/ftp:default

This means that it is currently up and online.

3. To get more information on ftp
# svcs -l ftp

The ouput will be:

fmri         svc:/network/ftp:default
name         FTP server
enabled      true
state        online
next_state   none
state_time   Wed Dec 20 00:00:54 2006
restarter    svc:/network/inetd:default


4. To  list the FTP packages installed.

# pkginfo -x | grep -i ftp

SUNWftpr                          FTP Server, (Root)
SUNWftpu                          FTP Server, (Usr)
SUNWncft                          NcFTP - client application implementing FTP
SUNWtftp                          Trivial File Transfer Server
SUNWtftpr                         Trivial File Transfer Server (Root)

5. TO LIST ALL THE INFORMATION REGARDING THE PACKAGE SUNWftpu
 
 # pkginfo -l SUNWftpu

6. TO CHECK THE INCLUDED FILEs IN THE USER PACKAGE of wuftpd.

# pkgchk -l SUNWftpu | grep -i pathname

Pathname: /usr
Pathname: /usr/sbin
Pathname: /usr/sbin/ftpaddhost
Pathname: /usr/sbin/ftpconfig
Pathname: /usr/sbin/ftpcount
Pathname: /usr/sbin/ftprestart
Pathname: /usr/sbin/ftpshut
Pathname: /usr/sbin/ftpwho
Pathname: /usr/sbin/in.ftpd
Pathname: /usr/sbin/privatepw

ftpwho - gives the connected users and process information.
ftpcount - dump classes per count.
ftpconfig - Is used to configure anonymous as well as guest ftp.
in.ftpd - This is the main daemon runs in background and bind the port 21.
/etc/ftpd - Thsi directory houses the main configuration files.

6. SUNWftpr - This includes server side configuration files.

# pkgchk -l SUNWftpr | grep -i pathname

Pathname: /etc
Pathname: /etc/ftpd
Pathname: /etc/ftpd/ftpaccess
Pathname: /etc/ftpd/ftpconversions
Pathname: /etc/ftpd/ftpgroups
Pathname: /etc/ftpd/ftphosts
Pathname: /etc/ftpd/ftpservers
Pathname: /etc/ftpd/ftpusers
Pathname: /var
Pathname: /var/svc
Pathname: /var/svc/manifest
Pathname: /var/svc/manifest/network
Pathname: /var/svc/manifest/network/ftp.xml


7. SUNWftpr - Includes server side configuration files.
/etc/ftpd

ftpaccess - Primary configuration files for wu-ftpd.
ftphosts- This allow admins to define allow | deny access to certain hosts.
ftpservers- This allow admins to define virtual hosts.
ftpusers - users listed may not access via ftp.
ftpconversations- facilitates the support for tar gz and compress support.

8. Wu-Ftpd support both type of ftp connection.
1. PORT - Active FTP
In this type of connection client make TCP:21 server control connection.
When the client executes ls results in server initiating a connection back to client back usually TCP 20 (ftp-data)

2. PASSIVE - Passive FTP
In this type of connection client connect to the TCP \ port 21 at first. After that when execute a command called ls or any other command, server open a high port and instructing the client to source connection to the server. Then the client sources a connection to the high port on the server ( data connection).

NOTE: In passive FTP connection firewall is not necessary in corporate firewall because client is sourcing the connection.











SOLARIS QUOTAS

Quota supports 2 feature they are
1. Softlimit
2.Hardlimit

Softlimit is a warning stage.

When a user exceed softlimit system will log it in to the logs and begin a timer which last for 7 days.
Suppose our softlimit is 100mb and a user exceeds beyond the timer softlimit become hardlimit.


HardLimit

Hardlimit act as a storage sealing. A user can never exceed the hardlimit.  If the user meets the hard limit system will not allocate the storage space.

File system perspective of quotas
1. BLOCKS
2. INODES

Each file may be represented by each inode and datablocks. We can define the quota based on

Quota Tools

1. edquota
2. quotacheck -used to check consistencies against current usage.
3. quotaon - Enables quotas on file system.
4. repoquota -  Display quota information.


Steps to Enable Quota support
Modify /etc/vfstab to enable quota support per file system.
Modify the mount options  columns.


Create empty quotas file in /export/home/quotas && chmod 600 /export/home/quota
 # nano /etc/vfstab
/dev/dsk/c1d0s7 /dev/rdsk/c1d0s7        /export/home    ufs     2       yes     rq

#touch /export/home/quotas && chmod 600 /export/home/quotas

TO SETUP QUOTA FOR THE USER VASANTH USING FILE LIMIT


[root@solaris1 /]# edquota vasanth

fs /export/home blocks (soft = 5000, hard = 10000) inodes (soft = 0, hard = 0)

:wq
This will set quota for the user vasanth.
TO SETUP THE SAME QUOTA POLICY FOR THE ANOTHER USERS PLEASE DO THE STEPS.

# edquota -p user1 user2 user3 user4

TO CHECK THE SUPPORTED FILE SYSTEMS IN OUR LOCAL SYSTEM

# quotacheck -va
*** Checking quotas for /dev/rdsk/c1d0s7 (/export/home)

TO CHECK THE USAGE DETAILS OF PARTICULAR USER

# quota -v vasanth
Filesystem     usage  quota  limit    timeleft  files  quota  limit    timeleft
/export/home       0   5000  10000                  0      0      0


TO ENABLE QUOTA SUPPORT ON PARTICULAR SLICE.


# quotaon -v /dev/dsk/c1dos7

TO DISABLE QUOTA SUPPORT

# quotaoff -va
This will turn off quota for all the file system













Friday, May 13, 2011

SOLARIS DISK PARTITIONING

DISK TERMINOLOGY

Disk contain the following components.

1. Tracks
2. Cylinders
3.Sectors/Blocks


Tracks
-----------
Tracks are the concentric ring on the each paltter .

Cylinder
-----------
Groups of tracks

Sectors/Blocks
----------------

512 byte block. Which is the smallest unit represented in hardisk.


Partition with Solaris is AKA slices


To display the Slices with in the harddisk.

#df -h

X86 PCS are limited to 4 primary partitions. Normally x86are divided in to 3 primary and 1 extended.

NOTE:Solaris need one fdisk Partition for it's use.

If you want to add another harddrive disk1

1. Create fdisk partion for Solaris use

2. Then Create  Slices

NOTE: Solaris uses a VTOC(VOLUME TABLE OF CONTENT) to represent the various slices with long fdisk partition on the disk. On the Sparc  Solaris uses VTOC to represent al the slices.

SLICE RULES USING VTOC
---------------------------------

1, Slices may created using VTOC on X86
2. These 10 slicers are represented by 0 to 9.
3. Slices 2,8,9 are reserved. Slice 2 is reserverd for VTOC
NOTE: VTOC Represent the disk label and occupying slice2
4. Slices 0,1,3,6,7 are avilable for use.

Root file system is slice 0.

PRINT VROC/DISKLABEL USING

# prtvtoc /dev/dsk/c0t0d0s0

C0 - Controller Number ## 1st controller
t0- Identifier for the bus orientated controller SCASI/SATA ### For IDE hardisk t0 is not present.
d0 - Represents disk number.
s0- Slice0

VTOC information contain entair diskinformation.

FORAMAT UTILITY
------------------------

1. To open the format utility

# format

2. To list the disk attached to the system

format> disk

3. To select a disk

Enter the disk Number want to select and put enter.

4. To discribe the current disk

format> Current

The output of the above command is shown below.

Current Disk = c1d0

/pci@0,0/pci-ide@1f,2/ide@1/cmdk@0,0



5, In the format menu we can get help by pressing question mark or help

6. Inside format tool there is a utilty called format. To format the a selected disk use the following steps.

format> disk

select the disk you want to format

format > format


select partition setup in the format menu.

format> partition

The above partion command will list the avilabe slices.
Select the slice number from there.

partition> 5
Then it will prompt for


Enter partition id tag : put an enter there.
Enter partition permission: put an enter there
Enter new starting cyl: Enter here a new cyl starting


This will create a slice.


Format the slice using the the utility

# newfs /dev/rdsk/c0d0s6

# mount /dev/dsk/c0d0s6 /mnt




.






















































Tuesday, May 10, 2011

Changing hostname in solaris

Change the hostname in the following files:

/etc/nodename
/etc/hostname.*interface
/etc/inet/hosts
/etc/inet/ipnodes

and rename directory under /var/crash

# cd /var/crash
# mv oldname newname

then reboot the server.

Sunday, May 1, 2011

DEVICES IN SOLARIS

1. If the Solaris Fault Management system detects a problem with a device, mes-
sages about the problem can be displayed by using the following command

# fmdump

NOTE: Messages are also traditionally written to the console and to the /var/adm/messages file. If the Fault Management system takes a device offline, the message “(retired)” is displayed in the prtconf output.

2. To view the device information from shell run the following command

# prtconf

NOTE:  It also give the amount of system memory available in our system. 

3 . To display the driver being used for the corresponding devices

# prtconf -D

4. To view the more output

# prtconf -pv

NOTE: The advantage of prtconf is it can be run by any user.

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

X86 based Systems
--------------------------------

In x86 based systems we can display the device information using


# /usr/X11/bin/scanpci

or

# /usr/X11/bin/scanpci  -v  ( It provide more verbose output )

####KERNEL MODULES IN SOLARIS #########################

The location of kernel modules in Solaris is as follows.

/kernel/drv (default location for most leaf-node drivers)
/kernel/misc
/usr/kernel/drv
/usr/kernel/misc
/platform/i86pc/kernel/drv
/platform/i86pc/kernel/misc

5.To check the Loaded Modules information
------------------------------------------------------------

# modinfo | grep driver name


6.To determine whether the kernel is running in 32 or 64 bit mode

# lsainfo -kv


7. To manually load a kernel module

# modload /kernel/drv/amd64/e1000g

# modinfo | grep  e1000g

8. To get more verbose driver module information

# strings /kernel/drv/amd64/e1000g | grep -i  ver

9.To check which drivers are bound to which devices

# cat  /etc/driver_aliases

NOTE: The file has the format of driver name followed by device name