this post was submitted on 16 Jun 2024
59 points (100.0% liked)

Selfhosted

40152 readers
605 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I don't have spare peripherals like a monitor and a keyboard. How do you suggest I do a bare-metal install of Debian on a computer (meant to be a server)?

top 50 comments
sorted by: hot top controversial new old
[–] AlexanderESmith@social.alexanderesmith.com 96 points 5 months ago (2 children)

You'll waste more time trying to figure out how to do this than it would take to move a monitor and keyboard to the server, do the install, and plug the monitor and keyboard back into your main computer. Once the server is up, you can administer it over the network via ssh.

[–] tburkhol@lemmy.world 27 points 5 months ago (1 children)

Definitely agree for a single install. If OP has a bunch of these installs to do, then editing an install USB to configure networking and enable sshd might be worth the effort. Do the install over ssh and hope the machine starts up as desired, but even then, if it doesn't just magically appear on the network, he's going to need a monitor to see where the startup failed.

Raspberry Pi's disk imager will let you pre-configure networking, accounts, and ssh, so you just write the image to an SD card, plug it in, and go. That's a great solutions for systems usually meant to be headless and removable media. If OP's client hardware allows, he could plug in the M2 or SATA drive meant to be the server's startup, install Deb there, and. transfer to the server hardware. That's definitely more work that just swapping the keyboard & monitor, but it accomplishes OP's stated goal. (Otherwise, a lot of this thread follows the linux meme of "How do I [X]?" "[X] is dumb, do [Y] instead.")

Agreed on all counts.

My reply initially had a "if you had a fleet of these things..." addendum, but OP's post read (to me) as though he was converting commodity hardware into a makeshift home server, so I removed it because it was almost certainly not relevant.

[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago

True, it's just that I'd like to avoid purchasing more useless stuff. I might move in a few months and maybe carry these computers but I definitely won't be able to take my monitor. Just going to be a waste of money, and I'm trying to be frugal.

I am planning to build a small cheap DIY KVM using PiKVM and cheap Aliexpress parts (Raxda's Zero 3W or the Banana Pi Zero, not sure if they are supported though) in about $25 which I can probably carry around

[–] vk6flab@lemmy.radio 67 points 5 months ago

Also, the word you're looking for is: "headless", as in, "headless install"

[–] Max_P@lemmy.max-p.me 25 points 5 months ago (1 children)

Plug drive in main computer, install Debian on it along with network config and SSH access, put drive back into server and power on.

I guess technically you can also make an ISO that will just auto wipe the drive and install upon booting it but you still need a keyboard to get into the boot menu.

[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago

Yes that's an option I'm looking at. Thanks

[–] notabot@lemm.ee 23 points 5 months ago (2 children)

While I agree with most people here that finding a keyboard and screen would be the easiest option, you do have a couple of other options:

  • Use a preseed file A preseed lets the installer run completely automatically, without user intervention. Get it to install a basic system with SSH and take it from there. You'll want to test the install in a VM, where you can see what's going on before letting it run on the real server. More information here: https://wiki.debian.org/DebianInstaller/Preseed

  • Boot from a live image with SSH Take a look at https://wiki.debian.org/LiveCD in particular 'Debian Live'. It looks like ssh is included, but you'd want to check the service comes up on boot. You can then SSH to the machine and install to the harddrive that way. Again, test on a VM until you know you have the image working, and know how to run the install, then write it to a USB key and boot the tsrget server from that.

This all assumes the target server has USB or CD at the top of its boot order. If it doesn't you'll have to change that first, either with a keyboard and screen, or via a remote management interface sych as IPMI.

[–] lemmyvore@feddit.nl 2 points 5 months ago (2 children)

Once upon a time you could use a thing called debootstrap to install Debian on the hard disk in a chroot on another machine, then switch the hdd to the target machine. Not sure if that thing is still around.

[–] possiblylinux127@lemmy.zip 1 points 5 months ago

You could just use the installer

load more comments (1 replies)
[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago (6 children)

I did look at Preseed and it's probably a good idea if I'm doing many installs at once. I will still look at it but I'll likely have to purchase a monitor anyway. It is unfortunate because I don't have any thrift stores nearby

load more comments (6 replies)
[–] megaman@discuss.tchncs.de 21 points 5 months ago (1 children)

When i was doing a headless install, i spend a hour or two trying to figure out how to pre setup configs for the debian installer or how to do it over network or what before i finally lugged the new machine to the other room and plugged it into the monitor and keyboard of the main rig, installed it all (and set up ssh so i can later get into from the main rig), and unplugged it.

My point is, even if it isnt trivial to have the keyboard and monitor, it may be much easier to get them than to really do an install without them.

[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago

I guess so. It's just going to be junk that I can't take with me when I move though

[–] TCB13@lemmy.world 18 points 5 months ago (1 children)

https://github.com/philpagel/debian-headless

It is possible but I wouldn’t do it. Too much effort for too little result.

Just plug your main monitor / keyboard into the server, run the setup and don’t install a DE. Afterwards login, enable SSH, unplug the monitor and do whatever you need over SSH.

Let’s face it, you’ll have to do this procedure once every xyz years, there’s no point in complicating this stuff. Also depending on your motherboard you may or may not be able to boot into the installer without a screen / keyboard attached. Another option is to install the OS in another computer and the move the hard drive to the target server - this is all fine until you run into UEFI security or another detail and it doesn’t boot your OS.

[–] MigratingtoLemmy@lemmy.world 3 points 5 months ago (4 children)

All I have is a laptop. I'm getting these machines for free from a friend

[–] atzanteol@sh.itjust.works 10 points 5 months ago (1 children)

I picked up a second hand monitor from a goodwill shop for like $7USD. It would be worth having a display of some sort for troubleshooting.

load more comments (1 replies)
[–] catloaf@lemm.ee 9 points 5 months ago (1 children)

You're going to want a monitor and keyboard anyway. It's going to be pretty hard to troubleshoot a boot issue in the future without them.

[–] where_am_i@sh.itjust.works 4 points 5 months ago

yep, a tiny boot error and suddenly you need to punch commands into initramfs. good luck with that headlessly.

[–] hydrogen@lemmy.ml 2 points 5 months ago

Take out the hard drive out of your laptop and put the drive for the server in it, install Debian using the built in monitor and keyboard of your laptop.

load more comments (1 replies)
[–] excel@lemmy.megumin.org 12 points 5 months ago (2 children)

Buy a keyboard and monitor

[–] BrianTheeBiscuiteer@lemmy.world 7 points 5 months ago (1 children)

If OP has a thrift store nearby it's pretty likely they can get both for under $30.

[–] beirdobaggins@lemmy.world 2 points 5 months ago

I bought a 21 inch 1080p Viewsonic monitor from a thrift store just the other day for $6. I got it just for this use case.

I had a spare for this purpose up until about a month ago when the backlight went out on one of my daily drivers.

Also, a couple of days ago I got a pretty nice steelcase apex 3 keyboard with RGB lights for $5.

[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago

No thrift stores nearby though

[–] tal@lemmy.today 8 points 5 months ago* (last edited 5 months ago) (1 children)

I would suggest, unless you have a very unusual situation, that you're going to have an easier time of it with a keyboard and display.

If your computer can do HDMI out, you can use a television as display.

In all seriousness, unless this is some kind of super-exotic situation (like, you're on a sailboat in the middle of the Pacific and are suddenly needing to set up a Debian server) I would probably get an inexpensive USB keyboard to keep around. Even if you don't normally need it (like, you use a laptop or something) there are a number of situations that it solves, like "one of my laptop keys has just stopped working" or "I actually need to work on some kind of computer that doesn't have an integrated keyboard".

kagis

https://www.amazon.com/sgmedila-Waterproof-Foldable-Flexible-Dustproof/dp/B0CXTHH7QS/

That's not gonna be a very pleasant typing experience, but it's under $4 for two, if you're determined to spend as little as possible.

If you can't get access to a television, here's a small, 640x480 USB/HDMI display under $50:

https://www.amazon.com/Capacitive-Compatible-Raspberry-Resolution-Interface/dp/B0CFJDTM5X/

I'd probably get a larger display, maybe used -- I mean, maybe you think that you're never gonna need to look at a computer's output again, but you might find yourself troubleshooting a machine like this one, and 640x480 is a kind of significant limitation -- but that's at least a baseline.

If you specifically don't want a keyboard, and if you have some other device with a display and text input and USB (well, or serial) support, I'd bet that the Debian installer can probably handle an RS-232 serial console install.

kagis

Yup.

https://p5r.uk/blog/2020/instaling-debian-over-serial-console.html

But I'm guessing that you don't have the serial hardware. Having a USB-to-serial adapter is another thing that I keep one of around because every now and then I need to work on headless devices that have a serial interface, but I'll concede that the serial port is getting pretty elderly.

I'd probably get a USB-to-serial male and USB-to-serial female adapter if neither end has an existing serial port (which these days, with desktop hardware, may be very possible). Something like this:

https://www.amazon.com/OIKWAN-Adapter-Converter-Compatible-Windows/dp/B0BL1MRV6H/

and

https://www.amazon.com/Serial-Adapter-Chipset-Compatible-Windows/dp/B0CT8MRT5B/

But then you have to be sure that you can get your machine to boot into the Debian install media. On machines that are designed to be run headless, routers and such, it's common for the BIOS to support a serial interface. On desktop machines...not so much. So if it's already configured to boot off USB, that may be fine, but if it's not, well....

Debian also has a fully-automated installer, as long as you can set your machine up to boot into it without a keyboard or display:

https://wiki.debian.org/FAI

That kind of thing is normally more used to set up VMs or manufacture hardware.

I would be very careful with that thing and probably wipe it after you use it, since it's gonna be a USB key that wipes computers if you reboot and they're set to boot off USB.

It almost certainly isn't a great fit for your use case -- like, the time you're probably going to expend setting it up isn't going to be worth whatever you'd save spending on hardware -- but mentioning it for completeness.

[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago

Thank you, having a serial port would be amazing but unfortunately, unlike UART on microcontrollers I'm using x86. Sometimes I think I should just have stuck to a laptop as a server with some SSDs in it and the other machines being ARM/RISC-V. Definitely would have been more fun

[–] kylian0087@lemmy.dbzer0.com 7 points 5 months ago (1 children)

PXE boot? It must be enable in the bios already. Then you could prep a image and deploy it that way.

[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago

I don't think it's enabled, but I guess I can't check

[–] vk6flab@lemmy.radio 7 points 5 months ago

The traditional way is to use a serial console from another device.

[–] NeoNachtwaechter@lemmy.world 6 points 5 months ago

Usually I want to see the BIOS settings at least once. So that's enough reason to carry a keyboard + monitor there.

Otherwise that network boot option with a TFTP server comes to my mind. But I have never tried it on a new, empty machine.

[–] Nithanim@programming.dev 5 points 5 months ago

My go-to solution is to use a vm and pass it raw access to the os disk on my normal desktop. Then I just put the disk into the server.

[–] rtxn@lemmy.world 4 points 5 months ago* (last edited 5 months ago) (1 children)

If you really, really, really don't want to buy a keyboard and monitor, you can buy a USB KVM console, but it'll likely cost more. Something like this: https://www.startech.com/en-us/server-management/notecons01

[–] MigratingtoLemmy@lemmy.world 1 points 4 months ago

Wow that's expensive. But thanks something to keep in mind. I'm planning to build my own $25 KVM with Chinese parts off of Aliexpress and PiKVM (if that's possible)

[–] jet@hackertalks.com 4 points 5 months ago

Ipmi interface?

[–] changeableface@lemmy.world 3 points 5 months ago* (last edited 5 months ago) (4 children)

I use a KVM over IP.

I made my own tiny pilot device for less than £100 and it has worked flawlessly for a few years.

This assumes your server has a hdmi output, if not you will need a VGA to hdmi or similar converter, danger of it becoming a bit of a hodge-podge of adapters, but hey, if it works, it works!

[–] vividspecter@lemm.ee 2 points 5 months ago* (last edited 5 months ago)

There's a bunch of other variants like PiKVM and BIiKVM as well. Even some cheap knockoffs on Aliexpress that may do the job.

load more comments (3 replies)
[–] possiblylinux127@lemmy.zip 3 points 5 months ago (2 children)

Can you remove the boot disk?

[–] possiblylinux127@lemmy.zip 3 points 5 months ago

Do you have a second computer running Linux? If you do install virtual manager and then pass though the disk. (LUN passthough)

Next boot the VM with the Debian installer and install. Finally shutdown the VM and plug it into the physical device.

[–] MigratingtoLemmy@lemmy.world 2 points 5 months ago (1 children)
[–] JoeKrogan@lemmy.world 2 points 5 months ago (2 children)

Connect it to your PC or laptop and do a netinstall. Configure SSHD and a static ip. Plugin the disk to your server and then connect via ssh to admin it.

You could also set your laptop or PC to boot from the attached disk in the bios to test the services you want to start are starting

[–] MigratingtoLemmy@lemmy.world 2 points 5 months ago

Planning to do that yes

[–] Deckweiss@lemmy.world 2 points 5 months ago* (last edited 5 months ago) (1 children)

Not sure about debian, but the archlinux iso has ssh on per default, so if you have no other bootable drives in your server other than the usb with the iso, just fire it up and try to connect to it via ssh.

[–] MigratingtoLemmy@lemmy.world 2 points 4 months ago

Arch linux install wouldn't be a problem really because the way the install is done. Pretty sure I could it all over SSH. Unfortunately, Debian isn't exactly that..

[–] UnsavoryMollusk@lemmy.world 1 points 4 months ago

A Debian preseed I guess

load more comments
view more: next ›