This Article is Under Construction!

Difference between revisions of "NextCloud/Installation"

From SETV Springfield Technical Wiki
Jump to: navigation, search
m
m (CITES)
Line 21: Line 21:
 
|}
 
|}
 
  sysrc 'php_fpm_enable=YES' 'mysql_enable=YES' 'redis_enable=YES'
 
  sysrc 'php_fpm_enable=YES' 'mysql_enable=YES' 'redis_enable=YES'
Enable PHP 7 in httpd
+
Enable PHP 7 in httpd (we will deal with FPM later)
  
 
https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/
 
https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/
Line 53: Line 53:
 
  <code># touch /usr/local/etc/apache24/modules.d/001_mod_php.conf</code>
 
  <code># touch /usr/local/etc/apache24/modules.d/001_mod_php.conf</code>
 
<code># nano /usr/local/etc/apache24/modules.d/001_mod_php.conf</code>
 
<code># nano /usr/local/etc/apache24/modules.d/001_mod_php.conf</code>
  <code><FilesMatch "\.php$"></code>
+
  <code><FilesMatch "\.php$"></code> <code>SetHandler application/x-httpd-php</code>  
  <code>SetHandler application/x-httpd-php</code>  
 
 
  <code></FilesMatch></code>  
 
  <code></FilesMatch></code>  
 
  <code><FilesMatch "\.phps$"></code>
 
  <code><FilesMatch "\.phps$"></code>
Line 89: Line 88:
 
  # Create New Schema for Nextcloud
 
  # Create New Schema for Nextcloud
 
  CREATE DATABASE nextcloud;
 
  CREATE DATABASE nextcloud;
  # Create New Admin User for Nextcloud
+
  <nowiki>#</nowiki> Create New Admin User for Nextcloud
  CREATE USER 'nextcloud_admin'@'localhost' IDENTIFIED BY '$OTHER_NEW_PASSWORD';
+
  CREATE USER 'nextcloud_admin'@'localhost' IDENTIFIED BY 'NeXtCl0UD12#$';
  # Grant Permissions to the new Admin user to the Nextcloud Schema
+
  <nowiki>#</nowiki> Grant Permissions to the new Admin user to the Nextcloud Schema
 
  GRANT ALL ON nextcloud.* TO 'nextcloud_admin'@'localhost';
 
  GRANT ALL ON nextcloud.* TO 'nextcloud_admin'@'localhost';
  # Refresh all Privileges
+
  <nowiki>#</nowiki> Refresh all Privileges
 
  FLUSH PRIVILEGES;
 
  FLUSH PRIVILEGES;
 +
exit
 +
Configure REDIS <ref>https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/</ref>
 +
 +
Update <code>/usr/local/etc/redis.conf</code> to run on local socket
 +
 +
Find "port" and change it to 0
 +
 +
Find and replace:
 +
<code>unixsocket /tmp/redis.sock</code>
 +
<code>unixsocketperm 750</code>
 +
sysrc redis_enable=yes
 +
 +
service redis start
 +
 +
Run  <code>ls -al /tmp</code> to run on local socket, you should see redis.sock and mysql.sock in the list.
 +
 +
Installing Next Cloud
 +
 +
Download in apache data dir /usr/local/www/apache24/data/
 +
 +
Extract
 +
chown -R www:www /usr/local/www/apache24/data/nextcloud /mnt/files
 +
 +
 +
 +
Add virtual Host info
 +
 +
 +
<VirtualHost *:80>
 +
  DocumentRoot "/usr/local/www/apache24/data/nextcloud"
 +
  ServerName cloud.ssdcougars.tv
 +
#  RewriteEngine on
 +
#  RewriteCond %{SERVER_NAME} =cloud.ssdcougars.tv
 +
#  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
 +
  #ErrorLog ${APACHE_LOG_DIR}/error.log
 +
  #CustomLog ${APACHE_LOG_DIR}/access.log combined
 +
<Directory /usr/local/www/apache24/data/nextcloud/>
 +
  Options +FollowSymlinks
 +
  AllowOverride All
 +
  <IfModule mod_dav.c>
 +
  Dav off
 +
  </IfModule>
 +
  SetEnv HOME /var/www/nextcloud
 +
  SetEnv HTTP_HOME /var/www/nextcloud
 +
  Satisfy Any
 +
</Directory>
 +
</VirtualHost>
 +
 +
  
 
===== CITES =====
 
===== CITES =====

Revision as of 03:13, 17 September 2016


Install nano, wget and enable SSH

Install modifued LAMP

F A M P: FreeBSD, Apache, MariaDB, PHP 7

DigitalOcean Guide up until MySQL

pkg install mariadb101-server

 sysrc mysql_enable=yes
 service mysql-server start
mysql_secure_installation

Install PHP 7

pkg install redis php70-bz2 php70-ctype php70-curl php70-dom php70-exif php70-fileinfo php70-filter php70-gd php70-hash php70-iconv php70-intl php70-json php70-mbstring php70-mcrypt php70-pdo_mysql php70-openssl php70-posix php70-session php70-simplexml php70-xml php70-xmlreader php70-xmlwriter php70-xsl php70-wddx php70-zip php70-zlib php70-APCu php70-redis
sysrc 'php_fpm_enable=YES' 'mysql_enable=YES' 'redis_enable=YES'

Enable PHP 7 in httpd (we will deal with FPM later)

https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/

Configure Apache

Ensure that the rewrite and ssl modules are enabled (uncommented) in /usr/local/etc/apache24/httpd.conf.

# /usr/local/etc/apache24/httpd.conf 
... 
LoadModule ssl_module libexec/apache24/mod_ssl.so 
LoadModule rewrite_module libexec/apache24/mod_rewrite.so 

Remove php5 add php7: [1]

  • LoadModule php5_module  libexec/apache24/libphp5.so  << remove this
  • LoadModule php7_module  libexec/apache24/libphp7.so << add this

Fix httpd.conf again [2]

Right after libphp7.so line add

<IfModule php5_module>
   <FilesMatch "\.(php|phps|php5|phtml)$">
       SetHandler php5-script
   </FilesMatch>
   DirectoryIndex index.php
</IfModule>

Then FIND <IFModule mime_module>

Insert Right After:

    AddType application/x-httpd-php-source .phps    
    AddType application/x-httpd-php        .php

Add a PHP handler to /usr/local/etc/apache24/modules.d

# touch /usr/local/etc/apache24/modules.d/001_mod_php.conf

# nano /usr/local/etc/apache24/modules.d/001_mod_php.conf

<FilesMatch "\.php$">  SetHandler application/x-httpd-php 
</FilesMatch> 
<FilesMatch "\.phps$">
  SetHandler application/x-httpd-php-source 
</FilesMatch>
service apache24 restart

nano /usr/local/etc/php.ini

find "cgi.fix_pathinfo" change from =0 to =1

find "date.timezone" Change to your timezone (America/New_York)

find "post_max_size" change it to 1999M

find "upload_max_size" change to 1999M

Save

restart apache

Now test with PHPINFO

Place phpinfo.php in usr/local/www/apache24/data

If you get the info page youre almost done

Loginto MYSQL

mysql -u root -p

enter password you made for root during setup

# Create New Schema for Nextcloud
CREATE DATABASE nextcloud;
# Create New Admin User for Nextcloud
CREATE USER 'nextcloud_admin'@'localhost' IDENTIFIED BY 'NeXtCl0UD12#$';
# Grant Permissions to the new Admin user to the Nextcloud Schema
GRANT ALL ON nextcloud.* TO 'nextcloud_admin'@'localhost';
# Refresh all Privileges
FLUSH PRIVILEGES;
exit

Configure REDIS [3]

Update /usr/local/etc/redis.conf to run on local socket

Find "port" and change it to 0

Find and replace:

unixsocket /tmp/redis.sock 
unixsocketperm 750

sysrc redis_enable=yes

service redis start

Run  ls -al /tmp to run on local socket, you should see redis.sock and mysql.sock in the list.

Installing Next Cloud

Download in apache data dir /usr/local/www/apache24/data/

Extract

chown -R www:www /usr/local/www/apache24/data/nextcloud /mnt/files


Add virtual Host info


<VirtualHost *:80>
 DocumentRoot "/usr/local/www/apache24/data/nextcloud"
 ServerName cloud.ssdcougars.tv
#   RewriteEngine on
#   RewriteCond %{SERVER_NAME} =cloud.ssdcougars.tv
#   RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
 #ErrorLog ${APACHE_LOG_DIR}/error.log
 #CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /usr/local/www/apache24/data/nextcloud/>
 Options +FollowSymlinks
 AllowOverride All
 <IfModule mod_dav.c>
 Dav off
 </IfModule>
 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud
 Satisfy Any
</Directory>
</VirtualHost>


CITES

https://www.digitalocean.com/community/tutorials/how-to-install-an-apache-mysql-and-php-famp-stack-on-freebsd-10-1

https://www.linuxbabe.com/cloud-storage/setup-nextcloud-server-ubuntu-16-04-apache-mariadb-php7

https://forums.freenas.org/index.php?threads/how-to-owncloud-using-nginx-php-fpm-and-mysql.17786/

https://forums.freenas.org/index.php?threads/drkks-definitive-guide-to-installing-owncloud-in-freenas-or-freebsd.19605/

  1. https://kdenby.homelinux.com/?p=208
  2. http://serverfault.com/questions/646333/apache-24-not-serving-php-on-freebsd-10
  3. https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/