I have accidentally deleted all my repos and I'm unable to install any packages

Linode Staff

I have accidentally deleted all my repos and I'm unable to install any packages

Running

sudo yum install {package}

returns

 "Error: There are no enabled repositories in "/etc/yum.repos.d", "/etc/yum/repos.d", "/etc/distro.repos.d"

2 Replies

This topic came up on the Red Hat customer portal recently. The basic tenets of the approach here could work for CentOS or other distributions:

Using the Secure Copy Protocol (SCP), you can copy over the required files from a working system. In a cloud environment like Linode, the best way to do that would be to spin up a new Linode with the same distribution as yours top copy those files over from. Once this is complete, you can remove that Linode from your account. This will incur a cost, though a Nanode would be sufficient for this use.

If you would like to avoid the incurred cost of another Linode on your account, then you could take steps to locally mount the ISO image and extract the config files from it. Specifically for yum/CentOS 8, the link above provides steps for this approach.

@OP --

Once you are done implementing @watrick's suggestion, you need to make sure the permissions/ownership of the files you copied are correct. Otherwise, anything you do involving them is going to fail spectacularly.

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct