LINUX ADMINISTRATION – CLASS 1
ESXI 5.5
o Can use for 60 days without limitations
Hypervisor
o Running VMs remotely
Iptables
Quiz on Wednesday, Friday (i.e. every other day)
STEPS:
o ISO must be uploaded to Hypervisor using vSphere client
Datastore
o One or more hard drives where VMs are stored
Thick provision:
o Will allocate 16 GB on your hard drive right now – WE DON’T WANT THIS!!
Thin provision:
o Allocates when needed
o THIS IS WHAT WE WANT
Installing with LVM
o Will be possible to resize disks afterwards
Select Guided – use entire disk and set up LVM
Configure
Select: No automatic updates
Install:
o OpenSSH
Install GRUB boot loader to the MBR? YES
1
o Open SSH
o Stands for “Secure Shell”
o You should NEVER use Telnet
o RSH
o Remote shell
o Not used anymore
o Remote login
o Not used anymore
o We usually use SSH nowadays
o ifconfig
o Put IP address in “host name” in PutTy
2
o sudo su –
o apt-get install apache2
o This installs Apache
o Type IP address in your browser – will display a page if Apache works
o Tells you that you’ve just installed a web server in Linux
o Apache = most popular web server in the world
3
o 3 types of virtual web hosts (these are web hosts – one physical machine serving multiple
websites):
o Assign separate IP address for every website
We don’t use this method anymore
We’re out of IPv4 addresses
o Different port numbers – one IP for all
Don’t really use this one much either
o Name-based in HTTP 1.1
Requires HTTP protocol 1.1
HTTP protocol 1.0 – told you “get me the index.html”
In HTTP 1.1 – client connect to web server – “I’d like to get index.html from
____ website”
Almost all servers in the world use this method
HTTP 1.1 brought 2 important features:
Name-based virtual hosting
o This was not possible in previous versions of HTTP (ex. 1.0)
When downloading a file, can specify which byte you’d like to start off
with – resume download from the place you’ve left off
Better caching support
o Command to show all files brought onto the system by apache2:
o dpkg –L apache2 | less
o Command to show all files brought onto the system by apache2, and containing “/etc”
o dpkg –L apache2 | grep /etc
o cd /etc/apache2
o ll
4
o apt-get install vim-gtk
o vi apache2.conf
o Configuration directives of Apache:
o Apache, by default, only reads the apache2.conf file
o Tells it to go inside sites-enabled file and find all files with .conf extension??
o esc + : + q + !
o ll sites-*
o You can see this one contains a symbolic link
Can remove symbolic link without removing target file
o One file per domain that you’re hosting
o Apache is told to read “sites-enabled”, not “sites-available”
o To create new configuration piece, you will create it in “sites available”, and once you’re
ready, you’ll create a symbolic link
5
o cd sites-available
o ll
If no other virtual hosts apply, then the 000-default.conf will apply
o vi 000-default.conf
CREATING A VIRTUAL HOST
o We’re going to use a pretend DNS, that works only on the local machine
o Client will be Windows
In Windows:
o Searching for “Windows hosts file editor” – download & install it
o Open Hosts File Editor
o Type in your IP address in Hosts File Editor, and put Host Name as “Dawson.com
www.dawson.com”
6
o Check by going into C: → Windows → System32 → drivers → etc → hosts . Open hosts file in
Notepad, and make sure it looks like this:
o Now go into web browser, and type in “dawson.com” or “www.dawson.com”. You should be
redirected to your Apache page:
o If you’re asking for index.html, it will look for it in /var/www/html
In server:
o mkdir /var/www/dawson.com
o echo “This is Dawson” > /var/www/dawson.com/index.html
7
o cp 000-default.conf 111-dawson.conf
o vi 111-dawson.conf
o Look for line above “ServerAdmin” called “ServerName”. Remove the hash (#) symbol in front of
ServerName. Then change the URL to “www.dawson.com”. This is what it will look like after all
the changes:
o Add the line under “ServerName” that says the following: “ServerAlias dawson.com”
8
o Change the path beside DocumentRoot to /var/www/dawson.com
o Save it by pressing: ESC + SHIFT + Z + Z
o a2 + TAB + TAB
o a2ensite 111-dawson.conf
o ll ../sites-enabled
o service apache2 reload
o reloading = re-read configuration
9
Advantage: If there is a problem, then Apache will still work with old
configuration
We use this command whenever possible, and restart only when we absolutely
need to
o restart = shuts down Apache, then turns it on again
Configuring static IP configuration
o cd /etc/network
o vi interfaces
o Put hash (#) sign next to the “iface…” line
o ifconfig eth0
o You will find IP Address and Mask
o route –n
o You will find Gateway
o cat /etc/resolv.conf
o You will find NameServer
o Copy the IP address, Gateway, Mask, and NameServer into Notepad in Windows
o cd /etc/network
o vi interfaces
o Type “iface eth0 inet static” line in vi, and add all 4 IP settings:
10
o ESC + SHIFT + Z + Z
o ifdown eth0 ; sleep 3 ; ifup eth0
11