Time Machine is a simple backup software in Apple’s Mac OS, “it automatically saves up-to-date copies of everything on Mac such as photos, music, videos, documents, applications, and settings.Time Machine works with an external hard drive or Apple Time Capsule using wireless”
Setting up an Ubuntu machine to act as an Apple Time Machine server is surprisingly simple.
Install the needed packages
sudo apt install netatalk avahi-daemon
Edit the netatalk config file
sudo nano /etc/netatalk/afp.conf
Add a section for your Time Machine
[Time Machine] path = /srv/timemachine time machine = yes
Create a directory to act as the Time Machine drive
sudo mkdir -p /srv/timemachine
sudo chown nobody:nogroup /srv/timemachine
sudo chmod 777 /srv/timemachine
sudo service netatalk restart
Once your drive is set up, go to Mac and open a Finder. Under the Network section, you should see your Ubuntu machine listed. Double-click on the name, and you should see any shared folders on the machine. Once you are logged in, you should then be able to use the drive with Time Machine.
Now, on Mac, you should be able to open the Time Machine settings in System Preferences and use Select Disk… to pick your new Time Machine backup drive.