Advertisement
metalx1000

Nextcloud Install and setup

Feb 17th, 2023 (edited)
1,858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.87 KB | None | 0 0
  1. nextcloud_url="https://download.nextcloud.com/server/releases/nextcloud-28.0.2.zip"
  2. password="ksjdvjds234SDf"
  3. sudo apt update -y
  4. sudo apt install -y apache2 mariadb-server mariadb-client
  5.  
  6. #make sure your port is open (required on some VPS)
  7. iptables -A INPUT -p tcp --dport 80 -j ACCEPT
  8. iptables -A INPUT -p tcp --dport 443 -j ACCEPT
  9.  
  10. sudo apt install -y libapache2-mod-php php php-gd
  11. sudo apt install -y php-mysql php-curl php-zip php-dom php-xml php-simplexml php-mbstring
  12.  
  13. sudo mysql -uroot -e "CREATE DATABASE nextclouddb;"
  14. sudo mysql -uroot -e "GRANT ALL ON nextclouddb.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY '$password';"
  15. sudo mysql -uroot -e "FLUSH PRIVILEGES;"
  16.  
  17. cd /tmp
  18. #
  19. wget "$nextcloud_url"
  20.  
  21. cd /var/www/html
  22. sudo unzip /tmp/nextcloud-*.zip
  23. sudo chown -R www-data:www-data nextcloud
  24. sudo chmod -R 755 nextcloud
  25.  
  26. #setup SSL with CERTBOT
  27. sudo apt install -y certbot python3-certbot-apache
  28. sudo certbot --apache
  29.  
  30. #get ip address
  31. ip="$(ip a|grep inet |grep enp|awk '{print $2}'|cut -d\/ -f1)"
  32. echo "$ip"
  33. echo "http://$ip/nextcloud"
  34.  
  35.  
  36. #if you get module errors just reboot
  37. sudo reboot
  38.  
  39.  
  40. echo "nextclouddb"
  41. echo "nextcloud_user"
  42. echo "$password"
  43.  
  44. #tweaks
  45. config="$(find /etc/php/ -name php.ini|grep apache|head -n1)"
  46. sudo sed -i 's/memory_limit = 128M/memory_limit = 512M/g' "$config"
  47. sudo sed -i 's/output_buffering = 4096/output_buffering = off/g' "$config"
  48. sudo systemctl restart apache2
  49.  
  50.  
  51. sudo vim /etc/apache2/apache2.conf
  52. #change
  53. <Directory /var/www/>
  54.         Options Indexes FollowSymLinks
  55.         AllowOverride None
  56.         Require all granted
  57. </Directory>
  58. #to
  59. <Directory /var/www/>
  60.         Options Indexes FollowSymLinks
  61.         AllowOverride All
  62.         Require all granted
  63. </Directory>
  64.  
  65. #APPS
  66. nextcloud office & collab
  67. sudo -u www-data php -d memory_limit=512M /var/www/html/nextcloud/occ app:install richdocumentscode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement