So far in the “Back to Basics” series (if you can call it that), I’ve covered, setting up a local yum repository, creating a internal DNS server and creating a DHCP server. Oh, and also then correcting the fact that I had missed the reverse DNS zone for my lab network! Doh!!! Now, none of this was by accident (accept the reverse zone mishap).
In an isolated network, access to installation media can be essential, DNS and DHCP a pretty much standard in all environments (there are some exceptions) and all are pretty much mandatory in order to get your network up and running.
The ultimate aim of this series is to end up with a server which can be used to build more servers and/or clients into the lab network that I am setting up.
The above will then provide a basic but functional method of deploying more servers and clients into the lab environment, across the network and removes the need for monkeying around with ISO images, USB sticks (if you were to do similar in a real network) and once tested removes the human errors that can be introduced when manually installing an OS multiple times.
Given that I set up a local yum repository based on the installation media, it couldn’t be simpler.
One thing to consider here is SELinux.
Before you run for the hills screaming, just take a deep breath and embrace something that by default will make your server more secure, yes it does have a bit of a learning curve but doesn’t everything?
I’m a believer in using the tools available to ensure I end up with a secure and stable environment. SELinux is one of those things which for many years I avoided like the plague but to be honest, that was due to me not having had the time to properly understand what it does and how it does it.
After spending some time tinkering with it, it didn’t seem half as scary. For sure, it complicates things a little when you come to troubleshoot permission issues, but then everything is more contained.
As you can see we now have the right context associated with the centos7 directory, now we need to make sure the httpd.conf file is updated to present the centos7 directory and it’s contents to the outside world.
The Alias allows you to point to a directory which is outside of Apaches’ DocumentRoot, (typically set to /var/www/html). The Directory block, contains two things of note. First, for testing I have added the “Options +Indexes” so that when I try to connect from a web browser on my client machine, I can confirm that I can see the contents of the repository directory. The second chunk of config, starting “Order all,deny…” is there so that Apache will allow connections to this none standard location.
One thing I did have to do, that I haven’t stated above is allow HTTP connections through the firewall.
Note. To make this new firewall rule permanent you need to use the “–permanent” firewall-cmd option on the command line. I added this afterwards once I was happy that everything was working.
This is very similar in the steps taken when I setup the local yum repository. The only difference this time will be that I’ll give it a more meaningful name and the file location will be a http:// address rather that a file:///.
And there we have it a working centralised repository, if you don’t have access to Red Hat Satellite server or if you don’t want to install the open source version Spacewalk.
Ah, I guess a demo is never meant to go really smoothly, but this is probably better as it demonstrates some awesome functionality that yum has.
Line 3, shows that it has found my networked repo, line 5 shows that there is no such package in the repo, line 7 highlights a way to find the right package for the command you want to run, lines 10 through 14 show conclusively that it has connected across the network to the repo, and has found a suitable package called sysstat. In line 21, I’m trying to install the package only to be told in line 24 that it’s already installed.
The really keen eyed of you may have also spotted the @anaconda repo, this should have rung an alarm bell in my head to say, hey! What are you doing? Its already installed!