4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

Overwriting a VPS Default Install Using Swap

![1000px-Tux.svg.png](https://gateway.ipfs.io/ipfs/Qma7MYvjUop3fDz4x6iQnq79KdAk5oH6e6jzR4aFRV1uAF)

The Default

I rent a few VPS from a provider and I don't like their default install image at all.

The partitions are setup in silly ways, I don't trust some of the things they've done to the image, etc.

Starting off they have a /, /boot/, and swap partition to work with.

Luckily this, plus access to the client's GRUB on startup, gives us everything we need to overwrite the system remotely.

Time to swap it back and forth

Once logged in we deactivate the swap partition so that we can use it as a landing zone. ![Screenshot_2018-04-16_23-43-10.png](https://gateway.ipfs.io/ipfs/QmS48qsATdMdAQVvwb49hxk45hscC8JKWbmDbqiyJKdUKY)

I format it to ext4, doesn't really matter so long as it's not swap and readable by GRUB,
image.png

Then mount it somewhere and cd to it.
image.png

We download our fresh mini.iso into the new space. I host mine myself for simplicity.
GIFrecord_2018-04-16_235459.gif

We're done with this image, time to blow this sucka' away!
I do a hard reboot in the console and go to the GRUB commandline.

We can settle this land

image.png
Using the grub commands we can load the mini.iso that we just downloaded, and tell grub where the linux and initrd are.
After that we can boot and it should take us to the mini-install.

image.png

A new installation is like slipping into a warm bath.

From here on out it should act like a normal installation. The mini.iso is loaded into memory so you don't have to keep the /dev/sda2 partition hanging around.

GIFrecord_2018-04-17_001242.gif
GIFrecord_2018-04-17_001714.gif

Obliterating the old sda partitions including our mini.iso, there's no turning back now...

![GIFrecord_2018-04-17_001957.gif](https://gateway.ipfs.io/ipfs/QmTak2mSdfUFFYjZXG8VrhMrTpFXjBdbbEzhodoxCm734o) ![GIFrecord_2018-04-17_002231.gif](https://gateway.ipfs.io/ipfs/QmbyQ5zWdNbkbVdeLYg93g7CgR3W1syKuHxwhqKjahucfG)

Select some base packages, openssh is helpful for remote machines :)
GIFrecord_2018-04-17_003419.gif

And that's about it! By the end if all goes well through installation there should be a fresh copy of linux (ubuntu server in this case) on the machine ready for you to do some work.

image.png

Tux image from: https://commons.wikimedia.org

45 upvotes $1.35

Replies (1)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: