Tags:
create new tag
, view all tags

Download & How To: VMware Virtual Machine With CentOS 6.4 64-bit Minimal and Apache Webserver

2013-10-28 - 02:17:42 by PeterThoeny in Deployment
Download CentOS-6.4 64-bit minimal httpd
download

Download CentOS-6.4-64-bit-min-httpd.vmwarevm.zip

Contains:

  • VMware virtual machine with guest operating system CentOS-6.4 64-bit minimal, plus:
  • System libraries: gcc, kernel-devel, make, patch, vim-enhanced, httpd, openssh-clients, mod_ssl, wget, ntp, crontabs, perl, rcs, tcpdump, time, zip, unzip, gd
  • Perl libraries: perl-CGI, perl-CGI-Session, perl-HTML-Parser, perl-Archive-Tar, perl-Authen-SASL, perl-GD, perl-libwww-perl

CentOS (Community Enterprise Operating System) is a very popular Linux distribution based on RedHat Enterprise Linux. The default CentOS distribution is too bloated for webserver use. This article describes how to build and use a VMware virtual machine containing a minimal CentOS-6.4 64-bit guest operating system, enhanced with libraries typically needed in a server environment. The VMware virtual machine image can be downloaded as well, which enables you to quickly and easily run Linux on Windows, Mac OS-X or any other x86 based platforms VMware and VirtualBox (Oracle VM) supports.

The TWiki project releases TWiki also as a VMware virtual machine (VM). Previous TWiki releases contained CentOS-5. The latest TWiki-VM-6.0.0-1 uses CentOS-6. There are CentOS-6 VMware images readily available for download, but they have a lot of bloat that is not needed in a server environment. There is a minimal distribution of CentOS-6 that has no GUI, it boots directly into a shell console. There was no VMware image with CentOS-6 minimal available for download, so we had to build one from scratch. We added the Apache webserver, cron, Perl and other libraries typically needed in a server environment. The result is a CentOS-6.4 64-bit distribution, packaged as a VMware image that can be readily used to run dynamic websites and other server applications.

Ho to use CentOS-6.4-64-bit-min-httpd:

A leading open source enterprise wiki and web application platform used by 50,000 small businesses, many Fortune 500 companies, and millions of people.

MOVED TO... Learn more...

  • Add the VM image to VMware:
    • If you have a VMware ESX product you need to convert the VM image to the ESX format using the vmkfstools tool. Consult the VMware vmkfstools documentation
    • In the Virtual Machine Library of VMware, open the .vmx file located in the CentOS-6.4-64-bit-min-httpd.vmwarevm folder
    • Boot the CentOS-6.4-64-bit-min-httpd image
  • Change the root password:
    • In the CentOS-6.4-64-bit-min-httpd.vmwarevm console screen, login as root with password changeme
    • At the prompt, type passwd and enter a new (strong) password twice:
      # passwd
      Changing password for user root.
      New UNIX password:
      Retype new UNIX password:
  • Set networking:
    • The VM is configured for DHCP. This is OK for home use and for testing. In a production environment it should be changed to a static IP address.
    • Network configuration for DHCP: Login as root, edit /etc/sysconfig/network-scripts/ifcfg-eth0 and set its content to the following:
      DEVICE=eth0
      ONBOOT=yes
      BOOTPROTO=dhcp
    • Network configuration for static IP address: Login as root, edit /etc/sysconfig/network-scripts/ifcfg-eth0 and set its content to the following: (tweak the IP address, net mask and gateway as needed)
      DEVICE=eth0
      ONBOOT=yes
      BOOTPROTO=none
      TYPE=Ethernet
      USERCTL=no
      IPV6INIT=no
      PEERDNS=yes
      IPADDR=10.1.10.129
      NETMASK=255.255.255.0
      GATEWAY=10.1.10.1
    • Restart the network after each configuration change: Login as root and enter this command:
      # /etc/init.d/network restart 2
      • If you get this error:
        Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.
        you have a MAC address mismatch. This can happen when you "copy" (vs. "move") a virtual machine the first time you start it. On copy, VMware assigns a new MAC address to the network interfaces, but may fail to update the Linux configuration files to mirror these changes, resulting in a dead eth0 network interface.
      • Fix:
        • Edit /etc/udev/rules.d/70-persistent-net.rules, delete the first SUBSYSTEM setting containing NAME="eth0", and change the NAME in the second SUBSYSTEM setting from "eth1" to NAME="eth0". Example:
          SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:56:26:13", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
        • Edit /etc/sysconfig/networking/devices/ifcfg-eth0, remove also the UUID setting, and set the HWADDR setting to the new MAC address. Example:
          HWADDR=00:0C:29:56:26:13
        • Reboot the machine:
          # reboot
    • Confirm (or find out) the IP address of the VM: Login as root and enter the ifconfig command. In this sample output, look for the inet addr in the second line (in eth0 section) :
      eth0 Link encap:Ethernet HWaddr 00:0C:29:89:8C:47
      inet addr:192.168.1.79 Bcast:192.168.1.255 Mask:255.255.255.0
      inet6 addr: fe80::20c:29ff:fe89:8c47/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
      ...
  • Update CentOS and libraries with latest patches:
    • # yum update
  • Configure the Domain Name System (DNS):
    • Ask your IT to to add a DNS entry for your new server, such as twiki.example.com pointing to the IP address of the VM.

Step by step guide to build a CentOS-6.4 64-bit minimal VM with httpd and other libraries:

You can ignore this section if you simply want to use the CentOS virtual machine image. We used VMware Fusion 6.0 on Mac to build this virtual machine - the guide should also work for other VMware products.

  • Starting at http://wiki.centos.org/Download, download CentOS-6.4-x86_64-minimal.iso CD image from a mirror site
    • The CentOS-6.4-x86_64-minimal is a bare bone minimal CentOS without GUI.
  • Create a CD from the .iso image - the image is just 360 MB so it fits easily on a CD.
    • Note: Don't burn this as a single file to a CD, the .iso is the CD image. If burned properly you will see many files and directories in the CD.
  • Create a new VMware image with CentOS:
    • Open up the Virtual Machine Library of VMware
    • Select menu: File => New... => More options... => Create custom virtual machine
    • Select Linux OS => CentOS 64 bit
    • Create a new virtual disk
    • Name: CentOS-6.4-64-bit-min-httpd.vmwarevm
    • Set root password: changeme (ignore the weak password warning)
    • Once the image is created, boot CentOS-6.4-64-bit-min-httpd from the Virtual Machine Library
  • Configure networking for DHCP and set host name:
    • On the console, login as root with password changeme.
    • # vi /etc/sysconfig/network-scripts/ifcfg-eth0 :
      DEVICE=eth0
      TYPE=Ethernet
      HWADDR=xx:xx:xx:xx:xx:xx (leave default)
      BOOTPROTO=dhcp
      NM_CONTROLLED=no
      ONBOOT=yes
    • # vi /etc/sysconfig/network :
      NETWORKING=yes
      NETWORKING_IPV6=no
      HOSTNAME=twiki
    • # reboot
    • # ping google.com # to verify proper networking
  • Update OS:
    • # yum update
    • # reboot
  • Install VMware tools:
    • In the Virtual Machine Library, select menu: Virtual Machine => Install VMware tools
  • Install libraries:
    • # yum install gcc kernel-devel perl make openssh-clients httpd mod_ssl wget ntp crontabs vim-enhanced rcs tcpdump time patch zip unzip gd
  • Configure httpd and crond to start on reboot:
    • # chkconfig httpd on
    • # chkconfig crond on
    • # chkconfig --list|egrep 'http|cron' should return:
      crond       0:off  1:off  2:on  3:on  4:on  5:on  6:off
      httpd       0:off  1:off  2:on  3:on  4:on  5:on  6:off
  • Disable Selinux:
    • # vi /etc/selinux/config :
      SELINUX=disabled
  • Configure firewall to allow http:
    • # vi /etc/sysconfig/iptables :
      before COMMIT add this:
      -I RH-Firewall-1-INPUT -p tcp --dport 80 -j ACCEPT
  • Restart network:
    # /etc/init.d/network restart 2
  • Install Perl libraries:
    # yum install perl-CGI perl-CGI-Session perl-HTML-Parser perl-Archive-Tar perl-Authen-SASL perl-GD perl-libwww-perl
  • Power down VM:
    # shutdown -h 0
  • Open a terminal and change to the directory where VMware keeps the virtual machines.
  • Delete vmware*.log files in the CentOS-6.4-64-bit-min-httpd.vmwarevm directory.
  • Delete the caches directory in the CentOS-6.4-64-bit-min-httpd.vmwarevm directory if present.
  • Zip up the CentOS-6.4-64-bit-min-httpd.vmwarevm directory as CentOS-6.4-64-bit-min-httpd.vmwarevm.zip

Congratulations, you just built a minimal CentOS-6.4 with apache & cron installed, ready for server use!

We used this image as a base for the TWiki-VM-6.0.0-1 virtual machine. How about downloading the TWiki VM and using it as a collaboration platform for your team?

Let us know in the comments below how you built your virtual machine, and for what purposes.

Download CentOS-6.4 64-bit minimal httpd
download

Download CentOS-6.4-64-bit-min-httpd.vmwarevm.zip

Contains:

  • VMware virtual machine with guest operating system CentOS-6.4 64-bit minimal, plus:
  • System libraries: gcc, kernel-devel, make, patch, vim-enhanced, httpd, openssh-clients, mod_ssl, wget, ntp, crontabs, perl, rcs, tcpdump, time, zip, unzip, gd
  • Perl libraries: perl-CGI, perl-CGI-Session, perl-HTML-Parser, perl-Archive-Tar, perl-Authen-SASL, perl-GD, perl-libwww-perl

Peter Thoeny - founder of TWiki.org

Comments

.

Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2014-10-07 - PeterThoeny
 

Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Help
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.