Installation of OwnCloud 7 on Raspberry Pi
I finally got Owncloud installed and working on my Raspberry Pi server. I got a lot of help from you all. Here is my thank you; the detailed notes of my installation which uses OwnCloud 7, php5, MySql, and Apache2.
After starting Raspberry, change login to root so that you do not need to type sudo for every command.
Code: Select all
$ sudo -iCode: Select all
# apt-get update
# apt-get upgrade
# apt-get dist-upgrade
# reboot
Code: Select all
# wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key
Code: Select all
# apt-key add - < Release.key
# echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key' >> /etc/apt/sources.list.d/owncloud.list
Code: Select all
# apt-get update
# apt-get install owncloud
Root password: mysqlpsswd
6. Modify php.ini for upload file size
Code: Select all
# cd /etc/php5/apache2/
# nano php.ini
upload_max_filesize = 2G (2M)
post_max_size = 2G (8M)
output_buffering = 0 (4096)
7. Prepare an External USB Drive for data storage
a) Install ntfs
Code: Select all
# apt-get install ntfs-3g
Code: Select all
# mkdir /media/OwnCloudCode: Select all
# mount –t ntfs-3g –o umask=007,auto,user,users,uid=33,gid=33 /dev/sda1 /media/Code: Select all
# blkid –c /dev/null- /dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="787C-2FD4" TYPE="vfat"
/dev/mmcblk0p2: UUID="3d81d9e2-7d1b-4015-8c2c-29ec0875f762" TYPE="ext4"
/dev/sda1: LABEL="OwnCloud" UUID="EAE0455CE0452FDD" TYPE="ntfs"
/dev/sda2: LABEL="SERVICEV001" UUID="B641-A4FF" TYPE="vfat"
Code: Select all
# fdisk -l- Disk /dev/mmcblk0: 31.9 GB, 31914983424 bytes
4 heads, 16 sectors/track, 973968 cylinders, total 62333952 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00090806
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 62333951 31105536 83 Linux
Disk /dev/sda: 160.0 GB, 160041885696 bytes
240 heads, 63 sectors/track, 20673 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xed1f86f7
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 300296191 150147072 7 HPFS/NTFS/exFAT
/dev/sda2 300296192 312578047 6140928 12 Compaq diagnostics
Code: Select all
# cd /etc/fstab
# nano stab
- proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 /ext4 defaults,noatime 0 1
UUID=EAE0455CE0452FDD /media/OwnCloud/ ntfs-3g rw,umask=007,auto,user,users,uid=33,gid=33,utf8 0 0
# a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that
Code: Select all
# rebootCode: Select all
# chown -R root:root /media/OwnCloud/
# chmod -R 755 /media/OwnCloud/
# chown www-data:www-data /media/OwnCloud/config/config.php
# chmod 750 /media/OwnCloud/config/config.php
# chown -R www-data:www-data /media/OwnCloud/data/
# chmod -R 750 /media/OwnCloud/data/
# chown root:root /media/OwnCloud/data/.htaccess
# chmod 755 /media/OwnCloud/data/.htaccess
# chown www-data:www-data /media/OwnCloud/apps/
# chmod 750 /media/OwnCloud/apps/
Code: Select all
# ls -l /dev/disk/by-uuid/- total 0
lrwxrwxrwx 1 root root 15 Dec 24 22:02 3d81d9e2-7d1b-4015-8c2c-29ec0875f762 -> ../../mmcblk0p2
lrwxrwxrwx 1 root root 15 Dec 24 22:02 787C-2FD4 -> ../../mmcblk0p1
lrwxrwxrwx 1 root root 10 Dec 24 22:02 B641-A4FF -> ../../sda2
lrwxrwxrwx 1 root root 10 Dec 25 02:13 EAE0455CE0452FDD -> ../../sda1
All root, user and other permissions are write, read and execute.
Code: Select all
# mkdir /etc/apache2/ssl
# openssl req -x509 –nodes –days 365 –newkey rsa:2048 –keyout /etc/apache2/ssl/apache.key –out /etc/apache2/ssl/apache.crt
State name: State Name
Locality name: Town
Organization Name:
Unit name:
Common Name: www.myserver.com
Email: user@email.com
11. Modify Apache
a) First check Apache version number
Code: Select all
# apachectl –v or # apache2 -v- Server version: Apache/2.2.22 (Debian)
Server built: Jul 24 2014 21:45:57
Code: Select all
# nano /etc/apache2/sites-available/default-ssl- <IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
ServerName www.myserver.com:443
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
Code: Select all
# a2enmod ssl
# a2ensite default-ssl
# service apache2 restart
Code: Select all
https://www.myserver.com/owncloudPassword: yourowncloudpassword
Data folder: /media/OwnCloud/data
Database : MySql
14. Check if configuration file is created properly:
Code: Select all
# cd /var/www/owncloud/config
# nano config.php
- <?php
$CONFIG = array (
'instanceid' => 'oc080d29a834',
'passwordsalt' => '29abed8440c4f6e34c374f35d1533ef3b',
'secret' => 'cda3d4edeaf0eb612369d63e4f06b30cd7e3420ae6702baaa1c120897015f3c10e2d271c5fa569249b16f1239d07cb8d27618de2',
'trusted_domains' =>
array (
0 => 'www.myserver.com',
),
'datadirectory' => '/media/OwnCloud/data',
'overwrite.cli.url' => 'https://www.myserver.com/owncloud',
'dbtype' => 'mysql',
'version' => '7.0.4.2',
'dbname' => 'owncloud',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_user',
'dbpassword' => 'cab23680f3ac23eb623654521736bc1da7685c', mysqlpasswd
'installed' => true,
'mail_smtpmode' => 'smtp',
'mail_smtpsecure' => 'tls',
'mail_from_address' => 'owncloud',
'mail_domain' => 'email.com',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => 'smtp.mail.com',
'mail_smtpport' => '587',
'mail_smtpname' => 'yourusername,
'mail_smtppassword' => 'yourpassword',
'forcessl' => true,
‘debug’ => true;
‘loglevel’ => 0,
);
a) Install apc
Code: Select all
# apt-get install php-apcCode: Select all
# nano /etc/php5/conf.d/20-apc.ini
extension=apc.so
apc.enabled=[b]1[/b]
apc.shm_size=[b]12M[/b]*
c) Start Apache
Code: Select all
# apachectl restartCode: Select all
<?php
phpinfo();
?>
Code: Select all
https://www.yourserver.com/php.phpCode: Select all
# cd /usr/share/doc/php-apc
# nano apc.php
defaults('Adefaults('ADMIN_PASSWORD','yourpassword')
g) Rename apc.php and php.php in /var/ww to apc.phd and php.phd for security
16. To get rid of error
‘apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName’ edit fqdn and enter the line below
Code: Select all
# nano /etc/apache2/conf.d/fqdn
ServerName localhost
Code: Select all
# apachectl restartUsing your browser login to OwnCloud
Code: Select all
https://www.myserver.com/owncloudFrom top right choose "Personal" and enter an email user@email.com
b) Setup email
Go to "Admin" and under the "Email Server" fill in the email setup boxes
c) Create users
Enter user ID, user password, and the role (e.g. admin) for the user.
d) Enable encryption
Check encryption box
e) External Storage Support
Enter folder name OwnCloud and configuration media for the admin group:
f) In security check "Enforce HTTPS"
18. Install phpMyAdmin to manage OwnCloud database
(ref: https://www.digitalocean.com/community/ ... n-debian-7 )
a. Install the program
Code: Select all
# apt-get install phpmyadmin• Choose YES when asked about whether to Configure the database for phpmyadmin with dbconfig-common
• Enter MySQL password: mysqlpasswd
• Enter phpmyadmin password: phpmyadminpasswd
b. Add phpmyadmin to the apache configuration
Code: Select all
# nano /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.confCode: Select all
# service apache2 restartCode: Select all
# nano /etc/phpmyadmin/apache.confand add the line “AllowOverride All” under “Directory Index”, making the section look like this:
- <Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
[...]
Code: Select all
# mkdir /media/OwnCloud/passwordsCode: Select all
# nano /usr/share/phpmyadmin/.htaccess
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /media/OwnCloud/passwords/.htpasswd
Require valid-user
Code: Select all
# htpasswd -c /media/OwnCloud/passwords/.htpasswd rootyourowncloudpasswd
i. Restart apache
Code: Select all
# service apache2 restartCode: Select all
https://www.myserver.com/phpmyadminpassword: yourphpmyadminpasswd
By choosing owncloud database, you can see all the owncloud tables:
19. Location of Log files (so that you can debug certain problems):
a) ownCloud
Code: Select all
/media/OwnCloud/data/owncloud.logCode: Select all
# nano /var/www/owncloud/config/config.php
‘debug’ => true;
‘loglevel’ = > 0;
b) Apache
Code: Select all
/var/log/apache2/error.log
/var/log/apache2/access.log
Code: Select all
/var/log/php-errors.logCode: Select all
# nano /etc/php5/apache2/php.ini
display_errors = off
log_errors = on
error_log = /var/log/php-errors.log
Code: Select all
# touch /var/log/php-errors.log
# chown www-data:www-data /var/log/php-errors.log
# service apache2 restart
Code: Select all
/var/log/mysql.log