Building bradnorwiki on old MacBook: Difference between revisions

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

Latest revision as of 11:16, 28 February 2026

⇐ Notes

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 copy to OneDrive to be written

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