urbackup.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/sh
  2. echo -e '\033[35m
  3. _ _ _ _ ___ _ _ _
  4. | | | |_ _| |__ __ _ __| |___ _ _ __ / __| | (_)___ _ _| |_
  5. | |_| | _| _ \/ _` / _| / / || | _ \ | (__| |__| / -_) \ _|
  6. \___/|_| |_.__/\__,_\__|_\_\\_,_| .__/ \___|____|_\___|_||_\__|
  7. |_|
  8. \033[0m'
  9. if [ "$EUID" -ne 0 ]; then
  10. echo "Please run as root"
  11. exit
  12. fi
  13. # get the current position
  14. _cwd="$(pwd)"
  15. # check for assets forlder
  16. _assets="$_cwd/assets"
  17. if [ ! -d "$_assets" ]; then
  18. _assets="$_cwd/../assets"
  19. if [ ! -d "$_assets" ]; then
  20. echo "!! can't find assets directory !!"
  21. exit
  22. fi
  23. fi
  24. # install urbackup client
  25. # https://www.urbackup.org/client_debian_ubuntu_install.html
  26. # https://blog.stephane-huc.net/systeme/debian/urbackup_client_gui
  27. # https://urbackup.atlassian.net/wiki/spaces/US/pages/9142274/Headless+Linux+client+setup
  28. # Install the dependencies UrBackup needs
  29. apt install build-essential "g++" "libcrypto++-dev" libz-dev -y
  30. # libwxgtk3.0-dev
  31. # Download the UrBackup client source files and extract them
  32. # wget -P /tmp/ https://hndl.urbackup.org/Client/latest/urbackup-client-2.3.4.0.tar.gz
  33. wget -P /tmp/ https://hndl.urbackup.org/Client/2.4.11/urbackup-client-2.4.11.0.tar.gz
  34. cd /tmp
  35. # tar xzf /tmp/urbackup-client-2.3.4.0.tar.gz
  36. tar xzf /tmp/urbackup-client-2.4.11.0.tar.gz
  37. # Build the UrBackup client and install it
  38. # cd /tmp/urbackup-client-2.3.4.0
  39. cd /tmp/urbackup-client-2.4.11.0
  40. ./configure --enable-headless
  41. make -j4
  42. make install
  43. # Make sure that the UrBackup client backend runs correctly
  44. # urbackupclientbackend -v info
  45. # configure
  46. echo -n "Please provide the urbackup-server's ip : "
  47. read _ip
  48. echo -n "Please provide the internet_authkey of server : "
  49. read _authkey
  50. echo -n "Please provide the computer name of this client : "
  51. read _computername
  52. echo "internet_server=$_ip
  53. internet_server_port=55415
  54. internet_authkey=$_authkey
  55. internet_mode_enabled=true
  56. internet_image_backups_def=false
  57. default_dirs_def=/etc;var/www;/var/backups/mysql
  58. startup_backup_delay_def=3
  59. computername=$_computername" > /usr/local/var/urbackup/data/settings.cfg
  60. # firewall
  61. ufw allow from "$_ip" to any port 35621
  62. ufw allow from "$_ip" to any port 35622
  63. ufw allow from "$_ip" to any port 35623
  64. # install and enable systemd service
  65. cp "$_assets"/urbackup.service /etc/systemd/system/
  66. chmod a+x /etc/systemd/system/urbackup.service
  67. systemctl --system daemon-reload
  68. systemctl start urbackup.service
  69. systemctl enable urbackup.service