Building bradnorwiki on old MacBook

From Bradnor
Jump to navigation Jump to search
  1. Install Ubuntu Server
    1. Install Ubuntu server
      Change root password
      sudo passwd root
  2. Enable wifi
    Enabling wifi has to be done on a clean install without any patches, updates or package installations being applied
    Install drivers
    sudo apt update
    sudo apt install firmware-b43-installer
    sudo apt install linux-firmware
  3. Install some utilities
    1. Update and Install emacs and some utilities...
      sudo apt update
      sudo apt upgrade
      sudo apt install emacs
      and to suppress creation of #file# backup files, create .emacs in ~ and /root containing
      ;; backup in one place. flat, no tree structure
      (setq backup-directory-alist '(("" . "~/.emacs.d/backup")))
    2. utilities for amounts others zip, nmcli, ifconfig, sensors and stress
      sudo apt install zip network-manager net-tools lm-sensors stress
      sudo apt install zip
  4. Configure ssh to use keys
    1. copy key to server for ssh client machine
      ssh-copy-id -i ~/.ssh/id_rsa.pub <remote_user>@<remote_host>
    2. check can still login over ssh with key
    3. modify server ssh installation to disable password login
      sudo emacs /etc/ssh/sshd_config
      and add/modify
      PasswordAuthentication no
      PermitRootLogin no
      UsePAM no
    4. restart ssh
      sudo systemctl restart ssh
  5. Power management stuff to allow lid to be closed
    Edit /etc/systemd/logind.conf and modify
    HandleLidSwitch=ignore
    HandleLidSwitchExternalPower=ignore
    HandleLidSwitchDocked=ignore
    and reboot
  6. Screen brightness and therefore Apple logo
    sudo echo 50 | sudo tee /sys/class/backlight/intel_backlight/brightness
    and at start up edit/create a file
    /etc/rc.local
    containing
    #!/bin/bash
    echo 50 | tee /sys/class/backlight/intel_backlight/brightness
    exit 0
    and make it executable
    sudo chmod a+x /etc/rc.local
  7. Fan management
    1. Install management software
      sudo apt install macfanctld
    2. Test by using sensors and stress testing
      then run
      sensors
      to see fan speed on line 'Exhaust  : 5179 RPM ...'
      or use
      sensors | grep -i '\(exhaust\|core \)' ; stress --cpu 2 --timeout 20 ; sensors | grep -i '\(exhaust\|core \)'
  8. Mediawiki
    1. https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Debian_or_Ubuntu
    2. Install the LAMP stack - Apache, MySQL etc
      sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring
    3. and additional bits for mediawiki
      sudo apt-get install php-apcu php-intl imagemagick inkscape php-gd php-cli php-curl php-bcmath git
      sudo systemctl restart apache2
    4. Secure mysql
      sudo mysqladmin -u root password <password>
      sudo mysql_secure_installation
    5. Install automysqlbackup and rsnapshot
      sudo apt install automysqlbackup
      sudo apt install rsnapshot
    6. Set up noip
      Will need to install 'make'
      sudo apt install build-essential
      Download the DUC and save the file to: /usr/local/src
      Open terminal and execute the following:
      cd /usr/local/src
      tar xzf noip-duc-linux.tar.gz
      cd noip-2.1.9-1
      make
      make install
      If the install did not create configuration file then run. You need username/password for noip and port 80 need to be forwarded to the machine
      /usr/local/bin/noip2 -C
      To start at boot time, create a service by creating a file /lib/systemd/system/noip.service containing
      [Unit]
      Description=NOIP dynamic dns updater
      After=multi-user.target
      [Service]
      Type=forking
      ExecStart=/usr/local/bin/noip2 -c /usr/local/etc/no-ip2.conf
      StandardOutput /var/log/noip.log
      [Install]
      WantedBy=multi-user.target
      and enable by
      sudo systemctl enable noip.service
    7. Set up certbot
      https://certbot.eff.org/instructions?ws=apache&os=ubuntufocal
    8. Modify apache config
      1. Create a virtual site for bradnormac.ddns.net
    9. Install and restore mediawiki
      1. Create mysql user
        sudo mysql
        CREATE DATABASE bradnor;
        USE bradnor;
        CREATE USER 'mediawiki'@'localhost' IDENTIFIED BY '<password>';
        GRANT SELECT, INSERT, UPDATE, DELETE ON bradnor.* TO 'mediawiki'@'localhost';
        less secure alternativeGRANT ALL PRIVILEGES ON *.* TO 'mediawiki'@'localhost' IDENTIFIED BY 'password';
      2. Configure PHP
        Edit /etc/php/7.3/apache2/php.ini
        set
        upload_max_filesize = 20M
        memory_limit = 128M