Difference between revisions of "NextCloud/Installation"
m (Tag: Visual edit) |
m (Tag: Visual edit) |
||
Line 11: | Line 11: | ||
== Setting Up Jail == | == Setting Up Jail == | ||
− | === Create Dataset<ref>https://forums.freenas.org/index.php?threads/how-to-owncloud-using-nginx-php-fpm-and-mysql.17786/</ref> === | + | === Create Dataset<ref name=":0">https://forums.freenas.org/index.php?threads/how-to-owncloud-using-nginx-php-fpm-and-mysql.17786/</ref> === |
Within FreeNAS Userspace: | Within FreeNAS Userspace: | ||
Line 97: | Line 97: | ||
We will install each part of FAMP one-by-one. FreeBSD is the Operating system so check! | We will install each part of FAMP one-by-one. FreeBSD is the Operating system so check! | ||
− | === Apache 2.4 === | + | === Apache 2.4 <ref>https://www.digitalocean.com/community/tutorials/how-to-install-an-apache-mysql-and-php-famp-stack-on-freebsd-10-1</ref> === |
− | Install | + | ====== Install ====== |
+ | $ pkg install apache24 | ||
+ | |||
+ | ====== Setup in rc.conf ====== | ||
+ | $ sysrc apache24_enable=yes | ||
+ | |||
+ | ====== Start Apache ====== | ||
+ | $ service apache24 start | ||
+ | |||
+ | ====== Check that it works ====== | ||
+ | Navigate to http://10.130.12.191 and you should see the text "It Works!" | ||
+ | |||
+ | === MariaDB 10.1 <ref name=":1" /> === | ||
+ | |||
+ | ====== Install ====== | ||
+ | [[File:MySQL Setup.png|thumb|MySQL Secure Setup ]] | ||
+ | $ pkg install mariadb101-server | ||
+ | |||
+ | ==== Setup in rc.conf ==== | ||
+ | $ sysrc mysql_enable=yes | ||
− | + | ====== Run Wizard Script ====== | |
+ | $ mysql_secure_installation | ||
− | + | ====== Read and follow prompts. There is no root password set, and answer Y to all the following questions. ====== | |
− | + | ====== Login to MySQL, create Nextcloud DB and User ====== | |
+ | $ mysql -u root -p | ||
+ | enter password you made for root during setup. | ||
− | + | Enter each of these commands one-by-one, and make sure to include the semi-colon ; | |
− | |||
− | + | CREATE DATABASE nextcloud; | |
+ | |||
+ | CREATE USER 'nextcloud_admin'@'localhost' IDENTIFIED BY 'MAKEUP-YOUR-OWN-PASSWORD'; | ||
+ | |||
+ | GRANT ALL ON nextcloud.* TO 'nextcloud_admin'@'localhost'; | ||
+ | |||
+ | FLUSH PRIVILEGES; | ||
+ | |||
+ | exit | ||
+ | Replace MAKEUP-YOUR-OWN-PASSWORD with a password of your choosing. You need this for the NextCloud setup. | ||
− | + | === PHP 7.0 === | |
− | Install PHP | + | ====== Install PHP and associated modules<ref name=":0" /> ====== |
{| class="wikitable" | {| class="wikitable" | ||
|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 | |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 | + | sysrc 'mysql_enable=YES' 'redis_enable=YES' |
− | + | ||
+ | ====== Configuring Apache for PHP7 ====== | ||
+ | Ensure that the rewrite and ssl modules are enabled (uncommented) in <code>/usr/local/etc/apache24/httpd.conf</code>. | ||
− | + | CREATE DATABASE nextcloud; | |
+ | $ cd /usr/local/etc/apache24/ | ||
+ | $ nano httpd.conf | ||
+ | Search the conf file for "ssl_module" | ||
+ | ctrl+w | ||
+ | ssl_module | ||
+ | ENTER | ||
+ | Uncomment (delete the <code>#</code> at the start of the line) so it looks like this: | ||
+ | LoadModule ssl_module libexec/apache24/mod_ssl.so | ||
+ | Repeat for | ||
− | + | <code>LoadModule rewrite_module libexec/apache24/mod_rewrite.so</code> | |
− | + | '''Remove php5 add php7:''' <ref>https://kdenby.homelinux.com/?p=208</ref> <ref>http://serverfault.com/questions/646333/apache-24-not-serving-php-on-freebsd-10</ref> | |
− | + | * Find & Remove this >> LoadModule php5_module libexec/apache24/libphp5.so | |
− | + | * Replace with >> LoadModule php7_module libexec/apache24/libphp7.so | |
− | |||
− | |||
− | '''Remove php5 add php7:''' <ref>https://kdenby.homelinux.com/?p=208</ref> | ||
− | |||
− | |||
− | |||
Right after libphp7.so line add | Right after libphp7.so line add | ||
Line 145: | Line 180: | ||
Insert Right After: | Insert Right After: | ||
− | + | ||
− | + | <code>AddType application/x-httpd-php-source .phps</code> | |
+ | |||
+ | <code>AddType application/x-httpd-php .php</code> | ||
Add a PHP handler to <code>/usr/local/etc/apache24/modules.d</code> | Add a PHP handler to <code>/usr/local/etc/apache24/modules.d</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>SetHandler application/x-httpd-php</code> | ||
+ | <code></FilesMatch></code> | ||
+ | <code><FilesMatch "\.phps$"></code> | ||
+ | <code>SetHandler application/x-httpd-php-source</code> | ||
+ | <code></FilesMatch></code> | ||
+ | <code></IfModule></code> | ||
<code>service apache24 restart</code> | <code>service apache24 restart</code> | ||
nano /usr/local/etc/php.ini | nano /usr/local/etc/php.ini | ||
Line 177: | Line 218: | ||
If you get the info page youre almost done | If you get the info page youre almost done | ||
+ | |||
+ | Enable PHP 7 in httpd (we will deal with FPM later) | ||
+ | |||
+ | 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 | ||
+ | |||
+ | I | ||
+ | |||
+ | https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/ | ||
Loginto MYSQL | Loginto MYSQL | ||
Line 193: | Line 255: | ||
FLUSH PRIVILEGES; | FLUSH PRIVILEGES; | ||
exit | exit | ||
− | Configure REDIS <ref>https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/</ref> | + | Configure REDIS <ref name=":1">https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/</ref> |
Update <code>/usr/local/etc/redis.conf</code> to run on local socket | Update <code>/usr/local/etc/redis.conf</code> to run on local socket |
Revision as of 04:16, 17 September 2016
This guide was written for the custom installation of NextCloud on a FreeNAS Jail. This guide assumes:
You have not set up a jail
You have already set up a Cloud volume under Storage
You have Jails configured
Contents
Setting Up Jail
Create Dataset[1]
Within FreeNAS Userspace:
Storage > Create ZFS Dataset
- Dataset Name = files
- Compression level = lz4
- Enable atime = Off
- All other options default
- Dataset Name = db
- Compression level = zle
- Enable atime = Off
- Record Size = 16K (Under Advanced Mode)
- All other options default
Create Jail
Jails > Add Jail
- Jail Name: nextcloud
- Template: "------"
- IPv4 Address: 10.130.12.191
- IPv4 Subnet: 255.255.248.0
- Leave all else default
- Ensure VIMAGE is checked
Add Storage
- Jail: nextcloud
- Source = /mnt/tank/files
- Destination = /mnt/files
- Jail: nextcloud
- Source = /mnt/tank/db
- Destination = /var/db/mysql
Setting primary cache
In FreeNAS UserSpace Shell
zfs set primarycache=metadata SETV_Cloud/db
Configure Jail for First Use
We need to set up the jail to be able to SSH in and make faster adjustments.
Enter the Jail's shell from within FreeNAS
pkg upgrade
If it asks any questions, select Y and continue.
Enable SSH
$ cd /etc/ssh $ vi sshd_config
Personally I despise vi, but this is the quickest method.
Scroll down using the DOWN arrow key until you find #PermitRootLogin no
line.
With the cursor on the #
hit x
this will delete the hash now use the RIGHT arrow key to select the space before 'no'
Hit i
type yes
Hit esc
Select the n in 'no' and hit x
twice to delete 'no' so the line reads PermitRootLogin yes
type :wq
Hit ENTER
The file is now saved
Now enable and start SSH
$ sysrc sshd_enable=yes $ service ssh start
Change Jail Root PW
We need to reset the jails root password; type this command, and follow the prompts
$ passwd
Now close the shell within FreeNAS, and use PuTTY to SSH to the jail.
F.A.M.P Installation
In this section we are going to install F.A.M.P, an iteration of LAMP (Linux, Apache, MySQL, PHP)
- FreeBSD 10.1
- Apache 2.4
- MariaDB 10.1
- PHP 7.0
This provides the basics for our webserving jail.
Before we get started, let's add a few necessary packages
$ pkg install nano wget sudo $ vi sshd_config
We will install each part of FAMP one-by-one. FreeBSD is the Operating system so check!
Apache 2.4 [2]
Install
$ pkg install apache24
Setup in rc.conf
$ sysrc apache24_enable=yes
Start Apache
$ service apache24 start
Check that it works
Navigate to http://10.130.12.191 and you should see the text "It Works!"
MariaDB 10.1 [3]
Install
$ pkg install mariadb101-server
Setup in rc.conf
$ sysrc mysql_enable=yes
Run Wizard Script
$ mysql_secure_installation
Read and follow prompts. There is no root password set, and answer Y to all the following questions.
Login to MySQL, create Nextcloud DB and User
$ mysql -u root -p
enter password you made for root during setup.
Enter each of these commands one-by-one, and make sure to include the semi-colon ;
CREATE DATABASE nextcloud; CREATE USER 'nextcloud_admin'@'localhost' IDENTIFIED BY 'MAKEUP-YOUR-OWN-PASSWORD'; GRANT ALL ON nextcloud.* TO 'nextcloud_admin'@'localhost'; FLUSH PRIVILEGES; exit
Replace MAKEUP-YOUR-OWN-PASSWORD with a password of your choosing. You need this for the NextCloud setup.
PHP 7.0
Install PHP and associated modules[1]
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 'mysql_enable=YES' 'redis_enable=YES'
Configuring Apache for PHP7
Ensure that the rewrite and ssl modules are enabled (uncommented) in /usr/local/etc/apache24/httpd.conf
.
CREATE DATABASE nextcloud; $ cd /usr/local/etc/apache24/ $ nano httpd.conf
Search the conf file for "ssl_module"
ctrl+w ssl_module ENTER
Uncomment (delete the #
at the start of the line) so it looks like this:
LoadModule ssl_module libexec/apache24/mod_ssl.so
Repeat for
LoadModule rewrite_module libexec/apache24/mod_rewrite.so
- Find & Remove this >> LoadModule php5_module libexec/apache24/libphp5.so
- Replace with >> LoadModule php7_module libexec/apache24/libphp7.so
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>
</IfModule>
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
Enable PHP 7 in httpd (we will deal with FPM later)
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
I
https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/
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.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/
- ↑ 1.0 1.1 https://forums.freenas.org/index.php?threads/how-to-owncloud-using-nginx-php-fpm-and-mysql.17786/
- ↑ https://www.digitalocean.com/community/tutorials/how-to-install-an-apache-mysql-and-php-famp-stack-on-freebsd-10-1
- ↑ 3.0 3.1 https://levlaz.org/installing-nextcloud-on-a-freebsd-vps/
- ↑ https://kdenby.homelinux.com/?p=208
- ↑ http://serverfault.com/questions/646333/apache-24-not-serving-php-on-freebsd-10