Building bradnorwiki on old MacBook: Difference between revisions

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

Revision as of 11:33, 4 January 2026

Install Ubuntu Server

Install Ubuntu server
Change root password
sudo passwd root

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

Install some utilities

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")))
utilities for amongst others zip, nmcli, ifconfig, sensors and stress
sudo apt install zip network-manager net-tools lm-sensors stress
sudo apt install zip

Configure ssh to use keys

copy key to server for ssh client machine
ssh-copy-id -i ~/.ssh/id_rsa.pub <remote_user>@<remote_host>
check can still login over ssh with key
modify server ssh installation to disable password login
sudo emacs /etc/ssh/sshd_config
and add/modify
PasswordAuthentication no
PermitRootLogin no
UsePAM no
restart ssh
sudo systemctl restart ssh

Power management stuff to allow lid to be closed

Edit /etc/systemd/logind.conf and modify
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
and reboot
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

Fan management

Install management software
sudo apt install macfanctld
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 \)'

Mediawiki

https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Debian_or_Ubuntu
Install the LAMP stack - Apache, MySQL etc
sudo apt-get install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring

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
Secure mysql
sudo mysqladmin -u root password <password>
sudo mysql_secure_installation

Install automysqlbackup and rsnapshot

sudo apt install automysqlbackup
sudo apt install rsnapshot

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

Set up certbot

https://certbot.eff.org/instructions?ws=apache&os=ubuntufocal

Modify apache config=

Create a virtual site for bradnormac.ddns.net
Install and restore mediawiki
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 alternative GRANT ALL PRIVILEGES ON *.* TO 'mediawiki'@'localhost' IDENTIFIED BY 'password';

'Configure PHP=

Edit /etc/php/7.3/apache2/php.ini
set
upload_max_filesize = 20M
memory_limit = 128M