Skip to content

Instantly share code, notes, and snippets.

@gnanet
Last active June 4, 2020 06:37
Show Gist options
  • Save gnanet/795a6fa2d83d83120e80e65d4dd129d9 to your computer and use it in GitHub Desktop.
Save gnanet/795a6fa2d83d83120e80e65d4dd129d9 to your computer and use it in GitHub Desktop.
Install additional packages on Xenserver 6.2

Install additional packages on Xenserver 6.2

This small gist holds historical info, and tries to help sysadmins manage their rather old Xenserver which is still in production

Short step-by-step to create extra space for Dom0

  1. export xenvg=`vgscan | grep VG_XenStorage | awk -F'"' {' print $2 '}`
    
  2. lvcreate -L 30G -n xenhostdata ${xenvg}
    
  3. mkfs.ext3 -L xenhostdata /dev/${xenvg}/xenhostdata
    
  4. mkdir -p /media/data
    
  5. mount /dev/${xenvg}/xenhostdata /media/data
    
  6. lvchange -a y /dev/${xenvg}/xenhostdata
    
  7. echo "lvchange -a y /dev/${xenvg}/xenhostdata" >> /etc/rc.d/rc.local
    
  8. echo "mount /dev/${xenvg}/xenhostdata /media/data" >> /etc/rc.d/rc.local
    
  9. Now you will need to replace /etc/yum.repos.d/CentOS-Base.repo with the one found in this gist so you can move on.

    cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo-citrix
    : > /etc/yum.repos.d/CentOS-Base.repo
    wget  -O /etc/yum.repos.d/CentOS-Base.repo --no-check-certificate "https://gist.githubusercontent.com/gnanet/795a6fa2d83d83120e80e65d4dd129d9/raw/829ea352b146da089aa02c26433474dd7ea34fb5/CentOS-Base.repo"
    

First you will surely need the epel repository

yum --enablerepo=extras install epel-release

Now you are ready to install tools like mc screen htop and even fail2ban, but prior installing fail2ban the e-mail setup also needs to be done.

For now lets install the first three

yum --enablerepo=epel --enablerepo=base install mc htop screen 

With 30GB of data, you can add an ISO library for local saved .iso installers with following, and start with adding debian 9 dvd

mkdir -p /media/data/iso
xe sr-create name-label=LocalISO type=iso device-config:legacy_mode=true device-config:location=/media/data/iso content-type=iso
wget --no-check-certificate "https://cdimage.debian.org/cdimage/release/current/amd64/iso-dvd/debian-9.4.0-amd64-DVD-1.iso"

Next important step, is get a patcher script on your XenServer

mkdir -p /media/data/patch
mkdir -p /media/data/bin
wget --no-check-certificate -O /media/data/bin/patcher.py https://raw.github.com/dalgibbard/citrix_xenserver_patcher/master/patcher.py
chmod a+x /media/data/bin/patcher.py
cd /media/data/patch

About the usage of the automated patcher please head on to: https://github.com/dalgibbard/citrix_xenserver_patcher

Last but not least: fail2ban. Prepare a remote server and SMTP access data, and replace all relevant parts in the template below. First secure a copy of the original ssmtp.conf

cp /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.bak

then create a new one with your data.

echo "root=your@email.tld
mailhub=mail.server.tld:587
rewriteDomain=server.tld
hostname=your.server.tld
AuthUser=some@email.tld
AuthPass=thepassword" > /etc/ssmtp/ssmtp.conf

Now you can install fail2ban:

yum --enablerepo=epel --enablerepo=base install fail2ban

For further configuration please consult the manuals of fail2ban.

This is it, the final line. I hope you could find useful ideas here

# /etc/yum.repos.d/CentOS-Base.repo
# http://mirror.centos.org/centos/5/readme declares 5.11 as the latest of CentOS 5 family, so it may be better to create this
# version of CenbtOS-Base.repo than using CentOS-Vault.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/5.11/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=kernel-xen*, *xen*
enabled=0
[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/5.11/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=kernel-xen*, *xen*
enabled=0
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/5.11/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=0
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=0
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/5.11/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
enabled=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment