Monday, 13 September 2010

Configuring DNS for Internet access in Windows Server 2003

The stand-alone server running Windows Server 2003 becomes a DNS server for your network. In the first step, you assign this server a static Internet Protocol (IP) address. DNS servers must not use dynamically assigned IP addresses because a dynamic change of address could cause clients to lose contact with the DNS server.

Step 1: Configure TCP/IP



  1. Click Start, point to Control Panel, point to Network Connections, and then click Local Area Connection.

  2. Click Properties.

  3. Click Internet Protocol (TCP/IP), and then click Properties.

  4. Click the General tab.

  5. Click Use the following IP address, and then type the IP address, subnet mask, and default gateway address in the appropriate boxes.

  6. Click Advanced, and then click the DNS tab.

  7. Click Append primary and connection specific DNS suffixes.

  8. Click to select the Append parent suffixes of the primary DNS suffix check box.

  9. Click to select the Register this connection's addresses in DNS check box.Note that DNS servers running Windows Server 2003 must point to themselves for DNS. If this server needs to resolve names from its Internet service provider (ISP), you must configure a forwarder. Forwarders are discussed in the How to Configure Forwarders section later in this article.

  10. Click OK three times.


NOTE: If you receive a warning from the DNS Caching Resolver service, click OKto dismiss the warning. The caching resolver is trying to contact the DNS server, but you have not finished configuring the server.

Step 2: Install Microsoft DNS Server



  1. Click Start, point to Control Panel, and then click Add or Remove Programs.

  2. Click Add or Remove Windows Components.

  3. In the Components list, click Networking Services (but do not select or clear the check box), and then click Details.

  4. Click to select the Domain Name System (DNS) check box, and then click OK.

  5. Click Next.

  6. When you are prompted, insert the Windows Server 2003 CD-ROM into the computer's CD-ROM or DVD-ROM drive.

  7. On the Completing the Windows Components Wizard page, click Finish when Setup is complete.

  8. Click Close to close the Add or Remove Programs window.


Step 3: Configure the DNS Server


To configure DNS by using the DNS snap-in in Microsoft Management Console (MMC), follow these steps:

  1. Click Start, point to Programs, point to Administrative Tools, and then clickDNS.

  2. Right-click Forward lookup zones, and then click New Zone

  3. When the New Zone Wizard starts, click Next.You are prompted for a zone type. The zone types include:

    • Primary zone: Creates a copy of a zone that can be updated directly on this server. This zone information is stored in a .dns text file.

    • Secondary zone: A standard secondary zone copies all of the information from its master DNS server. A master DNS server can be an Active Directory, primary, or secondary zone that is configured for zone transfers. Note that you cannot modify the zone data on a secondary DNS server. All of its data is copied from its master DNS server.

    • Stub zone: A Stub zone contains only those resource records that are necessary to identify the authoritative DNS servers for that zone. Those resource records include Name Server (NS), Start of Authority (SOA), and possibly glue Host (A) records.


    There is also an option to the store zone in Active Directory. This option is only available if the DNS server is a Domain controller.

  4. The new forward lookup zone must be a primary or an Active Directory-integrated zone so that it can accept dynamic updates. Click Primary, and then click Next.

  5. The new zone contains the locator records for this Active Directory-based domain. The name of the zone must be the same as the name of the Active Directory-based domain, or be a logical DNS container for that name. For example, if the Active Directory-based domain is named "support.microsoft.com", valid zone names are "support.microsoft.com" only.Accept the default name for the new zone file. Click Next.NOTE: Experienced DNS administrators may want to create a reverse lookup zone, and are encouraged to explore this branch of the wizard. A DNS server can resolve two basic requests: a forward lookup and a reverse lookup. A forward lookup is more common. A forward lookup resolves a host name to an IP address with an "A" or Host Resource record. A reverse lookup resolves an IP address to a host name with a PTR or Pointer Resource record. If you have your reverse DNS zones configured, you can automatically create associated reverse records when you create your original forward record.

Sunday, 12 September 2010

How to Change Time Zones on Servers

Linux Server:

1. Login as a Root.

2. The time zones are located on server in the directory /usr/share/zoneinfo, so change the directory to that one.

#  cd /usr/share/zoneinfo



3. Copy or move the current local time zone so that you will be able to set the time zone as per requirement.

#  cp -p /etc/localtime  /etc/localtime-back

#  mv /etc/localtime  /etc/localtime-back

4. Now say for example, if you want to set the BST [British Summer Time] time zone for your server then, you will need to create a symbolic link for the same. The command is as follows.

#  ln -s /usr/share/zoneinfo/BST  /etc/localtime

Verify the changes done by "date" command.

#  date

Sun Sep 12 23:16:53  BST 2010




Friday, 10 September 2010

/var patition full, How to change Mysql database directory to another partition in cPanel

Switch off the database server while we are moving the databases.

/etc/rc.d/init.d/mysql stop

I am considering that I have enough space in /home partition. Here goes my new database data directory as /home/mysql

Now it is better to copy the database first, rather than move.

cp -pr /var/lib/mysql /home
mv /var/lib/mysql /var/lib/mysql-bk

We are copying the database to the new location since it is better to revert back the settings with minimum downtime, if anything goes wrong.

move to /tmp

cd /tmp
unlink mysql.sock
ln -s /home/mysql/mysql.sock /tmp/mysql.sock

Take a backup of /etc/my.cnf

Now edit /etc/my.cnf

vi /etc/my.cnf

add the line
datadir=/home/mysql

If the socket file is specified, comment it out.

Now move to /var/lib/mysql and create a symblink

ln -s /home/mysql /var/lib/mysql

(Please note that you don’t specify the socket file location in my.cnf since it causes issues with phpMyadmin)

For, cPanel server, edit the phpMyadmin configuration
take a backup of “/usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php”

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

add the following lines. If they already exist, edit as below.
(the connect_type usually exist at “tcp” change it to “socket”)

$cfg['Servers'][$i]['socket'] = ‘/home/mysql/mysql.sock’;
$cfg['Servers'][$i]['connect_type'] = ’socket’;

Now start the database server.

/etc/rc.d/ini.d/mysql start

If it starts fine, you are done. Check the database connections of your site.
You can now remove the directory /var/lib/mysql-bk

Taking long time to connect to MySql server remotely.

When trying to connect from remote host to mysql server with command like this

mysql -h MySqlServerIP -u mysqlusername -p[password]

if it is taking long time. Give the following entry in /etc/my.cnf of the server

skip-name-resolve

in the [mysqld] section.

This will fix the issue. It will disable dns resolving.

Perl upgradation in cPanel servers




Perl can be upgraded in cPanel severs using the following steps.

perl -MCPAN -e ‘autobundle’

cd /root

wget http://layer1.cpanel.net/perl588installer.tar.gz



tar -zxf perl588installer.tar.gz

cd perl588installer

./install

/usr/local/cpanel/bin/checkperlmodules

/usr/local/cpanel/startup


Determine if a server is hacked

This summary is not available. Please click here to view the post.

phpMyAdmin, ‘Error #2002 - The server is not responding’, and OS X 10.4.4

Trying to install phpMyAdmin on a fresh OS X 10.4.4 install this afternoon was an incredible exercise in frustration. No matter what I did I kept getting the dreaded ‘Error 2002 - The server is not responding‘ error. Turns out the the location of mysql.sock has changed in this version of OS X; if you had all this working before upgrading then the OS was smart enough to detect it and create a sym link to the new location. However new installs, not so much.

Worked for me:

Open a terminal, type in

# ls -al /etc/php.ini*


If a php.ini does not exist copy over the default php.ini,

# cp /etc/php.ini.default /etc/php.ini


Now edit the php.ini

# nano /etc/php.ini (or use your prefered editor)

Find “mysql.default_socket” (you can search using [Ctrl]+[w] in nano)

Enter “/tmp/mysql.sock” after the equals sign.


Don’t forget to save the file ([Ctrl]+[o] [Enter] in nano)

Now restart Apache

# apachectl graceful