Recuperar CentOS sem YUM e RPM

2

Esta é a história:

Eu tenho (ou tinha) uma caixa linux com CentOS 5.9 e uma configuração LAMP pré-instalada. Ele estava funcionando, mas estava muito desatualizado, por exemplo, o mysql era a versão 4. Então, decidi atualizar tudo com yum .

Estranhamente, meu sqlite era 3.6, o que é mais novo que 3.3, listado como uma dependência para PHP, Apache e subversão mais recentes, então yum parou de atualizar e reclamou disso.

Então eu fiz uma coisa muito errada: usei yum erase sqlite para remover o sqlite antigo (e mais novo) do meu sistema. Neste ponto, o yum removeu o sqlite e todos os outros pacotes que o continham como dependência. Isso incluiu basicamente tudo:)

Agora eu ainda tenho acesso ssh à minha caixa, mas apache, mysql, php, foi embora, muitas outras coisas foram excluídas também, incluindo o pacote de desenvolvimento, o rpm e o próprio yum.

Tenho experiência com o Debian e o apt-get, e mal consigo acreditar que fiz isso nos primeiros 30 minutos em uma máquina centos com o yum. Agora eu não tenho ideia de como consertar isso.

Eu encontrei como instalar o yum a partir de um arquivo rpm, ou rpm do yum, mas já que não tenho nenhum ...

Na minha raiz eu tenho este arquivo: initrd-2.6.18-308.13.1.el5.centos.plus.img Eu imagino que é uma imagem do meu sistema como pré-instalado, mas eu não tenho ideia de como recuperar meu sistema deste arquivo.

Alguém pode me ajudar com isso?

    
por Gustavo Vargas 09.07.2013 / 20:02

2 respostas

3

Você pode tentar extrair os seguintes pacotes em outro host:

link link

e depois copie os arquivos binários com scp / wget / rsync. Eu tentei em estações de trabalho vmware e tudo funciona bem

# yum erase rpm
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package rpm.x86_64 0:4.4.2.3-32.el5_9 set to be erased
--> Processing Dependency: rpm = 4.4.2.3-32.el5_9 for package: rpm-python
--> Processing Dependency: rpm = 4.4.2.3-32.el5_9 for package: rpm-libs
--> Processing Dependency: rpm for package: man
--> Processing Dependency: rpm = 4.4.2.3-32.el5_9 for package: rpm-build
--> Processing Dependency: rpm = 4.4.2.3-32.el5_9 for package: rpm-devel
--> Processing Dependency: rpm >= 4.4.2 for package: yum
--> Running transaction check
---> Package man.x86_64 0:1.6d-3.el5 set to be erased
--> Processing Dependency: man >= 1.6d-2 for package: man-pages-overrides
---> Package rpm-build.x86_64 0:4.4.2.3-32.el5_9 set to be erased
---> Package rpm-devel.x86_64 0:4.4.2.3-32.el5_9 set to be erased
--> Processing Dependency: rpm-devel for package: net-snmp-devel
---> Package rpm-libs.x86_64 0:4.4.2.3-32.el5_9 set to be erased
--> Processing Dependency: librpm-4.4.so()(64bit) for package: net-snmp
--> Processing Dependency: librpmio-4.4.so()(64bit) for package: net-snmp
---> Package rpm-python.x86_64 0:4.4.2.3-32.el5_9 set to be erased
--> Processing Dependency: rpm-python for package: system-config-network-tui
---> Package yum.noarch 0:3.2.22-40.el5.centos set to be erased
--> Processing Dependency: yum >= 3.2.22 for package: yum-updatesd
--> Processing Dependency: yum >= 3.0 for package: yum-fastestmirror
--> Running transaction check
---> Package man-pages-overrides.noarch 0:5.9.2-2.el5 set to be erased
---> Package net-snmp.x86_64 1:5.3.2.2-20.el5 set to be erased
---> Package net-snmp-devel.x86_64 1:5.3.2.2-20.el5 set to be erased
---> Package system-config-network-tui.noarch 0:1.3.99.21-1.el5 set to be erased
--> Processing Dependency: system-config-network-tui for package: firstboot-tui
---> Package yum-fastestmirror.noarch 0:1.1.16-21.el5.centos set to be erased
---> Package yum-updatesd.noarch 1:0.9-5.el5 set to be erased
--> Running transaction check
---> Package firstboot-tui.x86_64 0:1.4.27.9-1.el5.centos set to be erased
--> Processing Dependency: /usr/bin/man for package: redhat-lsb
--> Processing Dependency: /usr/bin/man for package: redhat-lsb
--> Processing Dependency: /bin/rpm for package: policycoreutils
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package policycoreutils.x86_64 0:1.33.12-14.8.el5_9 set to be erased
--> Processing Dependency: policycoreutils >= 1.33.12-14.5 for package: selinux-policy-targeted
--> Processing Dependency: policycoreutils for package: sudo
--> Processing Dependency: policycoreutils for package: sudo
--> Processing Dependency: policycoreutils >= 1.33.12-14.5 for package: selinux-policy
--> Processing Dependency: policycoreutils for package: setools
---> Package redhat-lsb.i386 0:4.0-2.1.4.el5 set to be erased
---> Package redhat-lsb.x86_64 0:4.0-2.1.4.el5 set to be erased
--> Running transaction check
---> Package selinux-policy.noarch 0:2.4.6-338.el5 set to be erased
---> Package selinux-policy-targeted.noarch 0:2.4.6-338.el5 set to be erased
---> Package setools.x86_64 0:3.0-3.el5 set to be erased
---> Package sudo.x86_64 0:1.7.2p1-22.el5_9.1 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                      Arch                      Version                                    Repository                    Size
======================================================================================================================================================
Removing:
 rpm                                          x86_64                    4.4.2.3-32.el5_9                           installed                    3.6 M
Removing for dependencies:
 firstboot-tui                                x86_64                    1.4.27.9-1.el5.centos                      installed                    652 k
 man                                          x86_64                    1.6d-3.el5                                 installed                    354 k
 man-pages-overrides                          noarch                    5.9.2-2.el5                                installed                    181 k
 net-snmp                                     x86_64                    1:5.3.2.2-20.el5                           installed                    2.8 M
 net-snmp-devel                               x86_64                    1:5.3.2.2-20.el5                           installed                    8.0 M
 policycoreutils                              x86_64                    1.33.12-14.8.el5_9                         installed                    2.1 M
 redhat-lsb                                   i386                      4.0-2.1.4.el5                              installed                     21 k
 redhat-lsb                                   x86_64                    4.0-2.1.4.el5                              installed                     22 k
 rpm-build                                    x86_64                    4.4.2.3-32.el5_9                           installed                    1.5 M
 rpm-devel                                    x86_64                    4.4.2.3-32.el5_9                           installed                    4.1 M
 rpm-libs                                     x86_64                    4.4.2.3-32.el5_9                           installed                    2.0 M
 rpm-python                                   x86_64                    4.4.2.3-32.el5_9                           installed                    131 k
 selinux-policy                               noarch                    2.4.6-338.el5                              installed                    7.9 M
 selinux-policy-targeted                      noarch                    2.4.6-338.el5                              installed                     33 M
 setools                                      x86_64                    3.0-3.el5                                  installed                    3.3 M
 sudo                                         x86_64                    1.7.2p1-22.el5_9.1                         installed                    884 k
 system-config-network-tui                    noarch                    1.3.99.21-1.el5                            installed                    4.9 M
 yum                                          noarch                    3.2.22-40.el5.centos                       installed                    3.3 M
 yum-fastestmirror                            noarch                    1.1.16-21.el5.centos                       installed                     47 k
 yum-updatesd                                 noarch                    1:0.9-5.el5                                installed                     55 k

Transaction Summary
======================================================================================================================================================
Remove       21 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y

e depois

# wget http://mirror.mirohost.net/centos/5.9/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm

# wget http://mirror.mirohost.net/centos/5.9/os/x86_64/CentOS/rpm-python-4.4.2.3-31.el5.x86_64.rpm

# wget http://mirror.mirohost.net/centos/5.9/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

# rpm -ivh --nodeps yum-3.2.22-40.el5.centos.noarch.rpm  rpm-python-4.4.2.3-31.el5.x86_64.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
Preparing...                ########################################### [100%]
   1:rpm-python             ########################################### [ 33%]
   2:yum-fastestmirror      ########################################### [ 67%]
   3:yum                    ########################################### [100%]

Verifique se tudo funciona bem

# yum install mc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.colocall.net
 * epel: ftp.colocall.net
 * extras: ftp.colocall.net
 * rpmforge: ftp.colocall.net
 * updates: centos.itt-consulting.com
base                                                                                                                           | 1.1 kB     00:00
epel                                                                                                                           | 3.6 kB     00:00
extras                                                                                                                         | 2.1 kB     00:00
rpmforge                                                                                                                       | 1.9 kB     00:00
updates                                                                                                                        | 1.9 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mc.x86_64 1:4.6.1a-35.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                        Arch                               Version                                     Repository                        Size
======================================================================================================================================================
Installing:
 mc                             x86_64                             1:4.6.1a-35.el5                             base                             2.1 M

Transaction Summary
======================================================================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 2.1 M
Is this ok [y/N]:
Downloading Packages:
mc-4.6.1a-35.el5.x86_64.rpm                                                                                                    | 2.1 MB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : mc                                                                                                                             1/1

Installed:
  mc.x86_64 1:4.6.1a-35.el5

Complete!

P.S Depois disso, não esqueça de reinstalar o rpm via yum;)

# yum install rpm
    
por 09.07.2013 / 22:40
0

Você pode tentar os seguintes comandos

# cd /mnt
# zcat /root/initrd-2.6.18-308.13.1.el5.centos.plus.img | cpio -i

Mas acho que isso não resolve o seu problema. Você pode tentar baixar o dvd entos, montá-los e instalar todos os pacotes necessários

# cd /root 
# wget http://mirror.mirohost.net/centos/5.9/isos/x86_64/CentOS-5.9-x86_64-bin-DVD-1of2.iso
# mount -o loop /root/CentOS-5.9-x86_64-bin-DVD-1of2.iso /mnt

P.S. Você pode ver todos os pacotes removidos em / var / log / messages

    
por 09.07.2013 / 20:38

Tags