The Sky is not the limit

Entries tagged as ‘linux’

#2002 – The server is not responding (or local MySQL server’s socket is not correctly configured).

March 14, 2009 · 1 Comment


Issue : -

While accessing PhpMyAdmin getting the following error.


ERROR
#2002 – The server is not responding (or local MySQL server’s socket is not correctly configured).

Reason :-

The  mysql socket file is missing from the /tmp directory

Fix :-

1. Create a symbolic link from the original mysql socket file to /tmp

[root@test ~]# ln -s /var/lib/mysql/mysql.sock /tmp

OR

2. Restart MySQL service from WHM

WHM Login >> Main >> Restart Services >>SQL Server (MySQL)

OR

3.  Edit the PhpMyAdmin configuration file to use the original MySQL socket file.

vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

Make sure, the correct mysql socket file is mentioned there.
~~~~~~~~~~~~~~~~
$cfg['Servers'][$i]['socket'] = ‘/var/lib/mysql/mysql.sock’;
$cfg['Servers'][$i]['connect_type'] = ’socket’;
~~~~~~~~~~~~~~~~


Categories: Linux tutorials · cPanel
Tagged: , , , , ,

How to use parted for creating patition larger that 2 TB ?

August 23, 2008 · 1 Comment

To create partitions larger than 2TB we need to use GPT labels. Standard fdisk doesn’t understand GPT labels so we need to use parted.

Here we are going to partition the disk /dev/sdb

root@localhost ~> parted /dev/sdb

This will bring up parted.  Type help to view the commands in parted prompt.

(parted) help
check NUMBER                             do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition
help [COMMAND]                           prints general help, or help on COMMAND
mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
mkfs NUMBER FS-TYPE                      make a FS-TYPE file system on partititon NUMBER
mkpart PART-TYPE [FS-TYPE] START END     make a partition
mkpartfs PART-TYPE FS-TYPE START END     make a partition with a file system
move NUMBER START END                    move partition NUMBER
name NUMBER NAME                         name partition NUMBER as NAME
print [free|NUMBER|all]                  display the partition table, a partition, or all devices
quit                                     exit program
rescue START END                         rescue a lost partition near START and END
resize NUMBER START END                  resize partition NUMBER and its file system
rm NUMBER                                delete partition NUMBER
select DEVICE                            choose the device to edit
set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
unit UNIT                                set the default unit to UNIT
version                                  displays the current version of GNU Parted and copyright information

root@localhost ~> parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted)

To change the label to gpt we run the following command:

(parted) mklabel gpt

Next run the print command: This will list the disk geometry. Please note the size listed:

(parted) print

Model: Adaptec raid5-1 (scsi)
Disk /dev/sdb: 10.7TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags

This will tell us where to start and end the partitions. To create one huge partition ( 8 Tb = 8388608 bytes) run the following commands:

(parted) mkpart primary 0 8388607.000

The command reads as make a primary partition, start at 0 and end at 8388607.000

Also, if you are making a partition for a device smaller than the limit from the notes below, you can use the following if the geometry doesn’t show like it does above. Just exit out of parted, and run this from a shell:

root@localhost ~> parted -s — /dev/sdb  mkpart primary ext3 0 -1

This will take the whole disk for creating the partition.

The parition has been created and now you can quit parted:
(parted) quit

Now all that has to be done is to format the partition:(the -m swith tells mkfs to only reserve 1% of the blocks for the super block)

root@localhost ~> mkfs.ext3 -m1 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1024000000 inodes, 2047999751 blocks
20479997 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
62500 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mount the disk

root@localhost ~> mount /dev/sdb1 /disk1

root@localhost ~> df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             240G  2.3G  225G   2% /
/dev/sda1             996M   45M  900M   5% /boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm
/dev/sdb1             7.6T  177M  7.5T   1% /disk1

Now edit /etc/fstab to mount the partiton automatically on boot.

root@localhost ~>vi /etc/fstab

Add the following  line  in /etc/fstab

/dev/sdb1     /disk1   ext3    defaults        0 0

Reference :-  http://www.gnu.org/software/parted/manual/html_mono/parted.html

Categories: Linux tutorials
Tagged: , , , , ,

How to set time zone..?

January 18, 2008 · Leave a Comment

In Cpanel Servers you can set the system time according to your time zone. Follow the below mentioned steps for this.

1. Select the appropriate time zone from the /usr/share/zoneinfo directory. Time zone names are relative to that directory. (eg :- Pacific/Easter)

ls /usr/share/zoneinfo

2. Edit the /etc/sysconfig/clock text file so that it looks like this:

ZONE=”Pacific/Easter”
UTC=true
ARC=false
3. Move the following file: /etc/localtime to back

mv /etc/localtime /etc/localtime_bak

4. Create a new soft link for /etc/localtime.

ln -s /usr/share/zoneinfo/Pacific/Easter /etc/localtime

5. Set the Hardware clock by typing the following command

/sbin/hwclock –systohc

6. Verify the time by typing the command date.

Categories: cPanel
Tagged: , , ,

How to add additional disks in Linux based Servers

January 18, 2008 · 1 Comment

To add and partition secondary disks in a linux server follow the steps.

1.  Login to server as root.

2.  Run the command      fdisk -l

You can see the new disk like /dev/sdb

3.   To format and partition the disk run the following commands.

fdisk /dev/sdb

#  m –> prints all commands
#  n  –>  to create a new partition
#  d –>  to delete a  existing partition
#  p –>  for primary partition
#  1 –>  for 1st partition
#  w –>  to write and exit

4. To create the filesystem in the new partition run the following command.

mkfs.ext3 /dev/sdb1

5.  To mount the created partition in the server as /disk2 .

#   mkdir /disk2

#    vi  /etc/fstab  (Edit fstab for the new disk add the following line )

/dev/sdb1               /backup                 ext3    defaults        0 0

#   mount  -a ( To mount the devices entered in fstab)

#  df -h (  To verify the mounted devices )

Categories: Linux tutorials
Tagged: , , , , ,

Installing packages in Free BSD

January 3, 2008 · 2 Comments

Installations
in Free BSD using packages & ports

 

 

 

FreeBSD provides two complementary technologies for installing third-party software on your system: the FreeBSD Ports Collection (for installing from source), and packages (for installing from pre-built binaries). Either method may be used to install the newest version of your favorite applications from local media or straight off the network. By installing from the port, you can
tweak the compilation options to (for example) generate code that is specific to a Pentium 4 or Athlon processor.By building from the port you do not have to accept the default options, and can set them yourself.

 

 

Finding Your Application :-
Before you can install any applications you need to know what you want, and what the application is called.

 

The FreeBSD web site maintains an up-to-date searchable list of all the available applications, at
http://www.FreeBSD.org/ports/. The ports are divided into categories, and you may either search for an application by name (if you know it), or see all the applications available in a category.

 

If you know the exact name of the port, but just need to find out which category it is in, you can use the whereis command. Simply type whereis file, where file is the program you want to install. If it is found on your system, you will be told where it is, as follows:

 

# whereis lsof

lsof:
/usr/ports/sysutils/lsof

 

This tells us that lsof (a system utility) can be found in the /usr/ports/sysutils/lsof directory.

 

Yet another way to find a particular port is by using the Ports Collection’s built-in search mechanism. To use the search feature, you will need to be in the /usr/ports directory. Once in that directory, run make search name=program-name where program-name is the name of the program you want to find. For example, if you were looking for lsof:

 

# cd /usr/ports

# make search
name=lsof

Port:
lsof-4.56.4

Path:
/usr/ports/sysutils/lsof

Info: Lists
information about open files (similar to fstat(1))

Maint:
obrien@FreeBSD.org

Index: sysutils

B-deps:

R-deps:

 

  1. Installing a Package

     

You can use the pkg_add utility to install a FreeBSD software package from a local file or from a server on the network.

 

# ftp -a
ftp2.FreeBSD.org

Connected to ftp2.FreeBSD.org.

220
ftp2.FreeBSD.org FTP server (Version 6.00LS) ready.

331 Guest login
ok, send your email address as password.

230-

230- This
machine is in Vienna, VA, USA, hosted by Verio.

230-
Questions? E-mail freebsd@vienna.verio.net.

230-

230-

230 Guest login
ok, access restrictions apply.

Remote system
type is UNIX.

Using binary mode
to transfer files.

ftp> cd
/pub/FreeBSD/ports/packages/sysutils/

250 CWD command
successful.

ftp> get
lsof-4.56.4.tgz

local:
lsof-4.56.4.tgz remote: lsof-4.56.4.tgz

200 PORT command
successful.

150 Opening
BINARY mode data connection for ‘lsof-4.56.4.tgz’ (92375 bytes).

100%
|**************************************************| 92375
00:00 ETA

226 Transfer
complete.

92375 bytes
received in 5.60 seconds (16.11 KB/s)

ftp> exit

# pkg_add
lsof-4.56.4.tgz

 

If you do not have a source of local packages (such as a FreeBSD CD-ROM set) then it will probably be easier to use the -r option to pkg_add.

 

# pkg_add -r lsof

 

 

 

Managing Packages

 

# pkg_info lsof

# pkg_version lsof

# pkg_delete lsof

All package information is stored within the /var/db/pkg directory. The installed file list and descriptions of each package can be found within files in this directory.

 

========

5. Using the Ports Collection

 

 

 

Before you can install ports, you must first obtain the Ports Collection–which is essentially a set of
Makefiles, patches, and description files placed in /usr/ports. Make sure /usr/ports is empty before
you run CVSup for the first time! If you already have the Ports Collection present, obtained from another source, CVSup will not prune removed patch files.

 

1. Install the net/cvsup-without-gui package:

 

# pkg_add -r cvsup-without-gui

 

2. Run cvsup:

 

# cvsup -L 2 -h cvsup.FreeBSD.org /usr/share/examples/cvsup/ports-supfile

 

Alternate method:- Portsnap Method

 

# pkg_add -r portsnap

 

# mkdir /usr/ports

 

# portsnap fetch

 

# portsnap extract

 

# portsnap update

 

 

 

ii) Installation

 

To begin, change to the directory for the port you want to install:

 

# cd /usr/ports/sysutils/lsof

once inside the lsof directory, you will see the port skeleton. The next step is to compile, or “build”,
the port. This is done by simply typing make at the prompt. Once you have done so, you should see something like this:

 

# make

>> lsof_4.57D.freebsd.tar.gz doesn’t seem to exist in
/usr/ports/distfiles/.

>> Attempting to fetch from ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/.

===> Extracting for lsof-4.57

[extraction
output snipped]

>> Checksum OK for lsof_4.57D.freebsd.tar.gz.

===> Patching for lsof-4.57

===> Applying FreeBSD patches for lsof-4.57

===> Configuring for lsof-4.57

[configure output
snipped]

===> Building for lsof-4.57

[compilation
output snipped]

#

 

 

Notice that once the compile is complete you are returned to your prompt. The next step is to install
the port. In order to install it, you simply need to tack one word onto the make command, and that word is install:

# make install

===> Installing for lsof-4.57

…[installation
output snipped]

===> Generating temporary packing list

===>Compressing manual pages for lsof-4.57

===>Registering installation for lsof-4.57

===> SECURITY
NOTE:

This porthas installed the following binaries which execute with increased privileges.

#It is a good idea to delete the working subdirectory, which contains all the temporary files used during compilation. Not only does it consume valuable disk space, but it would also cause problems later when upgrading to the newer version of the port.

 

# make clean

===> Cleaning for lsof-4.57

 

 

 

#
Note: You can save two extra steps by just running make install clean instead of make, make install and make clean as three separate steps.

Iii) Upgrading Ports

 

Once you have updated your Ports Collection, before attempting a port upgrade, you should check
/usr/ports/UPDATING. This file describes various issues and additional steps users may encounter and need to perform when updating a port.

 

# cd /usr/ports/ports-mgmt/portupgrade

# make install clean

 

 

# portupgrade -ai

# portupgrade -R firefox

 

To free the disk space consumed while installing packages

 

# portsclean -C

 

 

 

Categories: Linux tutorials
Tagged: , , , , , ,