I'm the sort of person who likes to make things work without having to read a few text books. So, when I needed to run my own web server I feared the setup of a name server. I first searched Google for "setup dns on linux" or "dns setup ubuntu" but by the time I just about had it working I was searching for "bind9 linux". It was tough but it's working, I don't entirely know why but here's how a total noob pulled it off:
Environment:
Ubuntu 11, Apache 2, Bind 9
Building IP: 12.0.0.1
System IP: 192.168.0.2
Domain name: example.com (at godaddy.com)
The steps which succeeded:
1. Install apache (sudo apt-get install apache2)
2. Install bind9 (sudo apt-get install bind9)
3. Open an account at buddyns.com (domain = example.com // server = 12.0.0.1)
4. Register your name server at godaddy.com under "Add host summary", add ns1.example.com.
5. Edit your name servers at godaddy.com for example.com (ns1.example.com, b.ns.buddyns.com, c.ns.buddyns.com)
6. Edit resolv.conf (sudo gedit /etc/resolv.conf) to look like:
nameserver 127.0.0.1
nameserver b.ns.buddyns.com
nameserver c.ns.buddyns.com
7. Edit zones (sudo gedit /etc/bind/named.conf.local) to look like:
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
zone "ns1.example.com" {
type master;
file "/etc/bind/db.example.com";
};
8. Edit zone file (sudo gedit /etc/bind/db.example.com) to look like:
$TTL 604800
@ IN SOA ns1.example.com. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.example.com.
@ IN A 67.185.67.129
ns IN A 67.185.67.129
$TTL 604800
@ IN SOA example.com. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS example.com.
@ IN A 67.185.67.129
ns IN A 67.185.67.129
9. Edit bind options (sudo gedit /etc/bind/named.conf.options) to look like:
options {
directory "/var/cache/bind";
forwarders {
173.244.206.26; //buddyns
82.130.104.115; //buddyns
};
allow-transfer {
173.244.206.26; //buddyns
74.117.59.111; //buddyns
};
recursion yes;
allow-recursion { 127.0.0.1; };
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
10. Edit apache virtual hosts (sudo gedit /etc/apache2/httpd.conf) to look like:
NameVirtualHost *
<VirtualHost *>
ServerName example.com
DocumentRoot /var/www/example.com
</VirtualHost>
<VirtualHost *>
ServerName www.example.com
DocumentRoot /var/www/example.com
</VirtualHost>
<VirtualHost *>
ServerName ns1.example.com
DocumentRoot /var/www/example.com
</VirtualHost>
11. Restart apache (sudo /etc/init.d/apache2 restart)
12. Restart bind9 (sudo /etc/init.d/bind9 restart)
13. Try it out.
I hope that's right. I did so many things to get this to work that I likely forgot something but I think these attributes will at least help get you going in the right direction. Enjoy.
Computer Tauntations
Saturday, July 9, 2011
Monday, March 21, 2011
Virtualize a Physical Linux Hard Drive
I'm going to summarize the steps it took minus the steps it didn't take to transition a linux HDD to a VHD.
If you don't want to read my jabber then skip to the summary at the bottom.
If you don't want to read my jabber then skip to the summary at the bottom.
When I set out to do this I really thought it was a common practice and expected a blog such as this to guide me through. Alas, there were none which lead to success. I do thank the people who posted help in forums and other online media because without your incomplete assistance I may not have been able to weave this together. :)
What you need:
A computer with linux (the computer you want to copy)
A bootable Ubuntu CD or other linux live CD [http://www.ubuntu.com/]
A USB NTFS Hard drive large enough to hold the linux image
What you need:
A computer with linux (the computer you want to copy)
A bootable Ubuntu CD or other linux live CD [http://www.ubuntu.com/]
A USB NTFS Hard drive large enough to hold the linux image
Step 1 (create a raw image)
Put the live CD in the computer to copy. Boot the computer to the CD.
Open a terminal/bash console.
Open a terminal/bash console.
Type this:
sudo fdisk -l
Make note of the drive locations. Now we need to perform the copy.
Type this:
sudo dd if=/dev/sda of=/media/3AA0A960077BE663/disc.raw
Note: Replace hda above with the drive you want to copy and replace media/sda1 with the path to a USB drive or some other drive to copy to. If you are moving this image to windows, this will need to be a NTFS drive. Fat32 has a file limit of 4GB.
The above will take a while to copy. A few minutes to an hour or so, depending on the size of the disk. Once complete you'll have a file in the zip of the raw drive image.
Step 2 (convert the raw image to a virtual image)
Extract the GZ file. Rename the extracted file to disc.raw.
Type this:
qemu-img convert /media/3AA0A960077BE663/disc.raw -O vmdk /media/3AA0A960077BE663/disc.vmdk
Note: 'convert -o vmdk' tells qemu to convert the raw file to an output of vmdk. Change the path to your disc.raw file and change the path to your desired output location. This conversion will take a few minutes to an hour or so. If you have problems, you may need to update qemu. Run: sudo apt-get install qemu-kvm
Step 3 (import the vmdk)
You're all set. Now open VMWare and import the vmdk file. You can also use a different virtual machine program such as virtual box.
Summary:
(notate drive to image and to where)
sudo fdisk -l
(create raw image)
sudo dd if=/dev/sda of=/media/3AA0A960077BE663/disc.raw
(install qemu)
sudo apt-get install qemu-kvm
(convert raw image to vhd)
qemu-img convert /media/3AA0A960077BE663/disc.raw -O vmdk /media/3AA0A960077BE663/disc.vmdk
END
Type this:
qemu-img convert /media/3AA0A960077BE663/disc.raw -O vmdk /media/3AA0A960077BE663/disc.vmdk
Note: 'convert -o vmdk' tells qemu to convert the raw file to an output of vmdk. Change the path to your disc.raw file and change the path to your desired output location. This conversion will take a few minutes to an hour or so. If you have problems, you may need to update qemu. Run: sudo apt-get install qemu-kvm
Step 3 (import the vmdk)
You're all set. Now open VMWare and import the vmdk file. You can also use a different virtual machine program such as virtual box.
Summary:
(notate drive to image and to where)
sudo fdisk -l
(create raw image)
sudo dd if=/dev/sda of=/media/3AA0A960077BE663/disc.raw
(install qemu)
sudo apt-get install qemu-kvm
(convert raw image to vhd)
qemu-img convert /media/3AA0A960077BE663/disc.raw -O vmdk /media/3AA0A960077BE663/disc.vmdk
END
Subscribe to:
Comments (Atom)