I have a CentOS7 machine that is protected by firewall, I can only connect via ssh outside. I want to do yum upgrade on that server to upgrade the package. How can I do that? (we haven't got privileges to control the firewall)
3 Answers
Here's what I would do. So, you can SSH to the server (let's call it server, from your machine; let's call it workstation.
- Set up an HTTP Proxy like Squid on
workstation, listening onlocalhost:8080. From
workstation, open a reverse SSH tunnel toserver:ssh -R 8080:localhost:8080 user@serverConfigure
yumonserverto uselocalhost:8080as a proxy.yumwill now access the internet via the the SSH Tunnel throughworkstation.
You can test your configuration like this:
wget -e use_proxy=yes -e http_proxy=127.0.0.1:8080 http://someurl.example.com/ See this question and answers for more information! :)
If SSH is enabled SCP should work as well.
Depending on what you need to update you can download the newest CentOS release, SCP it to your server and configure YUM to use the repo in the new release. Then yum update with grab the packages from the new release.
This is a simple way if you only need new CentOS packages, if you have other 3rd party software it can be a hassle to collect them all.
- the whole yum repo is 15TB, so I just want to find a way that update system or install software easily but source compile.user154728– user1547282016-02-04 02:43:40 +00:00Commented Feb 4, 2016 at 2:43
- Was this system always isolated from the internet? If so how did you do your initial install? There should be an updated version of the base/everything/minimal CentOS that you can use. If you've used an extra repo like EPEL then transferring that is not feasible for you.Centimane– Centimane2016-02-04 11:17:14 +00:00Commented Feb 4, 2016 at 11:17
If you can SSH into the server, that means your firewall ports you to the server. But I can't possible belive that you use a oneway-er. So if you can go into the server, you should be able to yum upgrade with ease. Try this: What is the output of: wget http://ipinfo.io/ip -qO - Or better question: What is the output of the yum upgrade?
- "Error: Cannot find a valid baseurl for repo: base" when run yum upgrade. Because this server can access dbserver in private network onlyuser154728– user1547282016-02-03 13:15:37 +00:00Commented Feb 3, 2016 at 13:15
- network administrator disable this server access other server and let us access only use ssh is too easilyuser154728– user1547282016-02-03 13:18:34 +00:00Commented Feb 3, 2016 at 13:18
sshout to the internet from the machine?