Build a new server

From Wikitech
(Difference between revisions)
Jump to: navigation, search
m (linux-host-entries.ttyS1-115200)
(PXE boot and the initial OS)
 
(33 intermediate revisions by 5 users not shown)
Line 2: Line 2:
  
 
== Before you begin ==
 
== Before you begin ==
* find the machine's MAC address  (racadm getsysinfo)
+
* find the machine's MAC address  (<code>racadm getsysinfo</code>)
 
* decide on private / public IP address, and if it will need to exist in some special range
 
* decide on private / public IP address, and if it will need to exist in some special range
 
* decide how the disks should be arranged (raid, partitioning, etc.)
 
* decide how the disks should be arranged (raid, partitioning, etc.)
  
 
== Initial hardware setup ==
 
== Initial hardware setup ==
* Get the hardware racked and cabled (RobH)
+
* Get the hardware racked and cabled
* Get an IP and name (RobH)
+
* Get an IP and name (RobH, Mark, Leslie are comfortable doing this.)
 
:* follow [[DNS#HOWTO|DNS How-To section]] to add the name/ip to DNS
 
:* follow [[DNS#HOWTO|DNS How-To section]] to add the name/ip to DNS
 
:* set up $name.mgmt.$loc.wmnet as well to access the management interface
 
:* set up $name.mgmt.$loc.wmnet as well to access the management interface
:* set up $assettag.mgmt.$loc.wmnet in addition to the server name mgmt dns.
+
:* set up $assettag.mgmt.$loc.wmnet to the same IP as $name.mgmt.$loc.wmnet.
 
* Set up DHCP with the MAC address / name info
 
* Set up DHCP with the MAC address / name info
** log into brewster and edit <code>/etc/dhcp3/*</code> (any new server linux-host-entries.ttyS1-115200), run <code>/etc/init.d/dhcpd3-server restart</code>
+
** if it's a Dell, get MAC address from the mgmt console, run <code>racadm getsysinfo</code>; we use the first interface
 +
** in git, edit files/dhcpd/* (any new uses server linux-host-entries.ttyS1-115200)
 +
** after editing, merge and then run puppet on brewster (dhcp server)
 
* Get the switch set up to pass traffic to the host (Mark)
 
* Get the switch set up to pass traffic to the host (Mark)
 +
* set up the [[Raid_setup|hardware raid]] (if it has it)
  
 
== PXE boot and the initial OS ==
 
== PXE boot and the initial OS ==
* set up netboot to partition the disk
+
* if it's a cluster host, set up netboot to partition the disk
** log into the install server (presently brewster), edit /srv/autoinstall/netboot.cfg
+
** You need to edit netboot.cfg from the puppet configuration
** it's a bash case statement.  Add a new stanza for your hosts' name
+
** it's a bash case statement.  Make sure your hostname is matched by a regex in there.
** If you don't know what partitioning scheme to use and your host has two disks, use raid1-lvm.cfg.
+
* if it's a misc host, you'll have to pick a netboot option to partition the disk
* ssh to root@$servername.mgmt.$loc.wmnet, force a restart and pxe boot
+
** lvm over raid 1 is a decent config if you don't have anything more specific you need or you can simply NOT specify it in netboot.cfg and do the partition interactively in the install shell. (DO NOT DO THIS UNLESS YOU MUST, AUTOMATIC PARTITIONING LEADS TO STANDARDIZATION.)
 +
* ssh to root@$servername.mgmt.$loc.wmnet, force a restart and pxe boot.
 
** get the password from someone in ops if you don't have it
 
** get the password from someone in ops if you don't have it
** powercycle the host: <code>racadm serveraction powercycle</code>
+
'''Quick and Easy DRAC commands for Dell DRAC'''
** connect to the cosole: <code>console com2</code>
+
* Run the following in the DRAC to set it to PXE for ONLY the next boot, and to connect to the console once that is set and system is rebooted:
** during boot, force netboot: <code>F12</code>
+
  racadm config -g cfgServerInfo -o cfgServerBootOnce 1
*** when connecting from OSX via the Terminal, <code>escape-shift-2</code> sends F12
+
  racadm config -g cfgServerInfo -o cfgServerFirstBootDevice PXE
 +
  racadm serveraction powercycle
 +
  console com2
 
** you can leave this running to watch it complete
 
** you can leave this running to watch it complete
*** Note: if you see it ask you for disk partitioning information, you did the partitioning step above wrong
 
 
** when you're done, <code>ctrl-\</code> will disconnect you from the console
 
** when you're done, <code>ctrl-\</code> will disconnect you from the console
 +
*** <code>exit</code> will disconnect from the mgmt interface
  
 +
== Check your partitioning ==
 +
If you used a cluster host, check the partitioning
 +
* <code>"df -h"</code> will tell you what the mounted partitions are
 +
* <code>"fdisk -l | grep Disk"</code> will tell you the physical size of the disk
 +
* <code>"sfdisk -l /dev/sdX"</code> will tell you the size and type of the partitions in blocks
 +
'''Make sure most of the disk is used'''
 +
 
== Get puppet running ==
 
== Get puppet running ==
'''Warning''': if you are rebuilding a pre-existing server (rather than a brand new name), on sockpuppet, run <code>puppetca --clean $fqdn</code> to clear out the old certificate before beginning this process.
+
'''Warning''': if you are rebuilding a pre-existing server (rather than a brand new name), on sockpuppet, run <code>puppetca --clean $server_fqdn</code> to clear out the old certificate before beginning this process.  If you already began, also run (on the server you're building, not sockpuppet) <code>find /var/lib/puppet/ssl -type f -exec rm {} \;</code> to clean out the client.
 
* get a shell on both $server and the puppet master (sockpuppet)
 
* get a shell on both $server and the puppet master (sockpuppet)
 
** Only one key has access to new installs.   
 
** Only one key has access to new installs.   
** from sockpuppet, <code>ssh -i ~/.ssh/new_install root@$servername.wikimedia.org</code> to log into $server
+
** from sockpuppet, <code>ssh -o StrictHostKeyChecking=no -i ~/.ssh/new_install root@$server-fqdn</code> to log into $server
* on $server, run <code>puppetd --test</code>  It will fail.
+
** If the server is an existing server: from sockpuppet <code> ssh -i ~/.ssh/new_install root@$server-fqdn</code>
* on sockpuppet, run <code>puppetca -s $server-fqdn</code>
+
* on $server, run <code>puppetd --test --ca_server sockpuppet.pmtpa.wmnet
 +
</code>  It will fail.
 +
* on sockpuppet, run <code>puppetca -s $server_fqdn</code>
 +
* on $server, run <code>puppetd --test --ca_server sockpuppet.pmtpa.wmnet
 +
</code> It will fail once again
 
* on $server, run <code>puppetd --test</code>  It should now succeed.
 
* on $server, run <code>puppetd --test</code>  It should now succeed.
 +
After your first couple of successful puppet runs, you should reboot just to make sure it comes up clean.
  
 
== Set up puppet ==
 
== Set up puppet ==
Line 47: Line 65:
 
* [[DNS]]
 
* [[DNS]]
 
* An older version of the preseeding docs: [[Automated installation]]
 
* An older version of the preseeding docs: [[Automated installation]]
 +
* Another old page: [[Automated upgrade (reinstallation)]]
 
* More detail around working with the console: [[Remote_management]]
 
* More detail around working with the console: [[Remote_management]]
 +
* [[PartMan]]
  
 
[[Category:How-To]]
 
[[Category:How-To]]

Latest revision as of 00:39, 12 February 2013

Details on all the steps necessary to take a new (or old repurposed) piece of hardware and turn it into a happy functional server

Contents

[edit] Before you begin

  • find the machine's MAC address (racadm getsysinfo)
  • decide on private / public IP address, and if it will need to exist in some special range
  • decide how the disks should be arranged (raid, partitioning, etc.)

[edit] Initial hardware setup

  • Get the hardware racked and cabled
  • Get an IP and name (RobH, Mark, Leslie are comfortable doing this.)
  • follow DNS How-To section to add the name/ip to DNS
  • set up $name.mgmt.$loc.wmnet as well to access the management interface
  • set up $assettag.mgmt.$loc.wmnet to the same IP as $name.mgmt.$loc.wmnet.
  • Set up DHCP with the MAC address / name info
    • if it's a Dell, get MAC address from the mgmt console, run racadm getsysinfo; we use the first interface
    • in git, edit files/dhcpd/* (any new uses server linux-host-entries.ttyS1-115200)
    • after editing, merge and then run puppet on brewster (dhcp server)
  • Get the switch set up to pass traffic to the host (Mark)
  • set up the hardware raid (if it has it)

[edit] PXE boot and the initial OS

  • if it's a cluster host, set up netboot to partition the disk
    • You need to edit netboot.cfg from the puppet configuration
    • it's a bash case statement. Make sure your hostname is matched by a regex in there.
  • if it's a misc host, you'll have to pick a netboot option to partition the disk
    • lvm over raid 1 is a decent config if you don't have anything more specific you need or you can simply NOT specify it in netboot.cfg and do the partition interactively in the install shell. (DO NOT DO THIS UNLESS YOU MUST, AUTOMATIC PARTITIONING LEADS TO STANDARDIZATION.)
  • ssh to root@$servername.mgmt.$loc.wmnet, force a restart and pxe boot.
    • get the password from someone in ops if you don't have it

Quick and Easy DRAC commands for Dell DRAC

  • Run the following in the DRAC to set it to PXE for ONLY the next boot, and to connect to the console once that is set and system is rebooted:
 racadm config -g cfgServerInfo -o cfgServerBootOnce 1
 racadm config -g cfgServerInfo -o cfgServerFirstBootDevice PXE
 racadm serveraction powercycle
 console com2
    • you can leave this running to watch it complete
    • when you're done, ctrl-\ will disconnect you from the console
      • exit will disconnect from the mgmt interface

[edit] Check your partitioning

If you used a cluster host, check the partitioning

  • "df -h" will tell you what the mounted partitions are
  • "fdisk -l | grep Disk" will tell you the physical size of the disk
  • "sfdisk -l /dev/sdX" will tell you the size and type of the partitions in blocks

Make sure most of the disk is used

[edit] Get puppet running

Warning: if you are rebuilding a pre-existing server (rather than a brand new name), on sockpuppet, run puppetca --clean $server_fqdn to clear out the old certificate before beginning this process. If you already began, also run (on the server you're building, not sockpuppet) find /var/lib/puppet/ssl -type f -exec rm {} \; to clean out the client.

  • get a shell on both $server and the puppet master (sockpuppet)
    • Only one key has access to new installs.
    • from sockpuppet, ssh -o StrictHostKeyChecking=no -i ~/.ssh/new_install root@$server-fqdn to log into $server
    • If the server is an existing server: from sockpuppet ssh -i ~/.ssh/new_install root@$server-fqdn
  • on $server, run puppetd --test --ca_server sockpuppet.pmtpa.wmnet

It will fail.

  • on sockpuppet, run puppetca -s $server_fqdn
  • on $server, run puppetd --test --ca_server sockpuppet.pmtpa.wmnet

It will fail once again

  • on $server, run puppetd --test It should now succeed.

After your first couple of successful puppet runs, you should reboot just to make sure it comes up clean.

[edit] Set up puppet

  • add $server to site.pp, either by hostname or within a regex if it's part of a class (eg srv\d\d*)
  • do whatever puppet goodies you want to get the server to do what you want it to.

[edit] Related pages

Personal tools
Namespaces

Variants
Actions
Navigation
Ops documentation
Wiki
Toolbox