Web Server Documentation
Installing Ubuntu aka Trying RAID 10 (2/15/2016)
Some general configuration options:
- hostname: McNairWebServ
- user full name: McNair Center
- username: mcnair
- don't encrypt home directory
- manual partitioning (see below for configuration of RAID)
- no automatic updates
- software: LAMP stack
Sahil and I tried to configure RAID 10 using the software RAID option in the installer, which is documented here. We put two 64 GB swap space partitions on the first two hard drives, and created two ext4 partitions that took up the rest of the space on those two drives. For the other two drives, we used a single ext4 partition for each drive. For all of the ext4 partitions, we set the bootable flag to "on." Then we chose to configure the software RAID, created a new MD device, and chose RAID10 with 2 active devices and 2 spare devices. For the active devices, we chose the two ext4 partitions on the first two hard drives, and for the spare devices, we chose the two ext4 partitions on the other two hard drives. But then the installation process fails when the GRUB boot loader can't be installed, because the GUID partition tables (GPT) need a designated, small (1 MB is enough) partition for the GRUB bootloader.
So we started partitioning from scratch, but with only two hard drives for a RAID1 array. In the first drive, there are three partitions: one 1 MB partition reserved for the bootloader, one 64 GB swap partition, and the rest of the drive as an ext4 partition for the filesystem. In the second drive, there are two partitions: one 1 MB partition reserved for the bootloader and the rest of the drive as an ext4 partition for the filesystem. Then we made two software RAID devices, both with one with 2 active devices and 0 spare devices. The first RAID device had both of the bootloader partitions as the active devices, and the second RAID device had both of the ext4 filesystem partitions as the active devices. Then we set the first RAID device to "use as ext4" and the mount as "/boot" and the second RAID device as "use as ext4" and the mount as "/" and then continued with the installation. This time, it failed to install the kernel.
I guessed that, because the 1 MB RAID device was made first, that the kernel tried to install itself to that device and failed. So I went back to the partitioner and set the first RAID device to "do not use" and then tried the installation process again. It prompted me a couple of times warning me that the old filesystem would be overwritten, but I continued the installation regardless. But then the GRUB boot loader failed, even if we tried not installing it to the master boot record (MBR) and installing it to "dev/md0" or installing it to "dev/md0_raid1"
Configuring RAID 1 on Web Server (2/17/2016)
The first RAID device (/dev/md0) we set to use as an ext4 filesystem and mounted /boot to it, and the second RAID device (/dev/md127) we set to use as an ext4 filesystem and mounted / to it (we tried this before, but it failed to install the kernel). This time, it failed to install the bootloader, but it never prompted me to choose where to install the bootloader (usually it asks whether you'd like to install the bootloader to the master boot record).
Second partitioning attempt:
First hard disk (/dev/sda):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- 64 GB partition, use as swap space
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
Second hard disk (/dev/sdb):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
Write partition changes to disk and then start configuring software RAID:
- First RAID device (/dev/md0): RAID1, 2 active devices (/dev/sda3 and /dev/sdb2), 0 spare devices
- Second RAID device (/dev/md1): RAID1, 2 active devices (/dev/sda1 and /dev/sdb1), 0 spare devices
- first RAID device partition: use as ext4 filesystem, mount point /
- second RAID device partition: use as ext4 filesystem, mount point /boot, format data on the partition
Failed to install GRUB bootloader on a hard disk (again).
Next attempt: First RAID device (/dev/md0): use as ext4 filesystem, mount point /, format data on the partition Second RAID device (/dev/md1): erase data on partition, use as "do not use"
Next attempt: Redo the RAID devices so that the first device (/dev/md0): RAID1, 2 active devices (/dev/sda1 and /dev/sdb1), 0 spare devices, and the second RAID device (/dev/md1): RAID1, 2 active devices (/dev/sda3 and /dev/sdb2), 0 spare devices. Then configure the RAID devices:
- first RAID device partition: use as ext4 filesystem, mount point /boot, format data on the partition
- second RAID device partition: use as ext4 filesystem, mount point /, format data on the partition
New idea: ditch the idea of RAID on the boot partitions (we'll put the bootloader on one of the boot partitions and then we can try to set up RAID once we've got the thing booting into Linux), so leave the partitions as above ("Second Partitioning Attempt"). Only make one software RAID device (/dev/md0): RAID1, 2 active devices (/dev/sda3 and /dev/sdb2), 0 spare devices. Then configure the first RAID device partition: use as ext4 filesystem, mount point /, format data on the partition.
Third partitioning attempt:
First hard disk (/dev/sda):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- 32 GB partition, use as swap space
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
Second hard disk (/dev/sdb):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- 32 GB partition, use as swap space
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
One RAID device (/dev/md0): RAID1, 2 active devices (/dev/sda3 and /dev/sdb3), 0 spare devices. set partition: use as ext4 filesystem, mount point /
Fourth partitioning attempt:
First hard disk (/dev/sda):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- 32 GB partition, use as swap space
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
Second hard disk (/dev/sdb):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- 32 GB partition, use as swap space
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
First RAID device (/dev/md0): RAID1, 2 active devices (/dev/sda3 and /dev/sdb3), 0 spare devices. set partition: use as ext4 filesystem, mount point /
Second RAID device (/dev/md1): RAID1, 2 active devices (/dev/sda1 and /dev/sdb1), 0 spare devices. set partition: use as ext4 filesystem, mount point /boot
Third RAID device (/dev/md2): RAID0, 2 active devices (/dev/sda2 and /dev/sdb2). set partition: use as swap area
Fifth partitioning attempt (made sure all software RAID devices are removed, delete all partitions, create new partition tables):
First hard disk (/dev/sda):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- 32 GB partition, use as swap space
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
Second hard disk (/dev/sdb):
- 10 MB partition, use as reserved BIOS boot area, bootable flag off
- 32 GB partition, use as swap space
- rest of the space partition, use as ext4 filesystem, mount point /, bootable flag off
First RAID device (/dev/md0): RAID1, 2 active devices (/dev/sda3 and /dev/sdb3), 0 spare devices. set partition: use as ext4 filesystem, mount point /
install GRUB bootloader to /dev/sda and /dev/sdb. It works!
Network Configuration (2/22/2016)
As with the test web server, network configuration can be annoying. First, I had to figure out the right LAN port on the mobo by plugging the RJ45 cable in and waiting for the LED to light up (it took about 5 seconds and a couple of tries). Then I went to the terminal to check on the network interfaces:
$ ifconfig $ ifconfig -a $ sudo ifconfig eth0 up $ cat /etc/network/interfaces
After bringing up the eth0 interface (it's down if it's not listed in the output of ifconfig), I then modified /etc/network/interfaces to set up the eth0 interface:
$ sudo vi /etc/network/interfaces
And added these lines:
auto eth0 iface eth0 inet dhcp dns-nameservers 8.8.8.8 8.8.4.4
Then I used ifdown/ifup to reconfigure the interface:
$ sudo ifdown eth0 $ sudo ifup eth0
There's a couple of configuration files that you can check to make sure that the network configured correctly (I compared them to the corresponding files in the test web server):
$ hostname -I $ cat /etc/resolv.conf $ cat /etc/hosts $ cat /var/lib/dhcp/dhclient.eth0.leases
Then I checked if it was connected to the internet:
$ ping google.com $ sudo apt-get update
I got a "GPG error: http://security.ubuntu.com trusty-security InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)" message on the apt-get update a couple of times, so I tried sudo ifdown eth0 and sudo ifup eth0 a couple of times. Then I rebooted the machine and tried to update the package manager again, and it still didn't work.
These results seem familiar; I think I had the same error when I tried to connect the test web server to the internet before Ed filed the ticket with the IT help desk, which suggests that we may have given the wrong MAC address or IT messed up the configuration. Still, I checked all of the configuration files. I only noted a couple of differences between the test web server network interface and this web server network interface:
- The IP addresses are different. The test web server has an address that starts with 128, but this webserver has an address that starts with 10. (Ed thinks this is a sign that this webserver's IP address limits it to the Rice network).
- The subnet masks are different. The test web server has a subnet mask that ends in 240, but this webserver has a mask that ends in 0.
- The test webserver has a DNS domain name (i.e. the output of hostname -d) of attlocal.net. This webserver doesn't have one. I tried adding it (by editing /etc/hosts), but that change alone didn't help.
Interesting side note: going into the mobo BIOS menu, under "Server Mgmt" there is a submenu "BMC network configuration" that shows the MAC address for "DM_LAN1" as ending in de, whereas the MAC address for eth0 ends in dc (otherwise, the two MAC addresses are the same). So maybe the mobo is interfering with the MAC address? But changing DM_LAN1's Config Address source from "Previous State" to "DynamicBmcDhcp" doesn't fix the problem (and upon reboot, it switches back to Previous State).
Turns out IT just configured the network IP addresses incorrectly. Ed and I talked to the IT desk on Tuesday and we got new IP addresses.
Installing Software (2/24/2016)
Now that we have internet connection, we can start getting packages:
$ sudo apt-get update $ sudo apt-get upgrade
Since I didn't install the SSH server in the beginning, I'll go ahead and install the openssh-server package now:
$ sudo apt-get install openssh-server
Backup the SSH server config file:
$ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original