November 18

Linux: Registering Server with Satellite

Use the following procedure to register (or re-register) a RedHat (v6 or v7) with our corporate Satellite server (ServerName)
    Open a SSH (Putty) Terminal or VMWare console to the VM.
*NOTE: If you use Putty you can copy and paste the below commands into the shell for quick and easy setup.
    ###For a brand new server, Restart the virt-who service on ServerName###
 * systemctl stop virt-who * virt-who –one-shot  * systemctl start virt-who 
    ###CLEAN THE SUBSCRIPTION-MANAGER CACHE###
 subscription-manager clean
    ###SUBSCRIPTION MANAGER SETUP###
rpm -ivh http://ServerName/pub/katello-ca-consumer-latest.noarch.rpm
    ###REGISTER WITH SATELLITE###    -DEV-
subscription-manager register –org=”companyname” –activationkey=”RHEL7Dev”subscription-manager register –org=”companyname” –activationkey=”RHELD6ev”
    -QA-
subscription-manager register –org=”companyname” –activationkey=”RHEL7QA”subscription-manager register –org=”companyname” –activationkey=”RHEL6QA”
    -PRD-
subscription-manager register –org=”companyname” –activationkey=”RHEL7PRD”subscription-manager register –org=”companyname” –activationkey=”RHEL6PRD”
    ###SUBSRIBE###
subscription-manager subscribe –auto
    ###INSTALL COTELLO AND PUPPET AGENT###
yum install katello-agent puppet -y
    ###INSTALL PUPPET AGENT###
puppet agent -t –server servername.domain.com
    ### APPEND SERVER NAME TO puppet.conf###    RHEL 7
* echo “server = servername.domain.com” >> /etc/puppet/puppet.conf;systemctl enable puppet;systemctl restart puppet;systemctl status puppet
    RHEL 6
* echo “server = servername.domain.com” >> /etc/puppet/puppet.conf;chkconfig puppet on;service puppet restart;service puppet status
    ###RUN YUM UPDATE###
* yum update -y
RHEL7:
systemctl enable puppetsystemctl start puppetsystemctl status puppet (should see green output)
RHEL6:
chkconfig puppet onservice puppet startservice puppet status
We also need to ensure that the /etc/puppet/puppet.conf file has this as it’s last line (in the “Agent” section:
server = servername.domain.com
    ###REMOTE EXECUTION SSH KEY SETUP###
Run this command from the root shell on the satellite:
* ssh-copy-id -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub root@<name-of-host>

* ###IF ERRORS DURING YUM INSTALL###yum clean allrm -rf /var/cache/yum* Then start from the beginning

Category: Linux | Comments Off on Linux: Registering Server with Satellite
November 18

Linux: Puppet syncing and certificate issues

If puppet cannot be updated due to a certificate issue.  Look in the subfolders of/etc/puppetlabs/puppet/ssl to determine if their are pem files with other server names verses the actual name of the server.
If there are delete them with the following:find /etc/puppetlabs/puppet/ssl -name offendingservername.domainname.com.pem -delete

To completely start over with new keys do the following:find /etc/puppetlabs/puppet/ssl -name actualservername.domainname.com.pem -delete
Then goto the satellie server and delete the offending certificate.puppet cert clean actualservername.domainname.com
Go back to the server and run:puppet agent -tv
Goback to the Satellite server and accept all certificates:puppet cert sign –all
Go back to the server and run:puppet agent -tv

Category: Linux | Comments Off on Linux: Puppet syncing and certificate issues
November 18

Linux: Satellite / foreman cleanup

If a servers that was already on Satellite has a certificate change this will break Satellites ability to send remote execution jobs from foreman.The fix is to manually remove the know_hosts key for the problem server from the foreman-proxy’s know_hosts file.
vim /usr/share/foreman-proxy/.ssh/know_hosts /servername #search for the server
dd #To delete the server info from the file

Category: Linux | Comments Off on Linux: Satellite / foreman cleanup
November 18

Linux: Red Hat Server Cloning/Clone Preparation

This document describes the configuration needed to clean up a RHEL 7 virtual machine before turning it into a template for cloning.Process for Cloning Redhat servers.

1. Using Vi or Nano, replace the old server name with the new one in the following files:Look for hostname= (I use the name of the template)/root/./anaconda-ks.cfg/root/./initial-setup-ks.cfg
2. Shut down the following services:service rsyslog stopservice auditd stop
3. Delete uneeded temp files:rm –rf /tmp/*rm –rf /var/tmp/*
4.  If it exists remove the persistent-net rules file.rm -f /etc/udev/rules.d/70-persistent-net.rules
5. Remove the HWADDR and Static IP lines from /etc/sysconfig/network-scripts/ifcfg-eth[x]It is a good Idea to remove the UUID
6. Remove the ssh configuration files.  These will be automatically recreated.rm -rf /etc/ssh/ssh_host_*
7.  Force SElinux to relabel and not reject changestouch /.autorelabel
8. Clear the machine IDtruncate -s0 /etc/machine-id
9.  If using puppet- On clientsystemctl stop puppetfind /etc/puppetlabs/puppet/ssl -name servername.domainname.com.pem -delete
– On puppet serverpuppet cert clean servername.domainname.com
10. If using katellomv /etc/rhsm/facts/katello.facts /tmp
11. Configure the initial graphical setup for nameing and IPing the server.echo “RUN_FIRSTBOOT=YES” > /etc/sysconfig/firstbootsystemctl enable initial-setup
12. Clear history:history -c
13. Shutdown system:shutdown -h now

Category: Linux | Comments Off on Linux: Red Hat Server Cloning/Clone Preparation
November 18

Linux: Resizing lvm when using LUKS

Fedora by default gives the home directory too much space and you may run out of space on your root partition.  In this example we will shrink home and give the space to root.
Start sizesvolume 465 GBhome = 407 GBroot = 50 GBswap = 8 GB
Boot computer using an external boot OSsudo su -fdisk -l
find the LUKS volume.  It is likely /dev/sda3
cryptsetup luksOpen /dev/sda3 cryptdiskenter your password:
pvdisplayvgdisplaylvdisplay
scan the volume you are wanting to shrinke2fsck -f /dev/vgroupname/home

Make home 350 GBlvresize –resizefs –size 350G /dev/vgroupname/home
Make root 100GBlvresize -l +100%FREE /dev/vgroupname/root

Check File Systemse2fsck -f /dev/vgroupname/homee2fsck -f /dev/vgroupname/root

Final sizesvolume 465 GBhome = 350 GBroot = 100 GBswap = 8 GB

Category: Linux | Comments Off on Linux: Resizing lvm when using LUKS