Update offline CentOS/RHEL server
Sometimes you have a RHEL/CentOS server which is not connected to the Internet. But you should also install security update to prevent local hackers to mess up your system.
I was not able to find some nice description how to do it. Some people are using proxies – but then you still need some connection to the proxy – which can not be the case.
Here is my way how I did it….
Let’s say there is a server which is offline and doesn’t have any connection to the Internet.
Then we need station (or laptop / virtual machine), which has the same OS as server and is connected to the Internet.
Copy the /var/lib/rpm to the station (you can use USB/CD…)
Install the download only plugin for yum:
Backup the original rpm directory on the station and replace it with the rpm directory from the server:
mv -v /tmp/rpm /var/lib/
Download updates to /tmp/rpm_updates and return back the /var/lib/rpm
yum update --downloadonly --downloaddir /tmp/rpm_updates
rm -rvf /var/lib/rpm
mv -v /var/lib/rpm.orig /var/lib/rpm
Transfer the downloaded rpms to the server and update:
ssh root@server
rpm -Uvh /tmp/rpm_updates/*
…and the server is updated
This is probably not the best way how to do it, but it’s working for me.