urbackup.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/sh
  2. echo -e '
  3. _ _ _ _ ___ _ _ _
  4. | | | |_ _| |__ __ _ __| |___ _ _ __ / __| | (_)___ _ _| |_
  5. | |_| | _| _ \/ _` / _| / / || | _ \ | (__| |__| / -_) \ _|
  6. \___/|_| |_.__/\__,_\__|_\_\\_,_| .__/ \___|____|_\___|_||_\__|
  7. |_|
  8. '
  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. apk add linux-headers "g++" zlib zlib-dev "crypto++@testing" "crypto++-dev@testing" make
  31. ln -s /usr/lib/libcryptopp.so /usr/lib/libcryptopp.so.5.6
  32. # Download the UrBackup client source files and extract them
  33. # wget -P /tmp/ https://hndl.urbackup.org/Client/latest/urbackup-client-2.3.4.0.tar.gz
  34. # wget -P /tmp/ https://hndl.urbackup.org/Client/2.4.8/urbackup-client-2.4.8.0.tar.gz
  35. wget -P /tmp/ https://hndl.urbackup.org/Client/2.4.10/urbackup-client-2.4.10.0.tar.gz
  36. cd /tmp
  37. # tar xzf /tmp/urbackup-client-2.3.4.0.tar.gz
  38. tar xzf /tmp/urbackup-client-2.4.10.0.tar.gz
  39. # Build the UrBackup client and install it
  40. # cd /tmp/urbackup-client-2.3.4.0
  41. cd /tmp/urbackup-client-2.4.10.0
  42. ./configure --enable-headless
  43. make -j4
  44. make install
  45. # Make sure that the UrBackup client backend runs correctly
  46. # urbackupclientbackend -v info
  47. # configure
  48. echo -n "Please provide the urbackup-server's ip : "
  49. read _ip
  50. # echo -n "Please provide the internet_authkey of server : "
  51. # read _authkey
  52. # echo -n "Please provide the computer name of this client : "
  53. # read _computername
  54. _computername=$HOSTNAME
  55. # internet_authkey=$_authkey
  56. echo "internet_server=$_ip
  57. internet_server_port=55415
  58. internet_mode_enabled=true
  59. internet_image_backups_def=false
  60. default_dirs_def=/etc;/var/www;/var/backups/mysql
  61. startup_backup_delay_def=3
  62. computername=$_computername" > /etc/conf.d/urbackupclient
  63. # /usr/local/var/urbackup/data/settings.cfg
  64. # firewall
  65. ufw allow from "$_ip" to any port 35621
  66. ufw allow from "$_ip" to any port 35622
  67. ufw allow from "$_ip" to any port 35623
  68. # install and enable openrc service
  69. cp "$_assets"/urbackup.service /etc/init.d/urbackup
  70. chmod a+x /etc/init.d/urbackup
  71. rc-update add urbackup
  72. service urbackup start
  73. cd "$_cwd"