My notes for building SAMBA 4.20 on a Raspberry Pi 5 (or 4) with 8GB and a 2TB USB HDD.
- Use the Raspberry Pi Imager to install Raspberry Pi OS Lite (64-bit) on to the USB HDD with SSH enabled if configuration is going to be done headless.
- Configure the Raspberry Pi to boot from USB (Pi 4 only - the Pi 5 seems to be able to do it by default).
- Boot the Raspberry Pi from the HDD
- Configure Pi OS to include the en_us.utf8 locale using sudo raspi-config
- Setup some extra swap space because the SAMBA self tests require it.
- Disable swapping and edit the swapfile settings:
sudo dphys-swapfile swapoff
sudo nano /etc/dphys-swapfile - Change CONF_SWAPSIZE to be 81920 and CONF_MAXSWAP to be at least 81920.
This gives a /etc/dphys-swapfile which looks something like:
# where we want the swapfile to be, this is the default
#CONF_SWAPFILE=/var/swap
# set size to absolute value, leaving empty (default) then uses computed value
# you most likely don't want this, unless you have an special disk situation
#CONF_SWAPSIZE=100
#80GB Swap size
CONF_SWAPSIZE=81920
# set size to computed value, this times RAM size, dynamically adapts,
# guarantees that there is enough swap without wasting disk space on excess
#CONF_SWAPFACTOR=2
# restrict size (computed and absolute!) to maximally this limit
# can be set to empty for no limit, but beware of filled partitions!
# this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it
# but is also sensible on 64bit to prevent filling /var or even / partition
#CONF_MAXSWAP=2048
#100GB MAX
CONF_MAXSWAP=102400 - Once that is saved enable swapping:
sudo dphys-swapfile setup; sudo dphys-swapfile swapon
- Disable swapping and edit the swapfile settings:
- Create some of the SAMBA folder structure because the self tests require it
sudo mkdir -p /usr/local/samba/varor maybe there are some environment variables we could set to make the self test fully self contained
sudo chmod o+w,g+w /usr/local/samba/var - Install git and the build essentialssudo apt-get -y update
sudo apt-get -y install git - Clone the SAMBA git repo git clone https://git.samba.org/samba.git
- Check out the required branch cd samba
git checkout samba-4.20.0rc2 - Install the prerequisites cd bootstrap/generated-dists/debian12
sudo ./bootstrap.sh
cd ../../.. - Configure the SAMBA build (include self tests) and to get the config from /etc/samba and to store the local state in /var/samba
./configure --enable-selftest --sysconfdir=/etc/samba --localstatedir=/var/samba --with-ads
- Build SAMBA (using 4 jobs which is OK if swap space has been added otherwise miss off the -j 4)
make -j 4
- Run the self tests to ensure that the build was successful
make quicktestwhich takes about half an hour to run on my Raspberry Pi 5.
- Install SAMBAsudo make install
- Add the SAMBA binaries directory to the path.
export PATH=/usr/local/samba/bin/:/usr/local/samba/sbin/:$PATHAlso remember to alter the system path definition in /etc/profile
See the SAMBA wiki website for more details on how to build SAMBA from source.
No comments:
Post a Comment