Senin, 24 Juni 2013

How-to-import-a-scheduled-task-from-windows-2003-job-to-windows-2008-xml

Where you got your job files was probably c:\windows\tasks, however under Vista there is a new place the xml files exist. (Under c:\windows\system32\tasks) Try looking there on your old machine if possible.
HOWEVER, there is a way if you can't get to the original machine easily.
  • You will need 2 files off an XP machine (Schtasks.exe and Schedsvc.dll) they are both in the Windows\System32 folder, copy them to USB and thats all you need from XP.
  • Now on your Vista machine. Put them in their own directory on your vista machine (lets say you make a directory called c:\sch and put those 2 files in there) DO NOT overwrite the vista ones in c:\windows\system32.
  • Rename your job files Tasks1.job, Tasks2.job, Tasks3.job, Tasks.job and copy them into c:\windows\tasks
  • Open up a command prompt (Start Programs, Accessories, right click on Command Prompt and select run as administrator)
  • Now to touch over the new .job files to get vistas scheduler to take on the parameters.
  • In your command prompt
    type in cd c:\sch then enter (for our example)
  • Now for each job type in schtasks /change /TN "Tasks1" /RU k0p0nkkk /RP k0p0nkkk (Changing the Test1 to Test2, Test3, Test4 for our example) The /RP and /RU values will have to change, thats a username and password (RP being password, RU Being User)
  • You should receive the message SUCCESS: The parameters of scheduled task "Test1" have been changed. for each job.
When done close your command prompt. From there Windows scheduler now knows about these, and you can use the windows Gui to update their names, and who they run as.

Kamis, 20 Juni 2013

How to use FTP from the command line

FTP (File Transfer Protocol) allows you to transfer files between your PC and other Internet systems (hosts). You can transfer files, work with local or remote directories, rename and display files, and execute system commands. Before you start, you must know how to log on to the remote system and have a userid and password on that system.

Note: Some systems allow anonymous ftp access. To use anonymous ftp, use anonymous as your userid and your e-mail address as the logon password.


Logging Onto and Off of a Remote System

To begin using Microsoft's FTP client, Open a command prompt and switch to the destination directory (where you want the download file).
To start an FTP session, enter: ftp host_name
where hostname is the name or IP address of the remote system.
You will then be asked to enter your userid and password.
Once you have successfully logged onto a remote system, you will be able to use ftp commands to view a listing of files on the remote system and transfer files between the two systems.
Example: Download i386.exe (Windows NT 3.5 Resource Kit) from ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt35/i386 to C:\Temp\Download
  1. Open a command prompt. Enter CD C:\Temp\Download (assuming that directory exists).
    Enter: ftp ftp.microsoft.com

    You should now see a prompt similar to this:
    Connected to ftp.microsoft.com.
    220 Microsoft FTP Service
    User (ftp.microsoft.com:(none)):
  2. For the userid, Enter: anonymous

    You should see a prompt similar to this:
    331 Anonymous access allowed, send identity (e-mail name) as password.
    Password:
  3. Enter: userid@domain.com as the password at the "Password:" prompt.
    Note: Any e-mail address in a userid@domain.com format should work. You will not be able to see the password as you type it.
  4. To download i386.exe from the bussys/winnt/winnt-public/reskit/nt35/i386 directory, Enter: get bussys/winnt/winnt-public/reskit/nt35/i386/i386.exe Note: You could have also used ls to view the directory and file names, cd bussys/winnt/winnt-public/reskit/nt35/i386 to switch directories, and get i386.exe to download the file from within that directory.
  5. To end the FTP session, Enter: quit or bye.
Note: Once you have extracted the resource kit, you will have to expand individual files
example: expand choice.ex_ choice.exe

FTP Commands

For a list of FTP commands, at the "ftp>" prompt, Enter: help When using ftp from the command prompt, the following list of supported commands will be displayed:
Note: Hover your mouse over a command to see what the output of "help *" is for that command.

!   
delete
literal
prompt
send
?   
debug
ls  
put 
status
append
dir
mdelete
pwd 
trace
ascii
disconnect
mdir
quit
type
bell
get 
mget
quote
user
binary
glob
mkdir
recv
verbose
bye 
hash
mls 
remotehelp
 
cd  
help
mput
rename
 
close
lcd 
open
rmdir
 
The question mark (?) command is equivalent to the help command. Typing help or ? followed by the name of a command will display a brief description of the command's purpose.
The exclamation point (!) can be used to shell to the system (command) prompt. Type Exit to return to the FTP session. You can also issue a subset of system commands to perform as you shell out, e.g., ! dir %windir% | more. When the commands in the shell have completed, you will be returned to the FTP session.
The pwd command will list the current directory on the remote machine. To change directories on the remote machine, use the cd command. To create a new directory on the remote machine, use the mkdir command followed by the name you would like to assign to the new directory. The lcd command can be used to change directories on the local (PC) machine.
To display a listing of files on the remote system, enter: ls or dir.
To download a file (copy a file from the remote system to your PC), you can use the command get or recv followed by the name of the file you would like to download. Optionally, you can follow the filename with a second filename which will be assigned to the file when it is downloaded to your PC. To download multiple files, you can use the mget command followed by a descriptor for the files you would like to download (e.g.: *.f for all files ending in ".f" or *.* for all files). You will be prompted to indicate whether you would like to download each file in turn. To turn off this prompting, enter the prompt command prior to entering the mget command; you will receive the message "Interactive mode OFF" indicating that prompting has been deactivated.
By default, files are downloaded and uploaded in ASCII file transfer mode. To download or upload files using Binary format mode, enter the command Binary at the "ftp>" prompt prior to downloading or uploading the file(s). To return to ASCII file transfer mode, enter the ASCII command.
To upload a file (copy a file from your PC to the remote system), you can use the command put or send followed by the name of the file you would like to upload. Optionally, you can follow the filename with a second filename which will be assigned to the file when it is uploaded to the remote system. The mput command can be used to upload multiple files.
You can use the close or disconnect command to drop the current ftp connection without exiting from the command enironment and then use the open command to connect to a new host.

Much of this article was taken from the dead link, http://www.cc.vt.edu/cc/us/docs/faqlib/windows95/clients/msftp.html

Senin, 10 Juni 2013

7 Useful Linux Utilities

There are 7 useful linux utilities that you must install on new linux server. Most Linux distributions are equipped with tons of linux command utility, but if you have installed minimal operating system, all these software will not exist. These tools will very useful in your troubleshooting and will help to find possible causes of a problem. Most of the utilities have the same function in CentOS or Red Hat Enterprise Linux (RHEL). You can easily identify whether the utility installed on your linux operating system or not. You will see one or more below warning :
[root@rhel62 ~]# wget
-bash: wget: command not found
[root@rhel62 ~]# telnet
-bash: telnet: command not found
[root@rhel62 ~]# scp
-bash: scp: command not found
[root@rhel62 ~]# man scp
-bash: man: command not found
[root@rhel62 ~]# nslookup
-bash: nslookup: command not found
[root@rhel62 ~]# dig
-bash: dig: command not found
[root@rhel62 ~]# host
-bash: host: command not found
1. What is wget ?
Wget is a network utility to retrieve files from the Web using http and ftp, the two most widely used Internet protocols.
Example :
[root@rhel62 ~]# wget http://files2.zimbra.com/downloads/8.0.2_GA/zcs-8.0.2_GA_5569.RHEL6_64.20121210115059.tgz
2. What is telnet ?
Telnet is a network protocol used on the Internet or local area networks. Telnet is a user command and an underlying TCP/IP protocol for accessing remote computers and very useful for troubleshooting and verify the opened ports.
Example :
[root@rhel62 ~]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 rhel62.ehowstuff.local ESMTP Postfix
3. What is scp ?
scp also call secure copy, is remote file copy utility between hosts on a network. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.
Example :
[root@rhel62 ~]# scp root@192.168.2.60:/tmp/VMwareTools-9.2.2-893683.tar.gz .
The authenticity of host '192.168.2.60 (192.168.2.60)' can't be established.
RSA key fingerprint is 76:78:87:36:44:c1:46:fa:c4:b4:61:4a:e5:b3:be:e3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.60' (RSA) to the list of known hosts.
root@192.168.2.60's password:
VMwareTools-9.2.2-893683.tar.gz                                                       100%   63MB  63.3MB/s   00:01
4. What is man ?
man is used to display the manual page for other commands It’s help to explain the functions for the commands that commonly used. The term “man” is short for manual.
Example :
[root@rhel62 ~]# man wget
WGET(1)                            GNU Wget                            WGET(1)

NAME
       Wget - The non-interactive network downloader.

SYNOPSIS
       wget [option]... [URL]...

DESCRIPTION
       GNU Wget is a free utility for non-interactive download of files from the Web.  It supports HTTP,
       HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

       Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.
       This allows you to start a retrieval and disconnect from the system, letting Wget finish the work.
       By contrast, most of the Web browsers require constant userĂ¢s presence, which can be a great
       hindrance when transferring a lot of data.

       Wget can follow links in HTML, XHTML, and CSS pages, to create local versions of remote web sites,
       fully recreating the directory structure of the original site.  This is sometimes referred to as
       "recursive downloading."  While doing that, Wget respects the Robot Exclusion Standard (/robots.txt).
       Wget can be instructed to convert the links in downloaded files to point at the local files, for
       offline viewing.
5. What is nslookup, dig, host ?
nslookup, dig and host are part of the bind utilities.These utilities are the basic tools for DNS client and DNS server troubleshooting.
Examples :
[root@rhel62 ~]# nslookup
> set type=mx
> ehowstuff.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
ehowstuff.com   mail exchanger = 0 ehowstuff.com.

Authoritative answers can be found from:
>
[root@rhel62 ~]# dig ehowstuff.com

; < <>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 < <>> ehowstuff.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER< <- opcode: QUERY, status: NOERROR, id: 4273
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;ehowstuff.com.                 IN      A

;; ANSWER SECTION:
ehowstuff.com.          14400   IN      A       184.173.214.97

;; Query time: 272 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Mar 12 21:41:50 2013
;; MSG SIZE  rcvd: 47

[root@rhel62 ~]# host -t mx ehowstuff.com
ehowstuff.com mail is handled by 0 ehowstuff.com.
How to install wget, scpt, telnet, man, nslookup, dig and host utilities ?
Simply run the following commands :
[root@rhel62 ~]# yum install wget telnet openssh-clients bind-utils man -y

How to Configure Static IP Address on CentOS 6.4

When you run one or more of any type of Web, DNS, Email, FTP or any other application server’s directly on your site, then you are require Static IP address. If you run a website hosting in Virtual Private Server (VPS), end user will types the domain name (e.g www.example.com) into their web browser it is translated via a DNS service to a specific IP address of your web server. Rules of thumb, any type of server is mandatory to have static IP Address because it is constant, otherwise the end user or the websites visitors will experience inaccessible website. This post will share how to setup Static IP Address on CentOS 6.4.
1. Configure static IP address on eth0 :
[root@centos64 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Original :
DEVICE=eth0
HWADDR=00:0C:29:F1:24:F0
TYPE=Ethernet
UUID=324bfeb3-2a7c-409c-98d0-5cf1607596c4
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=dhcp
Set to the following :
DEVICE=eth0
HWADDR=00:0C:29:F1:24:F0
TYPE=Ethernet
UUID=324bfeb3-2a7c-409c-98d0-5cf1607596c4
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.2.62
NETMASK=255.255.0.0
2. Configure gateway :
[root@centos64 ~]# vi /etc/sysconfig/network
Add gateway line :
NETWORKING=yes
HOSTNAME=centos64.ehowstuff.local
GATEWAY=192.168.2.1
3. Configure DNS :
; generated by /sbin/dhclient-script
search Belkin ehowstuff.local
nameserver 192.168.2.1
Update to the following :
search ehowstuff.local
nameserver 8.8.8.8
4. Restart network service to apply the changes :
[root@centos64 ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]

How to Update CentOS 6.4 System using ‘yum update’

This post will show how you can update CentOS 6.4 system with ‘yum‘ command. You should update the linux to newer release or latest linux kernal because you will get security fixes, stability improvements, updated device drivers, get new kernel functions and to increased speed of the linux operating system. After get all above benefits, it’s very worthwhile to update your kernel for Linux often as soon as new update released. Now let’s take a look at the most common linux command that we can use for updating linux system. This steps has been tested on CentOS 6.4.

1 Get ‘yum-plugin-fastestmirror’ plugin installed. This plugin will looks for fast server to download packages :

[root@centos64 ~]# yum install yum-plugin-fastestmirror -y

2. Check current version and current kernel version :

[root@centos64 ~]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@centos64 ~]# uname -a
Linux centos64.ehowstuff.local 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

3. Perform system update by ‘yum update’ command :

[root@centos64 ~]# yum update -y
Example :
[root@centos64 ~]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package dbus-glib.x86_64 0:0.86-5.el6 will be updated
---> Package dbus-glib.x86_64 0:0.86-6.el6 will be an update
---> Package kernel.x86_64 0:2.6.32-358.2.1.el6 will be installed
---> Package kernel-firmware.noarch 0:2.6.32-358.el6 will be updated
---> Package kernel-firmware.noarch 0:2.6.32-358.2.1.el6 will be an update
---> Package libxml2.x86_64 0:2.7.6-8.el6_3.4 will be updated
---> Package libxml2.x86_64 0:2.7.6-12.el6_4.1 will be an update
---> Package mysql-libs.x86_64 0:5.1.66-2.el6_3 will be updated
---> Package mysql-libs.x86_64 0:5.1.67-1.el6_3 will be an update
---> Package openldap.x86_64 0:2.4.23-31.el6 will be updated
---> Package openldap.x86_64 0:2.4.23-32.el6_4 will be an update
---> Package openssl.x86_64 0:1.0.0-27.el6 will be updated
---> Package openssl.x86_64 0:1.0.0-27.el6_4.2 will be an update
---> Package selinux-policy.noarch 0:3.7.19-195.el6 will be updated
---> Package selinux-policy.noarch 0:3.7.19-195.el6_4.3 will be an update
---> Package selinux-policy-targeted.noarch 0:3.7.19-195.el6 will be updated
---> Package selinux-policy-targeted.noarch 0:3.7.19-195.el6_4.3 will be an update
---> Package tzdata.noarch 0:2012j-1.el6 will be updated
---> Package tzdata.noarch 0:2012j-2.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package                            Arch              Version                        Repository          Size
==============================================================================================================
Installing:
 kernel                             x86_64            2.6.32-358.2.1.el6             updates             26 M
Updating:
 dbus-glib                          x86_64            0.86-6.el6                     updates            170 k
 kernel-firmware                    noarch            2.6.32-358.2.1.el6             updates             11 M
 libxml2                            x86_64            2.7.6-12.el6_4.1               updates            799 k
 mysql-libs                         x86_64            5.1.67-1.el6_3                 updates            1.2 M
 openldap                           x86_64            2.4.23-32.el6_4                updates            265 k
 openssl                            x86_64            1.0.0-27.el6_4.2               updates            1.4 M
 selinux-policy                     noarch            3.7.19-195.el6_4.3             updates            1.8 M
 selinux-policy-targeted            noarch            3.7.19-195.el6_4.3             updates            2.8 M
 tzdata                             noarch            2012j-2.el6                    updates            453 k

Transaction Summary
==============================================================================================================
Install       1 Package(s)
Upgrade       9 Package(s)

Total download size: 46 M
Downloading Packages:
(1/10): dbus-glib-0.86-6.el6.x86_64.rpm                                                | 170 kB     00:01
(2/10): kernel-2.6.32-358.2.1.el6.x86_64.rpm                                           |  26 MB     04:11
(3/10): kernel-firmware-2.6.32-358.2.1.el6.noarch.rpm                                  |  11 MB     01:45
(4/10): libxml2-2.7.6-12.el6_4.1.x86_64.rpm                                            | 799 kB     00:06
(5/10): mysql-libs-5.1.67-1.el6_3.x86_64.rpm                                           | 1.2 MB     00:11
(6/10): openldap-2.4.23-32.el6_4.x86_64.rpm                                            | 265 kB     00:05
(7/10): openssl-1.0.0-27.el6_4.2.x86_64.rpm                                            | 1.4 MB     00:12
(8/10): selinux-policy-3.7.19-195.el6_4.3.noarch.rpm                                   | 1.8 MB     00:17
(9/10): selinux-policy-targeted-3.7.19-195.el6_4.3.noarch.rpm                          | 2.8 MB     00:27
(10/10): tzdata-2012j-2.el6.noarch.rpm                                                 | 453 kB     00:07
--------------------------------------------------------------------------------------------------------------
Total                                                                         105 kB/s |  46 MB     07:27
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) 
 Package: centos-release-6-4.el6.centos.10.x86_64 (@anaconda-CentOS-201303020151.x86_64/6.4)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : openssl-1.0.0-27.el6_4.2.x86_64                                                           1/19
  Updating   : selinux-policy-3.7.19-195.el6_4.3.noarch                                                  2/19
  Updating   : kernel-firmware-2.6.32-358.2.1.el6.noarch                                                 3/19
  Installing : kernel-2.6.32-358.2.1.el6.x86_64                                                          4/19
  Updating   : selinux-policy-targeted-3.7.19-195.el6_4.3.noarch                                         5/19
  Updating   : mysql-libs-5.1.67-1.el6_3.x86_64                                                          6/19
  Updating   : openldap-2.4.23-32.el6_4.x86_64                                                           7/19
  Updating   : tzdata-2012j-2.el6.noarch                                                                 8/19
  Updating   : dbus-glib-0.86-6.el6.x86_64                                                               9/19
  Updating   : libxml2-2.7.6-12.el6_4.1.x86_64                                                          10/19
  Cleanup    : selinux-policy-targeted-3.7.19-195.el6.noarch                                            11/19
  Cleanup    : selinux-policy-3.7.19-195.el6.noarch                                                     12/19
  Cleanup    : tzdata-2012j-1.el6.noarch                                                                13/19
  Cleanup    : kernel-firmware-2.6.32-358.el6.noarch                                                    14/19
  Cleanup    : mysql-libs-5.1.66-2.el6_3.x86_64                                                         15/19
  Cleanup    : openssl-1.0.0-27.el6.x86_64                                                              16/19
  Cleanup    : openldap-2.4.23-31.el6.x86_64                                                            17/19
  Cleanup    : dbus-glib-0.86-5.el6.x86_64                                                              18/19
  Cleanup    : libxml2-2.7.6-8.el6_3.4.x86_64                                                           19/19
  Verifying  : libxml2-2.7.6-12.el6_4.1.x86_64                                                           1/19
  Verifying  : kernel-firmware-2.6.32-358.2.1.el6.noarch                                                 2/19
  Verifying  : dbus-glib-0.86-6.el6.x86_64                                                               3/19
  Verifying  : selinux-policy-3.7.19-195.el6_4.3.noarch                                                  4/19
  Verifying  : tzdata-2012j-2.el6.noarch                                                                 5/19
  Verifying  : mysql-libs-5.1.67-1.el6_3.x86_64                                                          6/19
  Verifying  : openssl-1.0.0-27.el6_4.2.x86_64                                                           7/19
  Verifying  : kernel-2.6.32-358.2.1.el6.x86_64                                                          8/19
  Verifying  : openldap-2.4.23-32.el6_4.x86_64                                                           9/19
  Verifying  : selinux-policy-targeted-3.7.19-195.el6_4.3.noarch                                        10/19
  Verifying  : tzdata-2012j-1.el6.noarch                                                                11/19
  Verifying  : kernel-firmware-2.6.32-358.el6.noarch                                                    12/19
  Verifying  : selinux-policy-3.7.19-195.el6.noarch                                                     13/19
  Verifying  : openssl-1.0.0-27.el6.x86_64                                                              14/19
  Verifying  : selinux-policy-targeted-3.7.19-195.el6.noarch                                            15/19
  Verifying  : mysql-libs-5.1.66-2.el6_3.x86_64                                                         16/19
  Verifying  : libxml2-2.7.6-8.el6_3.4.x86_64                                                           17/19
  Verifying  : openldap-2.4.23-31.el6.x86_64                                                            18/19
  Verifying  : dbus-glib-0.86-5.el6.x86_64                                                              19/19

Installed:
  kernel.x86_64 0:2.6.32-358.2.1.el6

Updated:
  dbus-glib.x86_64 0:0.86-6.el6                     kernel-firmware.noarch 0:2.6.32-358.2.1.el6
  libxml2.x86_64 0:2.7.6-12.el6_4.1                 mysql-libs.x86_64 0:5.1.67-1.el6_3
  openldap.x86_64 0:2.4.23-32.el6_4                 openssl.x86_64 0:1.0.0-27.el6_4.2
  selinux-policy.noarch 0:3.7.19-195.el6_4.3        selinux-policy-targeted.noarch 0:3.7.19-195.el6_4.3
  tzdata.noarch 0:2012j-2.el6

Complete!

How to Fix “Could not reliably determine the server’s fully qualified domain name”

Question :
How to fix “Could not reliably determine the server’s fully qualified domain name” when starting apache httpd service ?
[root@centos64 ~]# service httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed for centos64.ehowstuff.local
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [  OK  ]
Answer :

Step 1:

Update /etc/hosts and do server’s ip address resolvable to the fully qualified domain name(fqdn) or hostname.
[root@centos64 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.2.62 centos64.ehowstuff.local

Step 2:

Restart apache httpd service :
[root@centos64 ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

4 Steps to Disable SELinux on CentOS 6.4

There are four easy steps to disable Security-Enhanced Linux (SELinux) on CentOS 6.4. The steps was very simple, but if we did not disable this feature, you may hit a problem when try to do software installation. SELinux checking for allowed operations after standard Linux discretionary access controls are checked. Follow below steps to disable SELinux on CentOS 6.4.

1. Check selinux status :

[root@centos64 ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

2. Disable SELinux immediately without reboot :

[root@centos64 ~]# setenforce 0

3. Disable SELinux on CentOS 6.4 permanently :

[root@centos64 ~]# vi /etc/sysconfig/selinux
Change “SELINUX=enforcing” to “SELINUX=disabled” :
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

4. Reboot Operating system :

[root@centos64 ~]# reboot

How to Add Network Adapter Without Reboot on CentOS 6/RHEL 6

This post describes on how to assign more than one network interface on the VMware virtual machine (VM) without reboot on linux. By default, one network interface should be enough to run the virtual over the network. In order to load balance the traffic or to enable multiple network segment in the VM, more than one interface card may required. It was assumed that eth0 hsa been configured and running. The process of adding a network interface card is very simple. In VMware ESXi/ESX and VMware workstation, you have to perform add hardware wizard and then select “Network Adapter”. This steps has been tested on CentOS 6.4.
1. Check existing network setting.
[root@centos64 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:F1:24:F0
          inet addr:192.168.2.62  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::20c:29ff:fef1:24f0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:735 errors:0 dropped:0 overruns:0 frame:0
          TX packets:81 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:72242 (70.5 KiB)  TX bytes:8635 (8.4 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
2. Enter network configuration folder, and look for ethx file. By default, first network interface will start with eth0. Next added network adapter will be eth1.
[root@centos64 ~]# cd /etc/sysconfig/network-scripts/
[root@centos64 network-scripts]# ls
ifcfg-eth0   ifdown-ippp  ifdown-routes  ifup-bnep  ifup-plip    ifup-sit          network-functions
ifcfg-lo     ifdown-ipv6  ifdown-sit     ifup-eth   ifup-plusb   ifup-tunnel       network-functions-ipv6
ifdown       ifdown-isdn  ifdown-tunnel  ifup-ippp  ifup-post    ifup-wireless
ifdown-bnep  ifdown-post  ifup           ifup-ipv6  ifup-ppp     init.ipv6-global
ifdown-eth   ifdown-ppp   ifup-aliases   ifup-isdn  ifup-routes  net.hotplug
3. After you add secondary network interface from VMware level, the file will automatically added the mac address in /etc/udev/rules.d/70-persistent-net.rules. Please take note on the mac address for eth1.
[root@centos64 ~]# more /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:f1:24:f0", ATTR{type}=="1", KERNEL=="
eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:f1:24:fa", ATTR{type}=="1", KERNEL=="
eth*", NAME="eth1"
4. Now you need to create the configuration file for your new interface. The network interface configuration files are placed in /etc/sysconfig/network-scripts/. change the mac address according based on /etc/udev/rules.d/70-persistent-net.rules.
[root@centos64 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
Add below setting :
DEVICE=eth1
HWADDR=00:0c:29:f1:24:fa
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.2.63
NETMASK=255.255.0.0
5. Based on the type interface being added, issue an ifup command. In this case, we have added eth1.
[root@centos64 ~]# ifup eth1
6. Verify new Network interfaces :
[root@centos64 ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:F1:24:F0
          inet addr:192.168.2.62  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::20c:29ff:fef1:24f0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8019 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6949 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:804606 (785.7 KiB)  TX bytes:694075 (677.8 KiB)

[root@centos64 ~]# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:0C:29:F1:24:FA
          inet addr:192.168.2.63  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::20c:29ff:fef1:24fa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:450 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:40087 (39.1 KiB)  TX bytes:1182 (1.1 KiB)

9 Steps to Setup Dedicated Server for your Website

There are different type of hosting services are used in the computer technology such as shared hosting, VPS (Virtual Private Server) and Dedicated Server hosting. For new website with low number of visitors, i would highly recommend getting a shared hosting. If you need more control of the server, then you should moving from shared hosting to a VPS. There are plenty of hosting companies offering Virtual Private Servers, and VPS hosting is getting cheaper. Your website will affected on a super slow website performance due to limited amount of resources when running a VPS hosting and also the number of visitors had increased to tens of thousands or even hundreds of thousands per day. At the situation when you are hitting super slow website performance due to huge number of traffics, i would recommend you to getting dedicated server that will provide you excellent processing performance of your website. This because the memory, hard disk storage capacity, processing power, and network access are all 100% to dedicated server instead of shared amongst multiple VPS customers or dozens of shared hosting customers. Great websites in internet have a great server behind them. In this post, i would like to share 9 steps you will need to Setup Dedicated Server for your Website.

9 Steps to Setup Dedicated Server

1. Choose and Install Linux operating system :

Choosing the right platform on which to host your dedicated server. Please make sure that you are familiar with the preferred operating system (OS) either CentOS or Fedora or Ubuntu. I would recommend you do clean minimal install of the OS.

2. Update operating system :

Make sure that the OS has been applied the latest patches.
How to Update CentOS 6.4 System using ‘yum update’

3. Install Apache or Nginx Web server :

Apache httpd is one of the most popular web servers and has a lot of features that make it very extensible and useful for many different types of websites. Alternative to Apache http server, you also can install NGINX. Nginx or “engine x” is a free, open-source HTTP server that provide high performance edge web server with the lowest memory footprint and the key features to build modern and efficient web infrastructure.
How to Setup Nginx With PHP-FastCGI on CentOS 6.2/CentOS 6.3 VPS Server

4. Install MySQL Database server :

MySQL server is a database server that can stores and retrieves data for the blog, websites and applications. It is one of the most popular most used in the internet especially for content management and blogging site.

5. Install PHP :

PHP: Hypertext Preprocessor is a widely used, free and open-source server-side scripting language that was especially designed for web development to produce dynamic web pages and can be embedded into HTML.

6. Install Bind DNS server :

BIND (the Berkeley Internet Name Domain) also known as NAMED is the most widely used DNS server in the internet. Bind DNS helps to resolve domain name to ip address and ip address to domain name.

7. Install FTP server :

File Transfer Protocol (FTP) is a network protocol used transfer file in the network. one of the most popular FTP server for Unix/Linux is vsftpd. Vsftpd stand for Very Secure FTP Daemon. Vsftpd not only just another popular FTP server for Unix/Linux systems, but vsftpd delivers excellent performance by consuming less memory.

8. Harden and Secure the dedicated server :

There are a few steps to harden the OS of dedicated server.
a) Install a host based firewall to protect your dedicated server from unauthorized access:
Once you have your web server running, you have to install host based firewall and open only certain port in your firewall. I would recommend you tosetting up iptables on your linux dedicated server.
b) Use Strong passwords :
Password complexity requirements should be in place to enforce strong password. A strong password should have mixed case, special characters, numbers, and be longer than 8 characters. Additional security, the passwords should be changed regularly.
c) Disable Unnecessary Processes, Services and Daemons :
I would recommend you to disable unneeded processes,services and daemon such as bluetooth, hidd, cups, yum-updatesd, ypbind, nfs, snmpd, saslauthd, netfs, gpm, pcmcia and sendmail. SELinux also should be set to “Disabled”. This is still very experimental so I would leave this disabled unless you really know what you are doing.

9. Install or migrate over the content of your website or blog :

You can start to migrate over the content of your website or blog to your new dedicated server. For dynamic content blog, i would recommend you to use WordPress as a platform. WordPress is an open-source blogging platform. It’s a free blogging tool and content management system (CMS) based on PHP and MySQL.

Securing and Hardening Linux Dedicated Server

When we hosted the linux dedicated server or virtual private server(VPS) in a data center, security of the system is very important in order to ensure the data and the information are safe from the hackers. Securing and hardening linux dedicated server is mandatory when nearly every computing resources and the application systems is online and susceptible to attack. This post share basic security and hardening tips for the linux dedicated server. If you are plan to host your own linux dedicated server, then this post should able to provide you a good baseline and ideas. The following are the best practices to securing and hardening linux dedicated server :
1. Patching Linux Systems
2. Keep Linux Kernel and Software such as WordPress/Joomla Up to Date
3. Secure SSH
4. Enforcing Stronger Passwords and Password Aging
5. Disable Unnecessary Processes, Services and Daemons
6. Install a host based firewall to protect your dedicated server from unauthorized access
7. Implement Linux Kernel /etc/sysctl.conf hardening
8. Configure Logging and Auditing
9. Install And Use Intrusion Detection System

How to Setup Apache httpd on CentOS Dedicated Server

The Apache HTTP Server is a free or open source Web server developed by the Apache Software Foundation (http://www.apache.org/). This post describes the basic steps to setup Apache httpd on CentOS 6.4 64 bit dedicated server to host the website and blog. Having dedicated web server, you will get more control and flexibility on the configuration and you does not share its resources with anyone else. With at least 2GB RAM, you will get fairly consistent load times and better speed if compared to shared hosting and virtual private server (VPS). Bloggers or webmasters can get reasonable dedicated server price starting at $139 at very reputable companies such as hostgator.

1. How to Install httpd :

[root@centos64 ~]# yum install httpd -y

2. How to Check Apache server version :

[root@centos64 ~]# httpd -V
Server version: Apache/2.2.15 (Unix)
Server built:   Feb 22 2013 11:19:58
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

3. Change /etc/hosts file :

[root@centos64 ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.2.62 centos64.ehowstuff.local

4. Always backup the original configuration file before doing any changes :

[root@centos64 ~]# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup.01042013
Note : -p mean preserve the specified attributes (default: mode,ownership,timestamps)

5. How to Configure httpd Apache service :

[root@centos64 ~]# vi /etc/httpd/conf/httpd.conf
ServerTokens Prod
KeepAlive On
ServerAdmin root@ehowstuff.local
ServerName www.ehowstuff.local:80
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
DirectoryIndex index.html index.cgi index.php
ServerSignature Off
#AddDefaultCharset UTF-8
AddHandler cgi-script .cgi .pl

6. Restart Apache httpd :

[root@centos64 ~]# /sbin/service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

7. How to configure Apache httpd auto start at boot :

[root@centos64 ~]# chkconfig httpd on

8. How to check the apache access log :

[root@centos64 ~]# tail -f /var/log/httpd/access_log
192.168.2.52 - - [01/Apr/2013:23:14:35 +0800] "GET /index.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2524 "http://192.168.2.62/" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"
192.168.2.52 - - [01/Apr/2013:23:14:35 +0800] "GET /index.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2146 "http://192.168.2.62/" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"
192.168.2.52 - - [01/Apr/2013:23:14:35 +0800] "GET / HTTP/1.1" 200 71412 "-" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"
192.168.2.52 - - [01/Apr/2013:23:14:36 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"
192.168.2.52 - - [01/Apr/2013:23:14:36 +0800] "GET /favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"

How to Install and Configure Bind Chroot DNS Server on CentOS 6.4 VPS

This post will describe the steps to install and configure bind chroot DNS Server on CentOS 6.4 VPS or dedicated server. Usually if you plan to setup your own mail server or web server, it’s good to have your own domain name service (DNS), so that you will have full control of the domain and subdomain. BIND (the Berkeley Internet Name Domain) also known as NAMED is the most widely used DNS server in the internet. Bind DNS helps to resolve domain name to ip address and ip address to domain name. Beside having full control of our registered domain name, it will also help to improve the speed of domain lookups. This post has been tested on CentOS 6.4 64 bit. When you run BIND in a chroot jail, the process is simply unable to see any part of the filesystem outside the jail. For example, in this post, i will setting up BIND to run chrooted to the directory /var/named/chroot/. Well, to BIND, the contents of this directory will appear to be /, the root directory. A “jail” is a software mechanism for limiting the ability of a process to access resources outside a very limited area, and it’s purposely to enhance the security. Bind Chroot DNS server was by default configured to /var/named/chroot. Follow these steps to setup Bind Chroot DNS Server on CentOS 6.4.
1. Install Bind Chroot DNS server :
[root@centos64 ~]# yum install bind-chroot bind -y
2. Copy all bind related files to prepare bind chrooted environments :
[root@centos64 ~]# cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/
3. Create bind related files into chrooted directory :
[root@centos64 ~]# touch /var/named/chroot/var/named/data/cache_dump.db
[root@centos64 ~]# touch /var/named/chroot/var/named/data/named_stats.txt
[root@centos64 ~]# touch /var/named/chroot/var/named/data/named_mem_stats.txt
[root@centos64 ~]# touch /var/named/chroot/var/named/data/named.run
[root@centos64 ~]# mkdir /var/named/chroot/var/named/dynamic
[root@centos64 ~]# touch /var/named/chroot/var/named/dynamic/managed-keys.bind
4. Bind lock file should be writeable, therefore set the permission to make it writable as below :
[root@centos64 ~]# chmod -R 777 /var/named/chroot/var/named/data
[root@centos64 ~]# chmod -R 777 /var/named/chroot/var/named/dynamic
5. Set if you do not use IPv6 :
[root@centos64 ~]# echo 'OPTIONS="-4"' >> /etc/sysconfig/named
6. Copy /etc/named.conf chrooted bind config folder :
[root@centos64 ~]# cp -p /etc/named.conf /var/named/chroot/etc/named.conf
7.Configure main bind configuration in /etc/named.conf. Append the ehowstuff.local information to the file :
[root@centos64 ~]# vi /var/named/chroot/etc/named.conf
a. Add bind DNS IP addresses :
..
listen-on port 53 { 127.0.0.1;192.168.2.62;192.168.2.63; };
..
b. Create forward and reverse zone :
..
..
zone "ehowstuff.local" {
    type master;
    file "ehowstuff.local.zone";
};

zone "2.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.2.zone";
};
..
..
Full configuration for named.conf :
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
        listen-on port 53 { 127.0.0.1;192.168.2.62;192.168.2.63; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     { localhost; };
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "ehowstuff.local" {
    type master;
    file "ehowstuff.local.zone";
};

zone "2.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.2.zone";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
8. Create Forward and Reverse zone files for domain ehowstuff.local.
a) Create Forward Zone :
[root@centos64 ~]# vi /var/named/chroot/var/named/ehowstuff.local.zone
;
;       Addresses and other host information.
;
@       IN      SOA     ehowstuff.local. hostmaster.ehowstuff.local. (
                               2013042201      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

;       Define the nameservers and the mail servers

               IN      NS      ns1.ehowstuff.local.
               IN      NS      ns2.ehowstuff.local.
               IN      A       192.168.2.62
               IN      MX      10 mail.ehowstuff.local.

centos64           IN      A       192.168.2.62
mail            IN      A       192.168.2.62
ns1              IN      A       192.168.2.62
ns2              IN      A       192.168.2.63
b) Create Reverse Zone :
[root@centos64 ~]# vi /var/named/chroot/var/named/192.168.2.zone
;
;       Addresses and other host information.
;
@       IN      SOA     ehowstuff.local. hostmaster.ehowstuff.local. (
                               2013042201      ; Serial
                               43200      ; Refresh
                               3600       ; Retry
                               3600000    ; Expire
                               2592000 )  ; Minimum

2.168.192.in-addr.arpa. IN      NS      centos64.ehowstuff.local.

62.2.168.192.in-addr.arpa. IN PTR mail.ehowstuff.local.
62.2.168.192.in-addr.arpa. IN PTR ns1.ehowstuff.local.
63.2.168.192.in-addr.arpa. IN PTR ns2.ehowstuff.local.
9. Start Bind service :
[root@centos64 ~]# /etc/init.d/named start
Generating /etc/rndc.key:                                  [  OK  ]
Starting named:                                            [  OK  ]
10. Configure Bind auto start at boot :
[root@centos64 ~]# chkconfig --levels 235 named on
11. Test and verify Bind DNS setup :
a. Test and verify using host command :
[root@centos64 ~]# host -t ns ehowstuff.local
ehowstuff.local name server ns1.ehowstuff.local.
ehowstuff.local name server ns2.ehowstuff.local.
[root@centos64 ~]# host -t mx ehowstuff.local
ehowstuff.local mail is handled by 10 mail.ehowstuff.local.
b. Test and verify using nslookup command :
[root@centos64 ~]# nslookup
> set type=any
> ehowstuff.local
Server:         192.168.2.62
Address:        192.168.2.62#53

ehowstuff.local
        origin = ehowstuff.local
        mail addr = hostmaster.ehowstuff.local
        serial = 2013042201
        refresh = 43200
        retry = 3600
        expire = 3600000
        minimum = 2592000
ehowstuff.local nameserver = ns1.ehowstuff.local.
ehowstuff.local nameserver = ns2.ehowstuff.local.
Name:   ehowstuff.local
Address: 192.168.2.62
ehowstuff.local mail exchanger = 10 mail.ehowstuff.local.
> exit
c. Test and verify using dig command :
[root@centos64 ~]# dig ehowstuff.local

; < <>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.4 < <>> ehowstuff.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER< <- opcode: QUERY, status: NOERROR, id: 6958
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;ehowstuff.local.               IN      A

;; ANSWER SECTION:
ehowstuff.local.        2592000 IN      A       192.168.2.62

;; AUTHORITY SECTION:
ehowstuff.local.        2592000 IN      NS      ns1.ehowstuff.local.
ehowstuff.local.        2592000 IN      NS      ns2.ehowstuff.local.

;; ADDITIONAL SECTION:
ns1.ehowstuff.local.    2592000 IN      A       192.168.2.62
ns2.ehowstuff.local.    2592000 IN      A       192.168.2.63

;; Query time: 1 msec
;; SERVER: 192.168.2.62#53(192.168.2.62)
;; WHEN: Wed Apr  3 00:03:40 2013
;; MSG SIZE  rcvd: 117

How to Uninstall VMware Tools on Linux, Solaris, FreeBSD

Question :
How to Uninstall VMware Tools if upgrade of VMware Tools is incomplete and i got hit by any problem during installation ?
Answer :
Option 1 :
On a Linux guest operating system that has VMware Tools installed by using an RPM installer, enter the following command in a terminal :
[root@centos64 ~]# rpm -e VMwareTools
Option 2 :
On a Linux, Solaris, FreeBSD, NetWare guest operating system that has VMware Tools installed by vmware-install.pl, please log in as root and enter the following command in a terminal :
[root@centos64 ~]# vmware-uninstall-tools.pl
Example :
[root@centos64 ~]# vmware-uninstall-tools.pl
Uninstalling the tar installation of VMware Tools.

Stopping services for vmware-tools

initctl: Unknown instance:
Stopping services for vmware-tools-thinprint

initctl: Unknown instance:
This program previously created the file
/usr/lib/vmware-tools/lib64/libconf/etc/pango/pango.modules, and was about to
remove it.  Somebody else apparently did it already.

File /etc/vmware-tools/vmware-user.desktop is backed up to
/etc/vmware-tools/vmware-user.desktop.old.0.

File /usr/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gtk.immodules is backed up
to /usr/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gtk.immodules.old.0.

File /usr/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gdk-pixbuf.loaders is
backed up to
/usr/lib/vmware-tools/lib64/libconf/etc/gtk-2.0/gdk-pixbuf.loaders.old.0.

This program previously created the file
/usr/lib/vmware-tools/libconf/etc/gtk-2.0/gdk-pixbuf.loaders, and was about to
remove it.  Somebody else apparently did it already.

This program previously created the file
/usr/lib/vmware-tools/lib64/libconf/etc/pango/pangorc, and was about to remove
it.  Somebody else apparently did it already.

This program previously created the file
/usr/lib/vmware-tools/libconf/etc/gtk-2.0/gtk.immodules, and was about to
remove it.  Somebody else apparently did it already.

This program previously created the file
/usr/lib/vmware-tools/lib64/libconf/etc/pango/pangox.aliases, and was about to
remove it.  Somebody else apparently did it already.

This program previously created the directory
/usr/lib/vmware-tools/lib64/libconf/etc/gtk-2.0, and was about to remove it.
Since there are files in that directory that this program did not create, it
will not be removed.

This program previously created the directory
/usr/lib/vmware-tools/lib64/libconf/etc, and was about to remove it. Since
there are files in that directory that this program did not create, it will not
be removed.

This program previously created the directory
/usr/lib/vmware-tools/lib64/libconf, and was about to remove it. Since there
are files in that directory that this program did not create, it will not be
removed.

This program previously created the directory /usr/lib/vmware-tools/lib64, and
was about to remove it. Since there are files in that directory that this
program did not create, it will not be removed.

This program previously created the directory /usr/lib/vmware-tools, and was
about to remove it. Since there are files in that directory that this program
did not create, it will not be removed.

The removal of VMware Tools 9.2.2 build-893683 for Linux completed
successfully.  Thank you for having tried this software.

How to Install VMware Tools on CentOS 6.4

This post provides steps to install VMware Tools in CentOS 6.4. It is very important to install VMware Tools in the guest operating system. Without the VMware Tools, guest OS performance will lacks some of the important functionality. VMware Tools is a group of utilities that enhances the overall performance of the virtual machine’s guest operating system (OS) and improves management of the virtual machine (VM). This is one of important components in order to provide perfect VM OS.
1. Choose your VM –> Click “Install VMware Tools” from the VMware Workstation menu, VMware Workstation temporarily connects the virtual machine’s first virtual CD-ROM drive to the ISO image file that contains the VMware Tools installer for your guest operating system and you are ready to begin the installation process.
2. Install prerequisites :
[root@centos64 ~]# yum install perl gcc make -y
Example :
[root@centos64 ~]# yum install perl gcc make -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ipserverone.com
 * extras: centos.ipserverone.com
 * updates: centos.ipserverone.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-3.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-3.el6 for package: gcc-4.4.7-3.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-3.el6 for package: gcc-4.4.7-3.el6.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.7-3.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-3.el6.x86_64
--> Processing Dependency: libgomp.so.1()(64bit) for package: gcc-4.4.7-3.el6.x86_64
---> Package make.x86_64 1:3.81-20.el6 will be installed
---> Package perl.x86_64 4:5.10.1-129.el6 will be installed
--> Processing Dependency: perl-libs = 4:5.10.1-129.el6 for package: 4:perl-5.10.1-129.el6.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-129.el6.x86_64
--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-129.el6.x86_64
--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-129.el6.x86_64
--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-129.el6.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-129.el6.x86_64
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-3.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: cpp-4.4.7-3.el6.x86_64
---> Package glibc-devel.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.107.el6 for package: glibc-devel-2.12-1.107.el6.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.107.el6.x86_64
---> Package libgomp.x86_64 0:4.4.7-3.el6 will be installed
---> Package perl-Module-Pluggable.x86_64 1:3.90-129.el6 will be installed
---> Package perl-Pod-Simple.x86_64 1:3.13-129.el6 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-129.el6.x86_64
---> Package perl-libs.x86_64 4:5.10.1-129.el6 will be installed
---> Package perl-version.x86_64 3:0.77-129.el6 will be installed
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.12-1.107.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.107.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.107.el6.x86_64
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
---> Package perl-Pod-Escapes.x86_64 1:1.04-129.el6 will be installed
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Running transaction check
---> Package kernel-headers.x86_64 0:2.6.32-358.2.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package                          Arch              Version                          Repository          Size
==============================================================================================================
Installing:
 gcc                              x86_64            4.4.7-3.el6                      base                10 M
 make                             x86_64            1:3.81-20.el6                    base               389 k
 perl                             x86_64            4:5.10.1-129.el6                 base                10 M
Installing for dependencies:
 cloog-ppl                        x86_64            0.15.7-1.2.el6                   base                93 k
 cpp                              x86_64            4.4.7-3.el6                      base               3.7 M
 glibc-devel                      x86_64            2.12-1.107.el6                   base               974 k
 glibc-headers                    x86_64            2.12-1.107.el6                   base               604 k
 kernel-headers                   x86_64            2.6.32-358.2.1.el6               updates            2.3 M
 libgomp                          x86_64            4.4.7-3.el6                      base               118 k
 mpfr                             x86_64            2.4.1-6.el6                      base               157 k
 perl-Module-Pluggable            x86_64            1:3.90-129.el6                   base                38 k
 perl-Pod-Escapes                 x86_64            1:1.04-129.el6                   base                31 k
 perl-Pod-Simple                  x86_64            1:3.13-129.el6                   base               210 k
 perl-libs                        x86_64            4:5.10.1-129.el6                 base               576 k
 perl-version                     x86_64            3:0.77-129.el6                   base                50 k
 ppl                              x86_64            0.10.2-11.el6                    base               1.3 M

Transaction Summary
==============================================================================================================
Install      16 Package(s)

Total download size: 31 M
Installed size: 75 M
Downloading Packages:
(1/16): cloog-ppl-0.15.7-1.2.el6.x86_64.rpm                                            |  93 kB     00:01
(2/16): cpp-4.4.7-3.el6.x86_64.rpm                                                     | 3.7 MB     00:36
(3/16): gcc-4.4.7-3.el6.x86_64.rpm                                                     |  10 MB     01:36
(4/16): glibc-devel-2.12-1.107.el6.x86_64.rpm                                          | 974 kB     00:08
(5/16): glibc-headers-2.12-1.107.el6.x86_64.rpm                                        | 604 kB     00:10
(6/16): kernel-headers-2.6.32-358.2.1.el6.x86_64.rpm                                   | 2.3 MB     00:23
(7/16): libgomp-4.4.7-3.el6.x86_64.rpm                                                 | 118 kB     00:00
(8/16): make-3.81-20.el6.x86_64.rpm                                                    | 389 kB     00:03
(9/16): mpfr-2.4.1-6.el6.x86_64.rpm                                                    | 157 kB     00:01
(10/16): perl-5.10.1-129.el6.x86_64.rpm                                                |  10 MB     01:40
(11/16): perl-Module-Pluggable-3.90-129.el6.x86_64.rpm                                 |  38 kB     00:00
(12/16): perl-Pod-Escapes-1.04-129.el6.x86_64.rpm                                      |  31 kB     00:00
(13/16): perl-Pod-Simple-3.13-129.el6.x86_64.rpm                                       | 210 kB     00:02
(14/16): perl-libs-5.10.1-129.el6.x86_64.rpm                                           | 576 kB     00:05
(15/16): perl-version-0.77-129.el6.x86_64.rpm                                          |  50 kB     00:00
(16/16): ppl-0.10.2-11.el6.x86_64.rpm                                                  | 1.3 MB     00:11
--------------------------------------------------------------------------------------------------------------
Total                                                                         103 kB/s |  31 MB     05:06
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:perl-Pod-Escapes-1.04-129.el6.x86_64                                                    1/16
  Installing : 4:perl-libs-5.10.1-129.el6.x86_64                                                         2/16
  Installing : 3:perl-version-0.77-129.el6.x86_64                                                        3/16
  Installing : 1:perl-Module-Pluggable-3.90-129.el6.x86_64                                               4/16
  Installing : 1:perl-Pod-Simple-3.13-129.el6.x86_64                                                     5/16
  Installing : 4:perl-5.10.1-129.el6.x86_64                                                              6/16
  Installing : ppl-0.10.2-11.el6.x86_64                                                                  7/16
  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                                                           8/16
  Installing : kernel-headers-2.6.32-358.2.1.el6.x86_64                                                  9/16
  Installing : glibc-headers-2.12-1.107.el6.x86_64                                                      10/16
  Installing : glibc-devel-2.12-1.107.el6.x86_64                                                        11/16
  Installing : libgomp-4.4.7-3.el6.x86_64                                                               12/16
  Installing : mpfr-2.4.1-6.el6.x86_64                                                                  13/16
  Installing : cpp-4.4.7-3.el6.x86_64                                                                   14/16
  Installing : gcc-4.4.7-3.el6.x86_64                                                                   15/16
  Installing : 1:make-3.81-20.el6.x86_64                                                                16/16
  Verifying  : glibc-devel-2.12-1.107.el6.x86_64                                                         1/16
  Verifying  : gcc-4.4.7-3.el6.x86_64                                                                    2/16
  Verifying  : 1:perl-Pod-Escapes-1.04-129.el6.x86_64                                                    3/16
  Verifying  : 1:perl-Pod-Simple-3.13-129.el6.x86_64                                                     4/16
  Verifying  : mpfr-2.4.1-6.el6.x86_64                                                                   5/16
  Verifying  : libgomp-4.4.7-3.el6.x86_64                                                                6/16
  Verifying  : 4:perl-5.10.1-129.el6.x86_64                                                              7/16
  Verifying  : 4:perl-libs-5.10.1-129.el6.x86_64                                                         8/16
  Verifying  : cpp-4.4.7-3.el6.x86_64                                                                    9/16
  Verifying  : 1:make-3.81-20.el6.x86_64                                                                10/16
  Verifying  : 3:perl-version-0.77-129.el6.x86_64                                                       11/16
  Verifying  : 1:perl-Module-Pluggable-3.90-129.el6.x86_64                                              12/16
  Verifying  : kernel-headers-2.6.32-358.2.1.el6.x86_64                                                 13/16
  Verifying  : ppl-0.10.2-11.el6.x86_64                                                                 14/16
  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                                                          15/16
  Verifying  : glibc-headers-2.12-1.107.el6.x86_64                                                      16/16

Installed:
  gcc.x86_64 0:4.4.7-3.el6          make.x86_64 1:3.81-20.el6          perl.x86_64 4:5.10.1-129.el6

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6                     cpp.x86_64 0:4.4.7-3.el6
  glibc-devel.x86_64 0:2.12-1.107.el6                   glibc-headers.x86_64 0:2.12-1.107.el6
  kernel-headers.x86_64 0:2.6.32-358.2.1.el6            libgomp.x86_64 0:4.4.7-3.el6
  mpfr.x86_64 0:2.4.1-6.el6                             perl-Module-Pluggable.x86_64 1:3.90-129.el6
  perl-Pod-Escapes.x86_64 1:1.04-129.el6                perl-Pod-Simple.x86_64 1:3.13-129.el6
  perl-libs.x86_64 4:5.10.1-129.el6                     perl-version.x86_64 3:0.77-129.el6
  ppl.x86_64 0:0.10.2-11.el6

Complete!
3. Reboot VM.
[root@centos64 ~]# reboot
4. Mount the installer.
[root@centos64 ~]# mount -t iso9660 /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
5. Copy the installer to /tmp :
[root@centos64 ~]# cd /mnt
[root@centos64 mnt]# cp VMwareTools-9.2.2-893683.tar.gz /tmp
6. Extract the installer :
[root@centos64 ~]# cd /tmp
[root@centos64 tmp]# tar xzvf VMwareTools-9.2.2-893683.tar.gz
7. Enter the vmware-tools-distrib directory :
[root@centos64 tmp]# cd vmware-tools-distrib/
8. Install the VMware Tools :
[root@centos64 vmware-tools-distrib]# ./vmware-install.pl

Installing PHP 5.4 on CentOS 6.2

The assumption for installing PHP 5.4 on CentOS 6.2 tutorial is that you are running as root and have a basic understanding of the software required but if you follow this tutorial you should be able to complete the task successfully.

Install Yum Priorities

For a brief overview on and how to configure Yum Priorities you can follow the instructions outlined in our Install YUM Priorities on CentOS tutorial.

# yum install yum-priorities

Installing PHP 5.4 on CentOS 6.2 x86_64

Install the EPEL x86_64 YUM Repository

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

Install the IUS x86_64 YUM Repository

# rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-10.ius.el6.noarch.rpm
# yum install php54 php54-common php54-devel
# php -v
PHP 5.4.5 (cli) (built: Jul 23 2012 10:10:54)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

Installing PHP 5.4 on CentOS 6.2 i386

Install the EPEL i386 YUM Repository

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm

Install the IUS i386 YUM Repository

# rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/i386/ius-release-1.0-10.ius.el6.noarch.rpm
# yum install php54 php54-common php54-devel
# php -v
PHP 5.4.5 (cli) (built: Jul 23 2012 10:10:54)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

Install yum priorities on CentOS

The Yum Priorities plugin can be used to enforce ordered protection of repositories, by associating priorities to repositories.
The priorities plugin is a useful tool if properly configured, and used with an understanding of the functionality and a recognition of the limitations and potential issues. It can be used in conjunction with the ‘exclude’ and/or ‘includepkg’ options, as well as the ‘enabled=0′ option to disable a repo by default. This can let you choose which packages a less important repo will supersede those of a more important one.

Install Yum Priorities

# yum install yum-priorities

Configure Yum Priorities

# vi /etc/yum/pluginconf.d/priorities.conf
Ensure the following lines exist
1
2
[main]
enabled=1
Save and close the file
Open the CentOS base repository configuration file
# vi /etc/yum.repos.d/CentOS-Base.repo
Add the following text to the end of the base, updates and extras entries
1
priority=1
Add the following line to the end of the centosplus, contrib entries
1
priority=2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
 
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=2
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=2

CentOS 6 NTP Server

It is important for systems administrators to make sure that mission-critical servers are always using the correct system time.
The ntpd (Network Time Protocol daemon) program is an operating system daemon which sets and maintains the system time of day in synchronism with Internet standard time servers. Make sure that the time zone configuration of your computer is correct. ntpd itself does not do anything about the time zones, it just uses UTC internally.

Install Network Time Protocol (NTP) daemon

# yum install ntp

Add NTP daemon to startup

# chkconfig ntpd on

Edit the NTPD config file

Here you can either use the default NTP public servers or add servers closer to your region.
Visit http://www.pool.ntp.org/en/ and either considder joining or getting your regional NTP pool servers
# vi /etc/ntp.conf
20
21
22
23
24
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org

Start the NTP daemon

# service ntpd start

Standard NTP query program (ntpq)

Print a list of the peers known to the server as well as a summary of their state.
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*javanese.kjsl.c 69.36.224.15 2 u 108 128 377 1.401 3.392 4.779
+66-191-139-149. 132.163.4.101 2 u 70 128 377 46.044 11.205 5.378
+ntp.sunflower.c 132.236.56.250 3 u 85 128 377 50.962 -2.129 14.112

Managing NTPd with Puppet

If you’re running Puppet we have included the manifest for installing Varnish on CentOS 6. If you’re not running Puppet then you can install it by following the instructions outlined in our CentOS 6 Puppet Install.
This is only the manifest and doesn’t include any of the files (i.e. ntp.conf).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class ntpd::install {
 
 $packagelist = ["ntp"]
 
 package { $packagelist:
  ensure => installed
 }
}
 
class ntpd::service {
 
 service { "ntpd":
  ensure => true,
  enable => true,
  hasrestart => true,
  hasstatus => true,
  require => Class ["ntpd::install"]
 }
}
 
class ntpd::conf {
 
 File {
  require => Class ["ntpd::install"],
  owner => "root",
  group => "root",
  mode => 644,
  notify => Class ["ntpd::service"]
 }
 
 file { "/etc/ntp.conf":
  source  => "puppet:///modules/ntpd/ntp.conf"
 }
}
 
class ntpd {
 include ntpd::install, ntpd::service, ntpd::conf
}

Install Varnish CentOS 6

This tutorial is intended for system administrators wanting to install Varnish on CentOS 6. The reader should know how to configure a web server or application server and have basic knowledge of the HTTP protocol. Once finished the reader should have a basic Varnish cache up and running with the default configuration.
Varnish is a web application accelerator. You install it in front of your web application and it will speed it up significantly.
Varnish web application accelerator homepage: https://www.varnish-cache.org

Install the Varnish YUM Repository

# rpm -Uvh http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm

Install Varnish web accelerator

# yum install varnish

Enable Varnish web accelerator at startup

# chkconfig varnish on

Basic default.vcl

# vi /etc/varnish/default.vcl
1
2
3
4
5
6
7
8
9
10
# This is a basic VCL configuration file for varnish.  See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition.  Set this to point to your content
# server.
#
backend default {
  .host = "127.0.0.1";
  .port = "80";
}

Start Varnish web accelerator

# service varnish start
You will now have a basic Varnish web accelerator running on port 8080

Top 5 Varnish commands

varnishstat
Provides all the info you need to spot cache misses and errors.
varnishhist
Provides a histogram view of cache hits/misses
varnishlog
Provides detailed information on requests.
varnishtop
The varnishtop utility reads varnishd shared memory logs and presents a continuously updated list of the most commonly occurring log entries.
varnishadm
Command-line varnish administration used to reload vcl and purge urls.

Managing Varnish with Puppet

If you’re running Puppet we have included the manifest for installing Varnish on CentOS 6. If you’re not running Puppet then you can install it by following the instructions outlined in our CentOS 6 Puppet Install.
This is only the manifest and doesn’t include any of the files (i.e. default.vcl).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class varnish::repo {
 
 Package {
  provider => rpm,
  ensure => installed
 }
 
 package { "varnish-release": source => "http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm"
 }
}
 
class varnish::install {
 
 $packagelist = ["varnish"]
 
 package { $packagelist:
  require => Class ["varnish::repo"],
  ensure => installed
 }
}
 
class varnish::service {
 
 service { "varnish":
  ensure => true,
  enable => true,
  hasrestart => true,
  hasstatus => true,
  require => Class ["varnish::install"]
 }
}
 
class varnish::conf {
 
 File {
  require => Class ["varnish::install"],
  owner => "root",
  group => "root",
  mode => 644,
  notify => Class ["varnish::service"]
 }
 
 file { "/etc/varnish/default.vcl":
  source  => "puppet:///modules/varnish/default.vcl"
 }
 
 file { "/etc/sysconfig/varnish":
  source  => "puppet:///modules/varnish/varnish"
 }
}
 
class varnish {
 include varnish::repo, varnish::install, varnish::service, varnish::conf
}

Disable SELinux CentOS 6

You need to be aware that by disabling SELinux you will be removing a security mechanism on your CentOS system. Think about this carefully, and if your system is on the Internet and accessed by the public, then think about it some more.
Applications should be fixed to work with SELinux, rather than disabling the OS security mechanism.
You could even switch to Permissive mode where every operation is allowed. Operations that would be denied are allowed and a message is logged identifying that it would be denied.
If you really need to disable SELinux on CentOS 6 please consider the following:
SELinux Warning
# vi /etc/selinux/config
Change SELINUX=enforcing
1
2
3
4
5
6
7
8
9
10
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
to SELINUX=disabled
1
2
3
4
5
6
7
8
9
10
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
This will disable SELinux on your next reboot.