Skip to content

Latest commit

 

History

History
141 lines (96 loc) · 3.85 KB

2.0-ConfiguringCentOS.md

File metadata and controls

141 lines (96 loc) · 3.85 KB

Configuring CentOS

This manual explains how to do initial setup of CentOS. It is

Using yum

Adding a -y option with yum keeps you from having to say "yes" to each install

Do "yum list installed" to list all installed packages

Setup networking

Setup your eth0 networking adapter. Change directory (cd) into your network-scripts directory:

cd /etc/sysconfig/network-scripts

Then edit your ifcfg-eth0 file:

vi ifcfg-eth0

And make it look like this:

DEVICE=eth0
HWADDR=<DEPENDENT ON YOUR SYSTEM>
TYPE=Ethernet
UUID=<DEPENDENT ON YOUR SYSTEM>
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp

Then check your eth1 (the "cat" command will display the contents of your eth1 file)

cat ifcfg-eth1

This should return "No such file or directory". We'll need to add it, but first run:

ifconfig eth1

The text that prints should include a first line including something like:

HWaddr 12:34:56:78:90:AB

Copy this address somewhere for later. Copy the one from your computer, not what is written above.

vi ifcfg-eth1

Edit the file so it looks like what you have below, pasting in the hardware address you copied when you ran "ifconfig eth1" above.

DEVICE=eth1
HWADDR=<PASTE YOUR HWADDR HERE>
IPADDR=192.168.56.56
NETMASK=255.255.255.0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static

Restart networking

Restart your networking service to make all your changes take effect:

service network restart

Note: The first time I ran the above restart command, and attempted to ping google.com afterwards, the ping failed. I had hit "p" prematurely, when the restart was still running. I'm not sure if that was why. I re-ran "service network restart" and then the ping was successful.

Create a snapshot

Update yum

To make sure eveything is up-to-date, run yum update:

yum -y update

Note: this takes a little while.

Setup SSH

To allow your VirtualBox client OS, CentOS, handle incoming SSH, run the following command:

yum -y install openssh-server openssh-clients
chkconfig sshd on
service sshd start

Port forwarding may need to be setup in your VirtualBox settings for ssh to work. This was not required on my computer, but other tutorials have said it may be necessary. See Setting up VirtualBox for instructions.

SSH into your virtual machine

Using putty if you're on windows. SSH into 192.168.56.56 using your "root" user and password. If this works, then...Create a snapshot.

Configure iptables

In order to access your VM from your host via HTTP, you'll need to open port 80. This requires you to edit "iptables".

Allow HTTP (port 80) on eth1 (the host-only adapter)

iptables -I INPUT 5 -i eth1 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

Save the changes to iptables so it survives reboot

service iptables save

This works for in this initial setup, but in the future we should consider a method to define entire iptables config.

Install EPEL

Some research needs to be done to determine if this is really necessary. Some tutorials suggested it, and I don't see any reason not to install it.

@todo: What is contained in EPEL? What benefit does it bring? @todo: Is this required?

The following instructions came from this tutorial:

  1. Install EPEL
  • FOR 64-bit: yum -y install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  • FOR 32-bit: yum -y install http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
  1. Import GPG Key rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

To verify a successful installation: yum repolist

To install a package with EPEL: yum --enablerepo=epel install PACKAGE_NAME