Creating a CentOS repository

This is just a quick howto on creating a CentOS repository with EPEL on CentOS.

First we need to have a webserver installed as we need to access the repository via http.
I am going to use Apache. On Redhat based systems the package is called httpd and on Debian it is Apache2.

Install Apache and rsync client
[root@logoff]# yum install httpd rsync
Start Apache
[root@logoff]# /etc/init.d/httpd start

The default directory for the DocumentRoot is under /var/www/html

Create the repository directory
[root@logoff]# mkdir -p /var/www/html/repo/CentOS
[root@logoff]# mkdir -p /var/www/html/repo/EPEL

Create the scripts directory
[root@logoff]# mkdir -p /opt/scripts

Create the CentOS mirror script
In your favourite editor add the following in /opt/scripts/centos.sh

#!/bin/sh

rsync="/usr/bin/rsync -avqHz --delete"
mirror=ftp.is.co.za::mirror/centos

verlist="6 6.5"
archlist="x86_64"
baselist="SCL os updates extras isos centosplus contrib cr fasttrack xen4"
local=/var/www/html/repo/CentOS

for ver in $verlist
do
for arch in $archlist
do
for base in $baselist
do
remote=$mirror/$ver/$base/$arch/
$rsync $remote $local/$ver/$base/$arch/
done
done
done

Make the script executable
[root@logoff]# chmod +x /opt/scripts/centos.sh
Run the script
[root@logoff]# /opt/scripts/centos.sh

Create the EPEL mirror script
In your favourite editor add the following in /opt/scripts/epel.sh

#!/bin/bash /usr/bin/rsync -avqHz --exclude-from="/opt/scripts/epel_excludes.txt" --numeric-ids --delete --delete-after --delay-updates rsync://dl.fedoraproject.org/fedora-epel /var/www/html/repo/EPEL/

Create the epel_excludes
In your favourite editor add the following in /opt/scripts/epel_excludes.txt

4
4AS
4ES
4WS
5
5Client
5Server
RPM-GPG-KEY-EPEL-4
RPM-GPG-KEY-EPEL-5
beta
testing
i386
ppc64

Make the script executable
[root@logoff]# chmod +x /opt/scripts/epel.sh
Run the script
[root@logoff]# /opt/scripts/epel.sh

Do note, this is extremely big. I have done 6 and 6.5 and it about 100GB
Once it has completed you can edit the following file on the client machine.
Replace the http://logoff part with your repository’s IP or dns name if you have set it up.

/etc/yum.repos.d/CentOS-Base.repo


# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=http://logoff/repo/CentOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://logoff/repo/CentOS/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://logoff/repo/CentOS/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - CentosPlus
baseurl=http://logoff/repo/CentOS/$releasever/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://logoff/repo/CentOS/$releasever/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#scl
[SCL]
name=CentOS-$releasever - SCL
baseurl=http://logoff/repo/CentOS/$releasever/SCL/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#cr
[cr]
name=CentOS-$releasever - cr
baseurl=http://logoff/repo/CentOS/$releasever/cr/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#xen4
[xen4]
name=CentOS-$releasever - xen4
baseurl=http://logoff/repo/CentOS/$releasever/xen4/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#os
[os]
name=CentOS-$releasever - os
baseurl=http://logoff/repo/CentOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://logoff/repo/EPEL/6/$basearch
failovermethod=priority
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=http://logoff/repo/EPEL/6/SRPMS/
failovermethod=priority
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Then run the following on the client machine:

[root@client]# yum update

Sources

https://fedoraproject.org/wiki/EPEL

Back to the books

I started working the first year I left school when one of my best friends gave me an opportunity to work for him. Being a computer geek at the time I couldn’t say no, so I took it with arms wide open. He introduced me to a wonderful thing called Unix. At the time I had no idea what the hell that was. Coming from only knowing windows this was challenging! When I say challenging, I mean the kids of today actually have it easy! We now have Google and a lot more resources and guides to help us. Back then we only had the operating system manual pages, the README files and books that you had to go buy!
Over the years I started to love open source software because it was free and you could do with it whatever you wanted! Those that knew Unix back then, most of the things you did was in the console unlike windows that you had a point and click interface.

I never did any qualifications, courses or anything. Everything I learnt was from hands on experience, friends, search engines, books, etc. I’ve never needed to study anything as I have been lucky enough to have been in companies that just saw my experience as enough. Over the years I have been a jack-of-all-trades in the sense that I never specialized in one aspect of I.T and am able to do most things, from setting up servers, be it web-servers, databases, DNS, etc, to creating websites, to writing some code, to creating networks, firewalls, storage servers and the list goes on. I’ve loved getting my hands dirty on every aspect I could! The past 2 years it has dawned on me that I want to get some sort of certificate or something that I want to do. Nothing out there really grabs my eye that is like WOW, I must do it! I mean Linux LPI, that’s so YAWN. Red Hat certification, you are limited to RedHat and maybe CentOS. I have considered maybe the Cisco route, but I realize I don’t like networking that much. I mean I love it, but it’s ok.

The past year or so I have been chatting to a friend who is big into I.T Security. He may not know, but I have always looked up to him as a mentor. I’ve loved the security side of I.T be it firewalls, securing a system, installing an IDS and analysing it and finding holes in systems and patching them up. Anyhoo, it got me thinking about studying. There is one certification I would love to get but it is pretty challenging and I have been scared shitless about it. CISSP (Certified Information Systems Security Professional). This is not an easy one to get as the requirements are daunting. I have forgotten what it is like to study! This is one reason why I am so scared! It’s not a month or two thing, this is a year or two thing depending how much I put into studying! Now, you can understand why! If I do this, I need to push myself!

Another certification I have been pondering about is the Puppet Professional Certification. Puppet is an automation software that helps manage infrastructure throughout its lifecycle, from provisioning and configuration to orchestration and reporting. I am not going to explain this in detail of course, but anyone in I.T would tell you that if you want to rather automate things in your environment rather than manual configuring things they would all tell you AUTOMATE! I know this is far different from the security aspect, but for me this also excites me.

So there you have it. I need a schedule and some motivation. If you have any tips for me please let me know!

Reinventing the wheel

So many of you may have been wondering what’s happened to me and why I stopped posting here well…

I have been blogging since 2005. I first started out on Xanga (I saw they redesigned the whole aspect of it) where I used that to vent my frustrations and it actually helped a lot! I then moved over to cloud.za.net –> empyrean.za.net and then I finally moved it to Logoff.
My goal of blogging was to share some of my life moments, share funny videos and anything I found interesting. Towards the beginning of last year I found that many bloggers I followed would blog the same thing basically most of the time and it felt like I was wasting my time.
My last post was last year November and I decided to take a break.
During this year I have thought about what I wanted to do with my site to make it unique and see what direction I wanted to take it. The past month I’ve been thinking of making it a more technology based. So after a long year I think I am ready to pick this up and start something new. I see a goal, but to reach that goal I need to start somewhere and here I start. So expect more updates and cosmetic changes here the next couple of weeks!

My older posts are still going to be on this site of course, but I have decided to keep it out of the visible eye just to seem that it looks like a fresh clean blog again.

Thank you to those who have been following my blog over the years :)