User:Vitrinekast/The ongoing headache of getting an 2012 Macbook Pro to work as a webserver

From XPUB & Lens-Based wiki
< User:Vitrinekast
Revision as of 18:27, 6 March 2024 by Vitrinekast (talk | contribs) (Created page with "This document follows the process of me trying to figure out how to set up a web server on various devices. Please note that this was really not a seamless experience, and every step of the way is just me trying things (over and over again). It’s more written like an ongoing conversation with myself to keep track of things. <span id="things-needed-from-a-web-server"></span> === Things needed from a web server === Check out this explanation, altho it uses apache2 inst...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This document follows the process of me trying to figure out how to set up a web server on various devices. Please note that this was really not a seamless experience, and every step of the way is just me trying things (over and over again). It’s more written like an ongoing conversation with myself to keep track of things.

Things needed from a web server

Check out this explanation, altho it uses apache2 instead of nginx How to host your website on an old Mac mini with SSL | by Roland Treiber | Geek Culture | Medium

  1. SSH into it
  2. SSh from a different location
  3. ftp access?
  4. uploading files to a web directory
  5. being able to reach those files
  6. PHP enabled
  7. DNS
  8. Mail
  9. Do not shut down when lid is closed

i’ve by now installed debian 12, and need to install a package without internet. i’ve put it on a usb stick

  1. to mount the usb stick to the mac
    1. lsblk to list all devices
    2. mkdir /media/usb-drive
    3. mount /dev/{name} /media/usb-drive/
  2. now we need to run the deb file using dpkg
    1. dpkg -i {package}.deb dont forget to sudo umount /media/usb

but now i get

dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.

so i did

su -

but it depends on wget so i cant install it as i have no internet :(

so lets try to get internet by downloading the networkmanager

which needed many many dependencies dependant on dependencies…

oh, but apperantly networkManager is already installed? After I ran systemctl status NetworkManager it showed as inactive, so i restarted it using restart.

systemctl enable NetworkManager

im now installing zlibnm0_1.46.0-1_amd64.deb, which is needed to run nmcli?

so, that helped. now i can see that the wifi is on but when running nmcli dev wifi list its still not showing any wifi spots according to the internet i need to sudo systemctl start wpa_supplicant.service. but ofcourse, wpa_supplicant.service is not found…

this is getting so chaotic

installed wireless tools

iwlist wlan0 scan

but this doesn’t support scanning..

And then I accidentally deleted the /usr folder, which broke the entire system. I couldn’t even ls anymore!

Michael left a usb stick on the laptop with a new installation of debian 12. I’ve installed this one on the macbook, but keep running in the same issues. By now, I have gotten fast in mounting and unmounting USB sticks and manually downloading packages (that need packages and packages and packages).

Apparently I’m in need of specific non-free (free as in libre?) frameworks for the wifi card to work, but these honestly needed so many dependencies that needed to be manually downloaded one by one, that I gave up and went home.

Not the most seamless experience, and especially not the most empowering one (so far).

!!!! Reverted so many things, installed Ubuntu server via the USB→ ethernet dongle of Michael, and now there is a server that can be ssh’d into! some things

  • ☐ the ip address keeps changing. how to make this stay the same?
  • ☐ how to get wifi with eduroam to work?
    • ☐ Fix this warning: Permissions for /etc/netplan/50-cloud-init.yaml are too open. Netplan configuration should NOT be accessible by others.
  • ☐ Set the correct timezone
  • ☐ resize terminal text size

How do i get the wifi of eduroam to work?

according to this gist, i need to create /etc/netplan/50-cloud-init.yaml. with the following setup

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true

    wifis:
        wlan0:
            dhcp4: true
            access-points:
                "eduroam":
                    auth:
                      key-management: eap
                      password: "your password"
                      method: ttls
                      identity: "number@hr.nl"
                      phase2-auth: "MSCHAPV2"
    version: 2
    

and then run sudo netplan --debug apply to apply the setup. the debug does show this warning, so i need to do something about it:

** (process:1657): **WARNING** **: 12:17:05.453: Permissions for /etc/netplan/50-cloud-init.yaml are too open. Netplan configuration should NOT be accessible by others.

according to the logs, wpa_supplicant is created. but then: `A dependency job for netplan-wpa-wlan0.service failed. See 'journalctl -xe' for details.` and the apply is failed..

journalctl -xe returns

Mar 06 12:18:35 vitrinekast systemd[1]: **sys-subsystem-net-devices-wlan0.device: Job sys-subsystem-net-devices-wlan0.device/start timed out.**

Mar 06 12:18:35 vitrinekast systemd[1]: **Timed out waiting for device /sys/subsystem/net/devices/wlan0.**

Did some searching, and removed this whole thing to try something else

installed NetworkManager to be able to run nmcli d. It is so much better to do this with an internet connection!

**rosa@vitrinekast**:**~**$ nmcli d

DEVICE           TYPE      STATE         CONNECTION 

wlp3s0           wifi      disconnected  --         
enx00249c032885  ethernet  unmanaged     --         
lo               loopback  unmanaged     --         

**rosa@vitrinekast**:**~**$

then I turn the wifi on by nmcli r wifi on. listing the available networks by running nmcli d wifi list returns loads of Tesla wifi networks! But also some eduroam.

nmcli d wifi connect my_wifi password <password>

gives Error: Failed to add/activate new connection: Failed to determine AP security information

According to stack exchange i need to

nmcli connection add \
 type wifi con-name "MySSID" ifname wlp3s0 ssid "MySSID" -- \
 wifi-sec.key-mgmt wpa-eap 802-1x.eap ttls \
 802-1x.phase2-auth mschapv2 802-1x.identity "USERNAME" 

Turns into

sudo nmcli connection add \
 type wifi con-name eduroam ifname wlp3s0 ssid eduroam -- \
 wifi-sec.key-mgmt wpa-eap 802-1x.eap ttls \
 802-1x.phase2-auth mschapv2 802-1x.identity 1032713@hr.nl

then you shouldn’t unplug the usb ethernet thing and expect it to work right away (s.o.) but rather sudo nmcli c up eduroam --ask and fill in the eduroam login details there.

But, the wifi SSD apparently is incorrect?