UnixServerAdmin

Server Administration & Management

How to activate Windows Server 2008 R2 Evaluation

Use Windows Server 2008 R2 Editions 180day Evaluation Key

Windows Web Server 2008 R2 = KBV3Q-DJ8W7-VPB64-V88KG-82C49
Windows Server 2008 R2 Standard = 4GGC4-9947F-FWFP3-78P6F-J9HDR
Windows Server 2008 R2 Enterprise = 7PJBC-63K3J-62TTK-XF46D-W3WMD
Windows Server 2008 R2 Datacenter = QX7TD-2CMJR-D7WWY-KVCYC-6D2YT

You can rearm the Evaluation version of Windows Server 2008 R2 up to 5 times.

To check how much rearms you have left click Run in the Start menu, enter slmgr.vbs -dlv and click OK

How to manually rearm the 10 day activation grace period

When the initial 10-day activation period nears its end, you can run the slmgr.vbs script to reset it back to 10 days. To do this, follow these steps:

1. Click Start, and then click Command Prompt.

2. Type slmgr.vbs -dli, and then press ENTER to check the current status of your activation period.

3. Type slmgr.vbs -rearm, and Rearm the Windows.

4. Type slmgr.vbs -dlv, and After restarting your system verify that the rearm has worked by running slmgr.vbs -dli again.
The remaining time should now be reset to 10 days!

5. To reset the activation period, type slmgr.vbs –rearm, and then press ENTER.

6. Restart the computer.

November 10, 2011 Posted by | Windows | , | Leave a comment

Tomcat Application Server

Apache Tomcat (or Jakarta Tomcat or simply Tomcat) is an open source servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle Corporation, and provides a “pure Java” HTTP web server environment for Java code to run.

Tomcat should not be confused with the Apache web server, which is a C implementation of an HTTP web server; these two web servers are not bundled together, although they are frequently used together as part of a server application stack. Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files.

Components :- Tomcat was released with Catalina (a servlet container), Coyote (an HTTP connector) and Jasper (a JSP engine).

Catalina :–> is Tomcat’s servlet container. Catalina implements Sun Microsystems’ specifications for servlet and JavaServer Pages (JSP). In Tomcat, a Realm element represents a “database” of usernames, passwords, and roles (similar to Unix groups) assigned to those users. Different implementations of Realm allow Catalina to be integrated into environments where such authentication information is already being created and maintained, and then utilize that information to implement Container Managed Security as described in the Servlet Specification.

Coyote :–> is Tomcat’s HTTP Connector component that supports the HTTP 1.1 protocol for the web server or application container. Coyote listens for incoming connections on a specific TCP port on the server and forwards the request to the Tomcat Engine to process the request and send back a response to the requesting client.

Jasper :–> is Tomcat’s JSP Engine. Tomcat 5.x uses Jasper 2, which is an implementation of the Sun Microsystems’s JavaServer Pages 2.0 specification. Jasper parses JSP files to compile them into Java code as servlets (that can be handled by Catalina). At runtime, Jasper detects changes to JSP files and recompiles them.

November 9, 2011 Posted by | Java, Tomcat | , , | Leave a comment

Application Servers

An application server is a software framework that provides an environment in which applications can run, no matter what the applications are or what they do.It is dedicated to the efficient execution of procedures (programs, routines, scripts) for supporting the construction of applications.

The term was originally used when discussing early client–server systems to differentiate servers that run SQL services and middleware servers from file servers.

Later, the term took on the meaning of Web applications, but has since evolved further into that of a comprehensive service layer. An application server acts as a set of components accessible to the software developer through an API defined by the platform itself. For Web applications, these components are usually performed in the same machine where the Web server is running, and their main job is to support the construction of dynamic pages.

However, present-day application servers target much more than just Web page generation: they implement services like clustering, fail-over, and load-balancing, so developers can focus on implementing the business logic.

Normally the term refers to Java application servers. When this is the case, the application server behaves like an extended virtual machine for the running applications, transparently handling connections to the database on one side, and connections to the Web client on the other. Other uses of the term may refer to the services that a server makes available or the  computer hardware on which the services run.

Java Application Servers

The Web modules include servlets, JavaServer Pages and Enterprise JavaBeans. Business logic resides in Enterprise JavaBeans – a modular server component providing many features, mostly improving application scalability. The Hibernate project offers an EJB-3 container implementation for the JBoss application server. Tomcat from Apache,The EAServer is from Sybase inc.

A Java Server Page (JSP) (a servlet from Java – the Java equivalent of a CGI script) executes in a Web container. JSPs provide a way to create HTML pages by embedding references to the server logic within the page. HTML coders and Java programmers can work side by side by referencing each other’s code from within their own.

The application servers mentioned above mainly serve Web applications. Some application servers target networks other than web-based ones: Session Initiation Protocol servers, for instance, target telephony networks.

Web Server is a sub set but the Application server is a super set and hence encompasses the past server information that is been stored in database.

Microsoft .NET Framework

Microsoft positions their middle-tier applications and services infrastructure in the Windows Server operating system and the .NET Framework technologies in the role of an application server.

Advantages of application servers

Data and code integrity :–> By centralizing business logic on an individual server or on a small number of server machines, updates and upgrades to the application for all users can be guaranteed. There is no risk of old versions of the application accessing or manipulating data in an older, incompatible manner.

Centralized configuration :–> Changes to the application configuration, such as a move of database server, or system settings, can take place centrally.

Security :–> A central point through which service-providers can manage access to data and portions of the application itself counts as a security benefit, devolving responsibility for authentication away from the potentially insecure client layer without exposing the database layer.

Performance :–> By limiting the network traffic to performance-tier traffic the client–server model improves the performance of large applications in heavy usage environments.

Total Cost of Ownership (TCO) :–> In combination, the benefits above may result in cost savings to an organization developing enterprise applications. In practice, however, the technical challenges of writing software that conforms to that paradigm, combined with the need for software distribution to distribute client code, somewhat negate these benefits.

Transaction Support :–> A transaction represents a unit of activity in which many updates to resources (on the same or distributed data sources) can be made atomic (as an indivisible unit of work). End-users can benefit from a system-wide standard behaviour, from reduced time to develop, and from reduced costs. As the server does a lot of the tedious code-generation, developers can focus on business logic.

November 8, 2011 Posted by | Apache, Java, Tomcat | , , , | Leave a comment

Servlets and Applets

Servlets executes on Servers and have no graphical user interface.

Applets executes on browser, have graphical user interface. An applet is a small server side application that can be loaded and controlled on the browser by the client application. An applet has limited access to resources in order to ensure security.

November 7, 2011 Posted by | Java, Tomcat | , , , | Leave a comment

Apache Optimization: KeepAlive On or Off

Apache is the most widely used web server on the Internet. Knowing how to get the most out of Apache is very important for a systems administrator. Optimizing Apache is always a balancing act. It’s a case of sacrificing one resource in order to obtain savings in another.

What is KeepAlive

HTTP is a session less protocol. A connection is made to transfer a single file and closed once the transfer is complete. This keeps things simple but its not very efficient.

To improve efficiency something called KeepAlive was introduced. With KeepAlive the web browser and the web server agree to reuse the same connection to transfer multiple files.

Advantages of KeepAlive

Improves website speed: It reduces latency associated with HTTP transfers and delivers a better user experience.

Reduces CPU usage: On the server side enabling KeepAlive reduces CPU usage. Consider that a typical web page has dozens of different files such as images, stylesheets, javascript files etc. If KeepAlive is disabled a separate connection must be made for each of those files. Creating and closing connections has an overhead and doing it for every single file wastes CPU time.

Disadvantages of Keepalive

Increases memory usage: Enabling KeepAlive  increases memory usage on the server. Apache processes have to keep connections open waiting for new requests from established connections. While they are waiting they are occupying RAM that could be used to service other clients. If you turn off KeepAlive fewer apache processes will remain active. This will lower memory usage and allow Apache to serve more users.

When should you enable KeepAlive?

Deciding whether to enable KeepAlive or not depends on a number of different factors:

Server resources: How much RAM vs. how much CPU power you have? RAM is often the biggest limiting factor in a webserver. If you have little RAM you should turn off KeepAlive because having Apache processes hanging around while they wait for more requests from persistent connections is a waste of precious memory. If CPU power is limited then you want KeepAlive on because it reduces CPU load.

Types of sites: If you have pages with a lot of images or other files linked into them, KeepAlive will improve the user experience significantly. This is because a single connection will be used to transfer multiple files.

Traffic patterns: The type of traffic you get. If your web traffic is spread out evenly throughout a day then you should turn on KeepAlive. OTOH, if you have bursty traffic where a lot of concurrent users access your sites during a short time period KeepAlive will cause your RAM usage to skyrocket so you should turn it off.

Configure Apache KeepAlive settings

Open up apache’s configuration file and look for the following settings. On Centos this file is called httpd.conf and is located in /etc/httpd/conf. The following settings are noteworthy:

KeepAlive: Switches KeepAlive on or off. Put in “KeepAlive on” to turn it on and “KeepAlive off” to turn it off.

MaxKeepAliveRequests: The maximum number of requests a single persistent connection will service. A number between 50 and 75 would be plenty.

KeepAliveTimeout: How long should the server wait for new requests from connected clients. The default is 15 seconds which is way too high. Set it to between 1 and 5 seconds to avoid having processes wasting RAM while waiting for requests.

Other settings

KeepAlive affects other settings in your Apache configuration file even though they are not directly related. Here are the settings in an Apache prefork MPM webserver:

MaxClients: MaxClients is the maximum number of child processes launched by Apache to service incoming requests. With KeepAlive enabled you have will have a higher number of child processes active during peak times. So your MaxClients value may have to be increased.

MaxRequestsPerChild: The number of requests a child process will serve before it is killed and recreated. This is done to prevent memory leaks. When KeepAlive is turned on each persistent connection will count as one request. That effectively turns MaxRequestsPerChild into a maximum connections per child value. As a result you can set a lower MaxRequestsPerChild value if you allow KeepAlive. If you don’t allow KeepAlive you should increase the MaxRequestsPerChild value to prevent excessive CPU usage.

Note :- There is no one universal solution to tuning Apache. It all depends on the resources at your disposal and the type of sites you have. When used properly KeepAlive can improve the user experience at minimal cost in terms of server resources. But it can also be a liability when you are faced with a large number of concurrent users.

November 6, 2011 Posted by | Apache | | Leave a comment

How to synchronize time with NTP servers

1. Synchronizing time with NTP(Network Time Protocol) server.

# which ntpdate

2. If its not available type:

# yum install ntp

3. Once ntp is installed synchronize your computer clock with:

# ntpdate 0.us.pool.ntp.org

4. You are not limited to the above server. There are numerous NTP servers around the world. You can find a complete list at ntp.org. Also keep in mind that ntp only affects the system time. The hardware clock on your server will not reflect that. So you want to set it as well so that the correct time is maintained after reboot:

# hwclock –systohc

# ntpd

5. To keep your server clock automatically synchronized you can run the ntpd daemon which is installed as part of the ntp package. Edit the /etc/ntp.conf file to comment out the following lines:

# vi /etc/ntp.conf

——————————————–
#server 127.127.1.0     # local clock
#fudge  127.127.1.0 stratum 10
——————————————–

6. The above two lines can sometimes prevent ntpd from properly synchronizing your clock. They are already commented out by default on CentOS/RHEL 6. But on 5.x you have to comment them out manually. Finally type the following two commands to start the daemon and make it run automatically at boot up:

# service ntpd start

# chkconfig ntpd on

November 5, 2011 Posted by | NTP, Tips & Tricks, Unix/Linux | , , , | Leave a comment

How to set the correct timezone

1. Login as root either locally or remotely via SSH.

2. See what the current timezone is using following command :-

# date

Fri Nov  4 10:33:29 PDT 2011

3. To change the timezone first look at what timezones are available by running the following command on the command line interface:

# ls /usr/share/zoneinfo

Africa      Australia  Cuba     Etc      GMT0       Iceland      Japan      MST      Poland      right      Universal  Zulu
America     Brazil     EET      Europe   GMT-0      Indian       Kwajalein  MST7MDT  Portugal    ROC        US
Antarctica  Canada     Egypt    Factory  GMT+0      Iran         Libya      Navajo   posix       ROK        UTC
Arctic      CET        Eire     GB       Greenwich  iso3166.tab  MET        NZ       posixrules  Singapore  WET
Asia        Chile      EST      GB-Eire  Hongkong   Israel       Mexico     NZ-CHAT  PRC         Turkey     W-SU
Atlantic    CST6CDT    EST5EDT  GMT      HST        Jamaica      Mideast    Pacific  PST8PDT     UCT        zone.tab

4. Then simply delete the current timezone:

# rm /etc/localtime

5. And replace it with a symbolic link to the new timezone from /usr/share/zoneinfo. For example if your chosen zone is Pacific time:

# ln –s /usr/share/zoneinfo/PST8PDT /etc/localtime

November 4, 2011 Posted by | NTP, Tips & Tricks, Unix/Linux | , , , | Leave a comment

Preserving httpd.conf during EasyApache in cPanel

Issue : The apache configuration file (httpd.conf) has several custom entries which should not be over-written when an EasyApache is done for recompiling/adding a PHP/Apache extension.

Solution : Starting with cPanel 11.x, all the apache settings are also stored in a database and the configuration files
are recreated each time an account is added or a recompile is done.

1) To also save the changes in the database you will have to run:

# /usr/local/cpanel/bin/apache_conf_distiller –update

2) You can check to see if the changes were accepted and will not be discarded at the next apache recompile by running :

# /usr/local/cpanel/bin/build_apache_conf

November 3, 2011 Posted by | Apache, cPanel, Security | , , | Leave a comment

How to install pdo_pgsql in cPanel server

Its that easy to add the php module pdo_pgsql in a cPanel server. Just use the command

# pecl install pdo_pgsql

Then go for a Apache restart. It will be shown up in your phpinfo page.

# /etc/init.d/httpd /restart

November 2, 2011 Posted by | cPanel, PgSQL | , , | Leave a comment

Client denied by Server Configuration

Here is the error in  the Apache logs:-

mon nov 28 12:4:38 2011] [error] [client 223.143.133.66] client denied by server configuration: /home/<username>/public_html/index.php

Solution:- Create a .htacess file under the public_html directory of the problamatic account or comment the entry Deny from all in htaccess file

# touch /home/<username>/public_html/.htaccess

# vi /home/<username>/public_html/.htaccess
——————
<Files *.php>
Order Deny,Allow
#Deny from all
</Files>
——————

Try to reload the page now. Issue should be fixed.

November 1, 2011 Posted by | Apache, htaccess | , | Leave a comment