Install Gentoo on VDS with Virtuozzo Virtualization

    A little over a year ago, I started renting VDS from a company that uses Parallels Virtuozzo Containers with a very limited set of operating systems (Debian, Fedora, Ubuntu, Suse, CentOS) for virtualization . Of the entire list to the soul, nothing is special, but still I chose Debian, which I had to endure until recently. This moment is finding a methodology for installing Gentoo on VDS with this type of virtualization .

    So let's get started

    The first thing that would do well is to do a back-up of existing data, if it is of any value. This is done in the VZPP panel at yourserver_address : 4643 /. Then in the same panel we put VDS into recovery mode and after successful transfer we go through SSH to your VDS. The old file system in recovery mode lies in / repair. First, copy the mtab file from there:
    cp /repair/etc/mtab /root/mtab.old

    If there is any data in the old FS that should be transferred to the new system, we do with Gentoo:
    cd /repair
    mkdir old
    for i in *; do if test old != $i; then mv $i old/; fi; done

    If there is no important data, then we just erase everything:
    cd /repair
    rm -rf *

    If suddenly / repair is read-only (I had OK, but the source mentions what happens sometimes), then before transferring / deleting we do:
    mount -o remount,rw /repair

    Now you are ready to download Gentoo:
    tar xvjpf stage3-*.tar.bz2
    tar xvjf portage-*.tar.bz2 -C /repair/usr
    rm stage3-*.tar.bz2 portage-*.tar.bz2

    Copy the DNS settings and return mtab to its place:
    cp /etc/resolv.conf /repair/etc/
    cp /root/mtab.old /repair/etc/mtab

    Everything is ready for chroot in Gentoo:
    mount -t proc proc /repair/proc/
    mount -o bind /dev /repair/dev
    chroot /repair

    Immediately change the root password:

    The new password will be valid not only for VDS, but also for the control panel. I also copied my key for SSH from the old FS. For download, baselayout + openrc will be used, which must be unmasked and installed (baselayout will pull openrc along with it):
    echo "sys-apps/baselayout ~x86" >> /etc/portage/package.keywords
    echo "sys-apps/openrc ~x86" >> /etc/portage/package.keywords
    emerge baselayout

    Now configure the network:
    emerge iproute2
    cd /etc/init.d
    rm net.eth0
    ln -s net.lo net.venet0
    rc-update add net.venet0 default

    Also add the network configuration to /etc/conf.d/net:
    config_venet0=("87.118.x.z/24" "87.118.y.z/24")
    routes_venet0=(" scope link" "default via")

    And add sshd to autorun:
    rc-update add sshd default

    According to my personal observations, the / etc / network / interfaces file is also necessary for the VDS to start normally (I previously had Debian, maybe the name of the file will be different for other distributions). Virtuozzo is apparently trying to write the current network configuration into it, and if it is not possible to run VDS, it ends in an error. So that:
    mkdir /etc/network
    touch /etc/network/interfaces

    Now you can finally try to reboot ...


    Also popular now: