Using VMware Player for Server Testing: Part 2

In an earlier post, we learned how to setup a new virtual machine in VMware Player for the purposes of testing a server implementation. In this post, we will look at some ways you can manipulate VMware Player to emulate your server environment.

Hardware

One of the first things you will want to do is change hardware settings to closely match your server. To begin, Right click on your virtual machine and click “Virtual Machine Settings”

  • Memory – You can specify the amount of memory you want to allocate to the system. Keep in mind that it can only be a portion of your host system’s physical memory. It includes recommended levels to make it easier for you.
  • Processors – You may allocate more than one processor to the system, useful for testing applications that can benefit from threading.
  • Network adapter – By default, VMware will use NAT, which shares the IP address with the host. If you need to have your virtual server accessible from the network, you should use “Bridged”

Software

There are few software settings that may benefit your server testing once you have started your virtual machine:

  • Enter Unity – This setting allows you to integrate the guest OS into the Host, which is useful in a desktop environment if all you need is terminal access to the guest OS  (an alternative is to SSH into a guest running in Bridged mode).
  • Download a Virtual Appliance – If you need to deploy multiple instances of your testbed, packaged and ready to go, this is the solution.

There are many more options you may want to consider when using VMware to test a server environment. For more information, see this article.

Using VMware Player for Server Testing: Part 1

In the past, creating a testbed environment for your server often involved setting aside an old machine or even using a desktop or laptop computer. In most cases, it was difficult to mimic the exact hardware configuration of your server and not as efficient. Virtualization changed all of that, and VMware Player is one free option you can use for server testing.

Before beginning, you will need to download and install VMware Player and download the ISO of the operating system you intend to use or insert the installation disk. In this example, we will use OpenSUSE.

To get started with a VMware Player virtual machine, do the following:

1. Click “Create a New Virtual Machine”

2. Select “Use ISO image” (for OpenSUSE, VMware Player will use the Easy Install method)

3. Enter user and password information

4. Assign a name to the virtual machine

5. Select physical location on your system where you want the machine stored

6. Specify the disk size (in gigabytes) and whether to use a single file or multiple files for the virtual machine

7. Review the settings and click “Finish”

Your virtual machine will start booting. If you have an install disk, it will go through the normal install process. A Live CD will simply boot. With Easy Install, the installation process will be automated.

In Part 2, we will look at some of the things you can do with your new virtual machine.

How to Apply Apache Configuration Changes Gracefully

From time to time, you may need to make changes to your Apache HTTP Server configuration file, especially if you are optimizing your web server for performance. Once you have completed changes, they will not come into effect until you restart your web server. This, however, would mean downtime, however briefly, for anyone visiting your websites. One way to minimize the downtime is to perform a graceful restart.

Unlike an immediate reload that ends all processes and restarts the web server, a graceful restart will instruct the parent process to advise the child processes to exit only after their current requests have ended. The parent process then applies the new configuration to each new child that appears after the old ones have died.

To execute a graceful restart, run:

# apachectl -k graceful

or

# apache2ctl -k graceful

On Red Hat Enterprise Linux, CentOS, and other varieties, the following will also work:

# /etc/init.d/httpd graceful

or

# service httpd graceful

On Debian, Ubuntu, and other varieties, you can run:

# /etc/init.d/apache2 reload

Although it says “reload”, it is actually the equivalent of a graceful restart.

For more information about graceful restarts, see the online Apache documentation.

How to Setup Remote MySQL Access

Under normal circumstances, your MySQL server may only allow applications to connect to it locally, meaning both are running on the same server. If, however, you run MySQL on a separate machine, you will need to configure it to permit remote connections.

(Note: Replace terms in italics with the correct information from your own server)

Step 1: Login to your server (either directly to the console or through SSH if the server is remote)

Step 2: Grant remote access to the MySQL database you want to use remotely:

$ mysql -u root -p mysql

mysql> update db set Host=’123.45.67.8‘ where db=’dbname‘;

mysql> update user set Host=’123.45.67.8‘ where user=’dbusername‘;

Alternatively, if you want to grant global access to all databases remotely:

mysql> GRANT ALL ON *.* to root@’123.45.67.8‘ IDENTIFIED BY ‘root-password‘;

mysql> FLUSH PRIVILEGES;

mysql> exit

Step 3: Finally, you will need to open port 3306 on your firewall in order for the connections to go through. For a Linux iptables firewall rule:

# /sbin/iptables -A INPUT -i eth0 -p tcp –destination-port 3306 -j ACCEPT

And then save the changes:

# service iptables save

You should now be able to remotely connect to your MySQL server from your web application server without any problems.

How Often Do You Reboot Your Server?

Once upon a time, it was conventional Unix server wisdom to reboot every month or so to make sure it was working correctly. These days many Linux system administrators boast about the number of days their servers have been up and running without interruption. BSD and other Unix-like OS users also claim similar uptimes, sometimes as long as or even longer than a year without rebooting. One might ask: is this actually a good practice?

Linux is known for its efficiency, and it can run for several days, months, even years without losing its integrity or needing to refresh itself. Therefore, rebooting is not usually necessary and would only result in downtime, which would be especially troubling if you are serving websites to the public.

One exception to the rule occurs when you need to perform a major security update to the kernel. In such a case, a reboot will be necessary to boot the new kernel. For most updates, even security updates, however, a reboot is not required, which may differ considerably from Windows servers.

Aside from security updates, your server should only be rebooted if it hangs completely. Most other problems can be fixed without resorting to a reboot.

 

3 Great Uses for Quick-Deploying Virtual Cloud Servers

The very nature of a dedicated server is that it is dedicated. The very name suggests a long term marriage. But what should you do if you just want a brief affair, maybe even a fling? Quick, easy to deploy virtual cloud servers may be the way to go.

Virtualization allows for rapid deployment of virtual servers. Couple that with the low-cost, pay as you go model offered by some cloud providers, and you have a recipe for quick-deploying virtual cloud servers. The following are three examples of ways you can use this technology:

  1. Development – As you develop new applications or customize old ones, you need a testbed for your innovations. Using virtual cloud servers, you can easily deploy a replica of your production environment, test it, and then tear it down when you are finished.
  2. Application-specific OS – Some applications may require a specific operating system and/or a specific configuration for it. With a virtual cloud server, you setup exactly what you need rather painlessly without making changes to your dedicated server.
  3. Backup/redundancy – If you need a backup or replica of your production system, an offsite cloud installation may be ideal. Because most virtual cloud providers will offer hourly or per-GB rates on services, you only have to pay for what you use.

Combining virtualization and cloud computing can make your server experience more efficient and easier.

 

4 Things You Should Know About Today’s Server Management

Server management is a ever-changing arena, filled with new technology and security techniques that you need to learn and relearn. Suffice it is to say that the game has changed significantly in the past five years. The following are trends you should be aware of and prepare for in the near future.

1. Virtualization is king – Many, perhaps even most organizations will want to adopt some type of virtualization. It saves space, money, and even time. Technically, it is also fairly easy to adopt.

2. Power saving is a must – According to many scientists, our energy consumption is too much for the earth to handle, but even if you are not concerned about your carbon footprint, saving power will save you money. Depending on where you live, you might also need to do it to comply with government regulations.

3. Smart data centers save – Save what, you ask? They can save time, money, and manpower. For example, a data center that has smart power distribution units (PDU) on its server racks will not be as wasteful, only sending as much power to servers as they need, when they need it.

4. Go modular – The data centers of today need to be modular. When you need to expand, you should be able to pop in a new server (even a virtual one) without much effort and without needing to do major reconfigurations of power distribution. The above three points should all help with your modularization.

Stay tuned for part two of today’s server management.

 

The Benefits of Ext4 File Systems

In general, you may not have a reason to ever think about the file system your server is using. Most Linux distributions will automatically format your drive to its default file system unless you use an advanced install method. For many years, Ext3 has been the standard for most Linux distributions. Now, some are switching to Ext4. The following are some key advantages of Ext4 file systems.

  • Large file sizes – Ext4 can support larger file sizes up to 16 terabytes
  • Larger file system size – An Ext4 file system can grow as large as 1 exabyte.
  • More subdirectories – An Ext4 directory can contain 64,000 subdirectories vs. 32,000 in Ext3.
  • Journaling optional – You can turn journaling off on an Ext4 system.
  • Overall performance – Features such as multiblock allocation, metadata checksumming, journal checksumming, persistent preallocation, online defragmentation and many others give ext4 a performance edge in many file system operations.

Is it worth an upgrade? It depends on what you are doing with your server. Generally speaking it is not a good idea to upgrade a production server unless you are prepared for downtime. Ext4 can mount an Ext3 drive as Ext4, which you might find handy at times, but in general, you can wait to upgrade your file system when you upgrade your hardware.

Gently Restart a Frozen Linux System with the Magic SysRq Key

In the previous post, we covered a brief introduction to the magic SysRq key and dropped some hints about what it can do. In this post, we will actually learn how to perform one of the many functions it can be used to execute.

When your server becomes unresponsive, the first instinct is to check to see if any of your services, such as your web server, have gone down. Upon accessing your console, however, you may discover that your system is completely unreachable. If you have a remote server, there may be little you can do other than to request a reboot from the data center, but if you have local access, the SysRq key can be very valuable.

To gracefully restart your system without a hard reboot, simply hold Alt+SysRq(PrintScreen) and press the following keys in order, one after another, pausing in between each: R-E-I-S-U-B.

R – will put the keyboard into raw mode, taking away control from anything else

E – will tell all processes to terminate

I – sends a kill signal to processes that have not yet terminated on their own

S – Flushes all data from the disk cache

U – Remounts all file systems as read only

B – Restarts the system

If you have trouble remembering this sequence, you can use the mnemonic device: “Raising Elephants Is So Utterly Boring”.

Using the Magic SysRq Key to Rescue a Linux System

It could be a freeze, a crash, or simply completely or near unresponsiveness that drives you to shut off your server and start it back up cold. That, however, is never ideal. The ideal way to recover a system is to bring it back to complete functionality or simply restart it gracefully. Enter Magic SysRq, a set of keyboard shortcuts that can fix a wide range of Linux issues.

Before you run into any problems, you should check to see if you have Magic SysRq Key enabled. Run this command:

# cat /proc/sys/kernel/sysrq

A “0″ means it is disabled, while a “1″ means it is enabled.

You can enable it with this command:

# echo “1” > /proc/sys/kernel/sysrq

What is the SysRq key?

Some keyboards may not even have a key labeled SysRq, but most Linux distributions will assign the functionality to the PrtScrn key even if it is not also labeled as SysRq. Used on its own, it will usually function as a print screen key. Used in combination with modifiers like Alt along with various key combinations, you can have a powerful tool for fixing Linux issues that normally cannot be fixed.

 

Even More Apache Performance Tips

We are not quite done yet. Here are four more tips for boosting performance on Apache web servers.

1. Use mod_deflate/gzip – Gzip compression makes smaller file sizes for the content you send to client browsers. The browsers then uncompress and display through a seamless deflating process. The result is better server performance and faster results for the client.

2. Disable HostnameLookups – HostnameLookups offers some advantages, such as the ability to ban reverse IP addresses, but beyond that, it is just an expensive process hog that you can probably live without.

3. Enable Persistent Connections with KeepAlive – Using “KeepAlive On” along with KeepAlive Timeout and KeepAliveRequests, you can control how long Apache waits before it assumes there will not be another request. By extending this, you prevent it having to reconnect clients between requests.

4. Enable Symlinks – A simple line: Options +FollowSymlinks -SymLinksIfOwnerMatch can prevent Apache from making an additional call to each file to determine if it is a symlink.

4 Apache Performance Tips

Previously, we revealed some helpful security tips for Apache web servers. Today, we are back with more tips to help boost your Apache performance.

1. Prefer mod_disk_cache over mod_mem_cache – Having a caching module is definitely a good idea for Apache, but you should use mod_disk_cache rather than mod_mem_cache. The latter can be quite expensive in terms of memory usage and may not produce the level of results you likely expect.

2. Use a flat hierarchy for mod_disk_cache – navigating through a large number of directories will cause htcacheclean to take a long time to clean up your cache directory. Instead, keep mod_disk_cache at CacheDirLength=2 and CacheDirLevels=1

3. Cache on a separate disk – Use a separate disk to speed up caching. You may even want to use one with faster read/write speeds, such as a solid state drive (SSD) or flash cache card.

4. Use piped logging – In the past, the only way to log Apache activity and errors was for it to save that information to files. This process uses a considerable amount of memory, especially on larger sites. It can also bog down the server during log rotations. Piped logging sends the information to another process, allowing it to handle logging for Apache.

3 More Differences Between Linux and BSD

In the first post on this topic, we looked at 3 key differences between Linux and BSD: the licensing, the kernel, and the package management system. The following are three more differences you should probably know.

1. Hardware support – In many cases Linux supports hardware sooner and more often than BSD. This is partly due to the fact that Linux is more widely used by commercial companies on servers and desktops. Many of them may even have staff workers who work on Linux kernel development. With BSD, however, hardware support usually does appear, and in some cases, development on Linux helps jumpstart development for BSD.

2. Software – For the most part, you could run most of the Linux software tools on BSD, but that does not mean that BSD variants choose them by default. In fact, in many cases, they may opt for alternatives that they prefer. You may need to learn a slightly different command line shell, drive partitioning system, and other features.

3. Commercial Support – On a dedicated server, commercial support may be something you require. With BSD, you may find it to be quite limited in terms of direct developer support, but there are many consulting services that will provide quality support. There are several big commercial Linux vendors, so if you are looking for an all-in-one package, Linux might be the better option.

Both BSD and Linux have their advantages, and many modern servers may virtualize and run both operating systems on the same machine. It totally depends on your needs and preferences.

3 Differences Between Linux and BSD

Linux and BSD are two of the most highly regarded server operating systems in the world, mainly for their security, flexibility, and open source development. In reality, both terms broadly refer to multiple operating systems, and it is not possible to compare the two without confusing some of their variants. There are, however, general similarities and differences.

1. Licensing – Linux and most Linux distributions are famously licensed under the GPL, which allows for a wide range of freedoms for software. You can modify, download, rewrite, redistribute, and even sell it, but it comes with a clause that dictates you must release any derivatives under the same license. A BSD style license has no such requirement, essentially allowing the developer to integrate proprietary code into the operating system.

2. Kernel – Linux is technically only the kernel of an operating system, whereas BSD was originally an operating system as a whole. The distributions of Linux all use a variation of the base kernel, and the variants of BSD all use portions of the original code. BSD and Linux both use monolithic kernels.

3. Package management – BSD variants such as FreeBSD rely heavily on the Ports system, which often compiles packages from source. Most Linux distributions use binary-based package management systems. One notable exception is Gentoo, which uses a Ports-like system called Portage.

In part two of this comparison, we will look at 3 more differences between Linux and BSD.

 

Stress Test Your Web Server

It is inevitable that high traffic websites will cause a server stress. CPU and memory loads will rise, and it could affect performance. If you are not careful, it could even bring your server and all of its websites to a halt. Therefore, it is imperative that you have at least a general idea of how much load your server can actually take so that you can do your best to keep the stress below the maximum threshold. A server stress test may be just what you need.

One free and open source solution for stress testing Apache servers is called “ab“, which stands for “Apache Bench”. Designed to tell you how well your Apache installation performs under stress, ab can reveal the number of requests per second your Apache web server is capable of serving.

ab will tell you the time it takes for the test to complete, the number of completed requests, the number of failed requests, the total amount of data transferred, requests per second, time per request, the transfer rate, and many other important facts about your server after the stress test.

You can run ab from your server command line without much difficulty, and the output can either go directly to the screen or to a file.

 

Common PHP Security Risks

PHP is a server-side scripting language that is among the most popular choices for web applications. Web administrators love it, and some of the world’s top websites rely on it. Because it uses server-side scripting, however, there are inherent risks involved with using it. By knowing those risks and how to deal with them, you can keep your server secure from would-be attackers.

SQL Injection – Many websites use some form of database in conjunction with PHP, and SQL relational databases are a popular choice. With SQL injection, the attacker injects harmful code into a PHP query and is able to gain access to the server or some sensitive data therein.

Cross Site Scripting (XSS) – XSS uses malicious links or other sneaky techniques in order to insert false posts into scripts on your site. What may seem like an annoying popup originating from your site turns out to be a link from the attacker aimed at luring the user into a trap.

Register Globals – This is actually a PHP setting called Register_Globals that makes it easier for developers to access variables. It should be off by default, but if it is on, it can pose a security risk.

For more information about PHP security, see this documentation.

Linux Server Network Troubleshooting Tools

When you have problems with your server, one of the first things you might want to check is your networking. Slow transfer speeds or incomplete delivery might be signs of network problems. The following are some network troubleshooting tools for Linux servers.

Nmap – Great for network auditing, Nmap offers port scanning, ping sweeps, and a variety of other techniques to help you diagnose your network issues. It includes both a command line and GUI interface.

Wireshark – This tool is useful in capturing and analyzing packets in order to find more difficult to locate trouble spots. The analyses include filtering by conversion and protocol analysis.

TCPdump – Also a capturing analysis tool, tcpdump captures a packet in raw ethernet data form and allows you to analyze packets without much difficulty. This makes it the fastest way to capture network traffic and store it in a file.

There are no fool proof shortcuts to diagnosing a network problem, but with the combination of the right tools, you can find issues and fix them to keep your server connected and operating at top performance levels.

How to Install OpenVZ on CentOS

CentOS is one of the most popular free and open source server operating systems. OpenVZ is a popular open source system for creating virtual private servers. Combine the two together, and you have a low-cost yet powerful VPS system. The following is a brief installation guide to get OpenVZ running on CentOS.

Step 1. Add the OpenVZ repository to Yum:

cd /etc/yum.repos.d

wget http://download.openvz.org/openvz.repo

rpm –import http://download.openvz.org/RPM-GPG-Key-OpenVZ

Edit openvz.repo and disable the [openvz-kernel-rhel5] repository (enabled=0) and enable the [openvz-kernel-rhel6] repository.

Step 2. Install the OpenVZ kernel:

Search using:

yum search vzkernel

Choose the kernel you want and install:

yum install vzkernel

(This should automatically update Grub to your new kernel. If not, you may need to manually edit your grub configuration).

Step 3. Install OpenVZ user tools:

yum install vzctl vzquota

Step 4. Edit /etc/sysctl.conf and ensure you have these settings:

net.ipv4.ip_forward = 1

net.ipv4.conf.default.proxy_arp = 0

net.ipv4.conf.all.rp_filter = 1

kernel.sysrq = 1

net.ipv4.conf.default.send_redirects = 1

net.ipv4.conf.all.send_redirects = 0

net.ipv4.icmp_echo_ignore_broadcasts=1

net.ipv4.conf.default.forwarding=1

Step 5. If your IP addresses for your virtual machines will be on a different subnet than your host machine, you need to make sure you have this in /etc/vz/vz.conf:

NEIGHBOUR_DEVS=all

Step 6. Disable SELinux bye editing /etc/sysconfig/selinux:

# enforcing – SELinux security policy is enforced.

# permissive – SELinux prints warnings instead of enforcing.

# disabled – No SELinux policy is loaded.

SELINUX=disabled

Step 7: Reboot

You should now have a working OpenVZ installation. You should then test it to verify that the kernel is running and that you are able to create containers.

 

The Energy Saving Benefits of Virtualization

When businesses talk about virtualization, they are often concerned with the financial savings that it can bring. When IT people talk about it, they usually laud its ability to do more with less space, fewer servers, and often less effort. In addition to those technical and financial savings, virtualization can also help conserve energy in our world that is increasingly in need of conservation.

Some of the energy conservation benefits include:

  • decrease in the number of servers in a data center, thus decreasing the amount of electricity and waste heat
  • lower cooling requirements for fewer servers
  • smaller amount of land needed for data centers

Virtualization allows you to retire old servers that often had singular functionality and defer purchasing new servers to replace them. Instead, you can consolidate your applications and even run multiple distinct operating systems onto fewer machines. These fewer machines may run hotter and require more cooling, but they will ultimately use less overall power than multiple servers that are not being fully utilized.

Moreover, whenever a virtual machine is not being utilized or not run to its full potential, it consumes no additional power. This is drastically different than an under-utilized dedicated server that must still consume power and be cooled.

For more information about the energy saving benefits of virtualization, visit the Energy Star website.

 

Understanding Log Files

If you are new to dedicated servers and have spent any time reading this site, you have undoubtedly come across posts from us reminding you to check and monitor your server’s log files. We even make sure to tell you where those log files are stored. In many cases, however, finding the log files is the easy part. Once you do locate the log file for the service you want to monitor, you need to make sure you can actually understand what it tells you.

If you were to open your MySQL log file, for example, and find an error such as this one, you need to know how ti interpret it.

130331 9:52:01 [ERROR] Can’t create IP socket: Too many open files in system

The first number “130331″ tells you the date: March 31 2013. The second number is the server time that the error occurred. The word in brackets (in this case, “error”) tells you the severity. It may say “warning”, “alert” or some other word letting you know just how concerned you need to be about the message. Finally, it will show an error description that will hopefully give you enough information to proceed.

Log files do not always follow this exact format, but many of the logs on web hosting servers will look similar. If you ever encounter something you do not understand, consult the documentation or contact the software’s support channels before attempting to fix it.

How to Make Grub2 Menu Appear at Boot

On most Linux dedicated servers, grub is the bootloader that gets the operating system loaded when the system first boots. With grub, you can determine which installed kernel version will load, attach any startup options to the kernel, and even load other operating systems. In most cases, grub will do its work silently never showing much of itself, but if you need the grub menu to appear when you start your system, there are a couple of easy ways to do it.

Disclaimer: Incorrectly altering grub can cause your system to fail before booting. Therefore, I do not recommend this when you do not have physical access to your machine. If your machine will not boot, you will not have remote access.

When your system starts, immediately after it passes the initial BIOS screen, hold the Shift key. The grub menu should appear with a number of options for booting, depending on your Linux distribution.

Alternatively, if you need the grub menu to appear regularly, you can change the settings in /etc/default/grub. Change the line:

GRUB_HIDDEN_TIMEOUT=0

to:

GRUB_HIDDEN_TIMEOUT=15

(or any number greater than zero – the interval is seconds)

In order to save the changes, you must then run “update-grub” as root (or sudo).

For more information about Grub2, see the online documentation.

 

How to Track Running Processes

A process is any type of program currently running in a computer system’s memory. All types of dedicated servers have processes, and on Linux and Unix systems, they are easy to track, troubleshoot, and manage.

One of the most important commands you can use to track a process is “ps”. When executed it will display the currently running processes, their process identification (PID) numbers , and other relevant information, depending on the options you input. For example:

ps aux

This will show you all processes, all users, and also processes without controlling ttys. Add the “f” option, and you will see a full format list showing the commands that initiated the processes in tree format.

ps auxf

Another important tool you can use is “lsof” This command lists all files opened by any user on the system. This is very useful if you find an unusual process with “ps” or experience unexpected performance on your server. You might be able to track down the suspicious activity to a specific file and user.

With a few simple commands on a Linux system, you can keep track of just about everything that is happening on your dedicated server or VPS.

 

What to Expect from a VPS Provider

Most web hosting companies offer some form of VPS service, so it can be difficult to decide which one is right for you. A virtual private server can be almost anything that uses virtualization, so it is important to know what you are getting and if the services offered fit your needs. These are some great VPS features you may expect from a VPS provider:

  • Easy web-based management system – You do not want to have to rely on your web host to manually create VPS containers for you, nor do you want a difficult, unfriendly interface. A good control panel will save time and energy.
  • Expandability – The ability to create new instances on the fly allows you to expand or contract your VPS installations at any time.
  • Memory – Many VPS accounts are inexpensive because they do not provide much RAM and CPU power. If you know your website(s) will have a heavy amount of traffic, you need to make sure you have enough RAM and burstable RAM at your disposal.
  • OS Choice – Being stuck with only one OS option is no fun, especially if you are running multiple websites. One of your web applications may run better on FreeBSD rather than CentOS, or vice versa. Being able to install a variety of operating systems is one of the inherent advantages of virtualization.

VPS providers will all promise speed and uptime, but you will need to read the fine print to find the one that is truly the best for your sites.

 

5 Reasons Why a VPS is Good for Business

A virtual private server (VPS) is a low-cost alternative to a full dedicated server. Using a VPS has a number of strategic advantages for small and medium sized businesses. Among those advantages are the following:

  1. Savings – Above all else, a business that is small or just getting started will need to find ways to save. If a dedicated server is out of your price range, a VPS is a good choice
  2. Root – You may not need the power of a dedicated server, but if you want administrative rights, shared hosting will not do. A VPS will give you superuser powers.
  3. Instances/Containers/Quick cloud installations – Most VPS systems allow you to quickly and easily create and tear down server instances or containers.
  4. Upgradeable – If your business is growing, you might intend to get a full dedicated server down the line. A VPS is a much smoother stepping stone than shared hosting would be.
  5. Efficiency – There is no point in wasting a whole dedicated server if all you really need are a couple of virtual machines for your websites. You can save space, money, and lower energy consumption. It is the responsible thing to do.

A VPS is good for business, and it is no surprise that many businesses are using them for one or more of their online operations.

 

Dedicated Server Maintenance Checklist

Your dedicated server needs regular maintenance. It will not take care of itself. The following checklist will help you keep your server in top shape.

1. Check your backups – Just because you make backups does not mean they actually work. You need to test them to make sure your server is performing backups correctly.

2. Keep Your OS Up to Date – Security holes and vulnerabilities can creep up at any time. Keeping your system up to date can help ensure you are not caught off guard.

3. Secure remote management tools – Every tool that can connect to your server remotely offers a window of opportunity for would-be attackers. Make sure those programs and the ports they access are secure and not easy to exploit.

4. Check resource usage – Your RAM, CPU, and network usage should all be at nominal levels. By checking your resource usage, you can identify any problem spots and any programs that might be taking more than their fair share.

5. Enforce password changes – When it comes to security, weak passwords can be the weakest link. Ever so often, require users to update to more secure passwords.

For top performance and security, you need to monitor your server and keep it up to date. If you are consistent and proactive, you can keep it running smoothly.

 

Monitor Memory on a Linux Server

Memory is one of the most important features of any server. The more RAM a program uses, the less you will have available for other applications. Therefore, it is important to monitor memory usage on your Linux server to ensure that all programs are playing nice and that nothing wrong is going on.

1. /proc/meminfo – This file provides vital information about your system memory, virtual memory, swap, free memory, and much more. Run this command:

cat /proc/meminfo

2. top – Top gives you an overview of the top programs that are using CPU and RAM. It also gives you an overall figure of how much memory and swap is being used. Run this command:

top

3. free – Free gives you information about how much memory has been used, how much is free, how much cache is used and much more. Run this command to use it:

free -m -t

(the flags will monitor the memory as well as the total usage)

Because memory is so important to your server, you should also be proactive and investigate the memory usage of programs before you install them. If you are not sure if a program might be a memory hog, do a little preliminary research first.

 

How to Install Webmin in Ubuntu

Ubuntu is the most popular desktop Linux solution, and because of this, many system administrators have become comfortable using it even on the server. Ubuntu does offer a server edition, and it is just as powerful and useful as any of the other Linux server distributions. This brief guide will explain how to install Webmin, a powerful graphical system administration tool, on Ubuntu.

1. Drop to the console or login to your remote server via SSH

2. Install the following dependencies with this command:

sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python

3. Download the Webmin Debian package with:

wget http://prdownloads.sourceforge.net/webadmin/webmin_1.620_all.deb

(or whatever the URL for the current version is at webmin.com)

4. Install the package:

sudo dpkg -i webmin_1.620_all.deb

You should now be able to access webmin at your ip address at the port “10000″. For example, if your ip address is 192.168.2.1, you should be able to reach it at:

http://192.168.2.1:10000

You should now be able to login to webmin with any user that has root or sudo privileges.

 

Quick Bash Command Tricks Part 2

In the first part of this guide, we looked at some bash tricks that help you find things in the command history. In this section of the BASH (Born Again Shell) guide, we will look at some other functions.

Suffix command history

In the last post, we explained how to append the prefix from the previous command. This method uses the suffix. For example, if you ran the command:

$ !ls -al

You could then use !ls:p to append that suffix automatically:

$ !ls:p

Insert the last part of a command

You can also insert part of a command from the previous one !$

$ ls -al /home/user/something

Replace it with:

rm -rf !$

This would actually remove /home/user/something

Replace specific text from a command

If you ever make a typo, you can use ^A^B to fix it. For example, if you typed:

$ ls /home/user/somtheing

but you meant to spell “something”, simply enter:

$ ^mthe^meth

Show directory structure

By using / followed by the tab key twice “/[TAB][TAB]“, you can see the directory structure.

$ /[TAB][TAB]

Show commands with specific prefix

If you want to show only commands that have the prefix “mk” for example, you would enter:

$ mk[TAB][TAB]

And you would get an output like:

mk-build-deps mkfontscale mkfs.ext4dev mkfs.xfs mknod

mkdir mkfs mkfs.jfs mkhomedir_helper mkntfs

As you can see, BASH is extremely powerful, and we have only scratched the surface. Try out some of these and see how a few simple keystrokes can make your server management much easier.

Quick Bash Command Tricks

Bash is the common shell environment used on Linux servers. If you manage a server, there is a good chance you will need to drop to the command line at some point and encounter Bash or one of its alternatives. The following are some basic commands that can help speed up your bash experience.

Reload the previous command

Let us suppose you just ran the command:

$ apt-get install package-name

But you are on a system that needs “sudo” before running a program that requires root access. You could type the whole thing again and put “sudo” in front, or you could use “!!” to automatically load the previous command:

$ sudo !!

Load commands from a number of lines back

If you ran a command and then ran three more, for example, you may want to refer back to that first command. A quick way to do that is to use “!-n”.

$ !-4

This would go four lines back.

Load a command with a specific prefix

You can also load commands from your command history that match the prefix you specify. For example, if you ran the command “this-is-my-command”, you can match the “this” portion of it to find it:

$ !this

In part two of this guide, we will look at some other equally useful bash commands.

How to Kill a Zombie Process

Zombies present a particularly unique problem to system administrators. No, I do not mean the type of zombies that eat brains. I mean zombie processes. A zombie process is a process that is no longer active on a system but that refuses to die. In most cases, a zombie is not something that should alarm you, and some may even go away on their own.

If enough zombie processes appear, you may want to do something about them to get them off of your process table. Unfortunately, you cannot actually kill a zombie, as anyone who watches zombies movies would know. You can, however, attempt to make it go away.

First, to find zombies, use this command string:

ps aux | awk ‘{ print $8 ” ” $2 }’ | grep -w Z

The output will look like this:

Z 38012

Z 47290

Z 13845

You can use these PIDs and attempt to kill them using the traditional method:

kill -9 47290

There is a good chance, however, that this attempt will not work since zombies cannot be killed, as we have already stated. Since a zombie is essentially a defunct child process, there are three options: fix the parent process (make it wait), kill the parent (probably not a good idea), or live with it. Unlike the brain-eating zombies, this one typically will not do any damage, so the last option may be the most logical.