Difference between pages "Linux basics" and "OwnCloud"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Useful linux commands)
 
(Creating the OwnCloud database)
 
Line 1: Line 1:
== Using VI ==
+
{{RightTOC}}
  
'''vi''' (pronounced vee-eye) is the Unix standard text editor so affords editing the configuration files by hand. If you don’t know it yet, it can be a bit surprising. Actually, '''vi''' was created at a time when the keyboards did not have any arrow or insert keys. So there are two modes: the «open» mode and the «insert» mode.
+
== What is OwnCloud ? ==
  
The open mode affords moving the cursor. '''j''', '''k''', '''l''', '''m''' move the cursor by one character. '''ctrl-f''' moves one page forward and '''ctrl-b''' moves one page backwards. '''w''' moves one word forward and  '''b''' moves one word backwards. It is also possible to use the arrow keys.
+
[http://owncloud.com/ OwnCloud] is a file synchronization server. It affords keeping a hierarchy of files synchronized on different clients and operating systems.
  
'''i''' goes into insert mode before the cursor, '''a''' goes into insert mode after the cursor, and '''A''' goes into insert mode at the end of the line. '''o''' adds a line after the current line, and '''O''' adds a live before the current line. '''R''' goes into rewrite mode.
+
The [https://doc.owncloud.com/server/10.15/admin_manual/installation/quick_guides/ubuntu_20_04.html/ Owncloud install doc] provided is for Ubuntu.
  
'''esc''' affords getting out of the insert mode.
+
It is adapted below for Slackware 15.0.
  
'''c$''' affords replacing the end of the line and '''d$''' affords deleting the end of the line. '''cw''' affords replacing one word and '''dw''' affords deleting one word. '''dd''' affords deleting the current line.
+
== Installing OwnCloud ==
  
''':q''' affords quitting without saving. If the file has been modified, quitting must be forced by typing ''':q!'''. ''':x''' affords saving and quitting. If the file does not have the write rigths, saving must be forced by typing ''':x!'''. ''':w''' affords writing the text in a new file. If the new file already exists, writing must be forced by typing ''':w!'''.
+
OwnCloud is a PHP application. [https://owncloud.com/download-server download] tarball then untar and install.
  
''':num''' affords moving to the line number num. ''':$''' affords moving to the end of the file.
+
# tar -C /usr/local -xvf owncloud-complete-20240724.tar.bz2
''':num1copynum2''' affords copying the line number num1 after the line number num2. ''':num1mnum2''' affords moving the line number num1 after the line number num2.
+
# chown -R apache:apache owncloud
 +
# cd /var/www/htdocs
 +
# ln -s /usr/local/owncloud owncloud
 +
# chown -R apache:apache owncloud
  
For detailed information, check the [http://vimdoc.sourceforge.net/htmldoc/help.html VIM Documentation]. To enter special characters check the page on [http://vimdoc.sourceforge.net/htmldoc/digraph.html digraphs]. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.
+
== Creating the occ helper script ==
  
To get syntax highligting instead of '''vi''' use the '''vim'''(vi improved) replacement :
+
occ is an OwnCloud administration command.
  
  # '''cd /usr/bin'''
+
  # FILE="/usr/local/bin/occ"
  # '''rm vi'''
+
  # cat <<EOM >$FILE
  # '''ln -s vim vi'''
+
  > #! /bin/bash
 +
> cd /usr/local/owncloud
 +
> sudo -E -u apache /usr/bin/php /usr/local/owncloud/occ "\$@"
 +
> EOM
 +
# chmod u+x $FILE
  
== Using SSH ==
+
== Creating the OwnCloud database ==
  
SSH is a suite of tools affording connecting remotely over encrypted communications. On the client side, '''ssh''' offers a command line terminal, '''scp''' affords copying a file, and '''sftp''' behaves like ftp. The server side consists of sshd, sftp-server, and ssh-agent. ssh-add, ssh-keysign, ssh-keyscan, and ssh-keygen afford key management. The SSH present on Slackware and the BSDs is [https://www.openssh.com/ OpenSSH], developped by members of the [https://www.openbsd.org/ OpenBSD] project.
+
OwnCloud can use a variety of databases. We will be using MySQL. The database can be created as follows :
  
'''ssh''' obviously requires your password every time it is executed. This can be avoided by creating on the client a pair of rsa keys and copying the public key to the server. Not specifying a passphrase is not very secure but will afford avoiding having to enter it every time :
+
# mysql -u root -e \
 +
  "CREATE DATABASE IF NOT EXISTS owncloud; \
 +
  CREATE USER IF NOT EXISTS 'owncloud'@'localhost' IDENTIFIED BY 'password'; \
 +
  GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' WITH GRANT OPTION; \
 +
  FLUSH PRIVILEGES;"
 +
# mysql -u root -e \
 +
  CREATE USER 'owncloud'@'127.0.0.1' IDENTIFIED BY 'password';
 +
  GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'127.0.0.1';
 +
  FLUSH PRIVILEGES;
 +
#
  
# '''ssh-keygen -t rsa'''
+
It is also possible to create user owncloud@localhost and database from phpmyadmin.
Generating public/private rsa key pair.
 
Enter file in which to save the key (/root/.ssh/id_rsa): '''<cr>'''
 
Enter passphrase (empty for no passphrase): '''<cr>'''
 
Enter same passphrase again: '''cr>'''
 
Your identification has been saved in /root/.ssh/id_rsa.
 
Your public key has been saved in /root/.ssh/id_rsa.pub.
 
The key fingerprint is:
 
SHA256:ATSDdER5/l8OJvr+jpINIReJtd81zntVbTjuJW5aobE root@client
 
The key's randomart image is:
 
+---[RSA 2048]----+
 
|  ..=O+..      |
 
|    ..o++.    ..|
 
|      oo.    = +|
 
|      . +o . = +.|
 
|      oSo. o * o|
 
|        . o o*.=.|
 
|        = +E+* .|
 
|        + ...+.. |
 
|        ++o+    |
 
+----[SHA256]-----+
 
# '''scp root@client:.ssh/id_rsa.pub root@server:.ssh/id_rsa.pub'''
 
password: '''secret<cr>'''
 
id_rsa.pub                                          100% 394      1.8MB/s  00:00
 
# '''ssh server'''
 
password: '''secret<cr>'''
 
# '''cd .ssh'''
 
# '''cat >> authorized_keys < id_rsa.pub'''
 
# '''chmod 600 authorized_keys'''
 
# '''rm id_rsa.pub'''
 
  
== Useful linux commands ==
+
== setting up the owncloud database ==
  
{| {{thead}}
+
The admin user is the one who will manage the other users and OwnCloud from the OwnCloud web page.
|-
+
 
! {{chead}} width="220" | Command
+
# occ maintenance:install \
! {{chead}} | Effect
+
    --database "mysql" \
|-
+
    --database-name "owncloud" \
|<tt>'''cd'''</tt>||change directory.
+
    --database-user "owncloud" \
|-
+
    --database-pass "password" \
|<tt>'''chmod -R ppp ddd'''</tt>||recursively change permissions on file or directory.
+
    --data-dir "/var/www/htdocs/owncloud/data" \
|-
+
    --admin-user "admin" \
|<tt>'''chown -R uuu:ggg ddd'''</tt>||recursively change user:group ownership on file or directory.
+
    --admin-pass "admin"
|-
+
ownCloud was successfully installed
|<tt>'''chgrp -R ggg ddd'''</tt>||recursively change group ownership on file or directory.
+
#
|-
+
 
|<tt>'''command xxx <nowiki>|</nowiki> grep yyy'''</tt>||search for string yyy in output of command xxx.
+
== Configure ownCloud’s Trusted Domains ==
|-
+
 
|<tt>'''ethtool -s eth0 wol g'''</tt>||puts interface eth0 in wake-on-lan status.
+
# my_ip=$(hostname -I|cut -f1 -d ' ')
|-
+
# occ config:system:set trusted_domains 1 --value="$my_ip"
|<tt>'''find xxx -name yyy -print'''</tt>||find file yyy in in subdirectories of xxx.
+
System config value trusted_domains => 1 set to string x.y.z.t
|-
+
# occ config:system:set trusted_domains 2 --value="$HOSTNAME"
|<tt>'''groupadd <<i>group</i>>'''</tt>||add group <<i>group</i>>.
+
System config value trusted_domains => 2 set to string your.domain.tld
|-
+
#
|<tt>'''ifconfig -a'''</tt>||print the network interfaces configuration.
+
 
|-
+
== Configure the cron jobs ==
|<tt>'''iptables -L'''</tt>||print the firewall rules.
+
 
|-
+
Set your background job mode to cron:
|<tt>'''killall xxx'''</tt>||kill program named xxx.
+
 
|-
+
# occ background:cron
|<tt>'''ldconfig'''</tt>||reload libraries taking into account new libraries just built.
+
Set mode for background jobs to 'cron'
|-
+
#
|<tt>'''ln -s existing new'''</tt>||create a symbolic link new to an existing directory or file.
+
 
|-
+
== Configure the execution of the cron job to every 15 min and the cleanup of chunks every night at 2 am: ==
|<tt>'''ls -al'''</tt>||list the working directory, including files beginning with a dot.
+
 
|-
+
# echo "MIN HOUR DAY MONTH DAYOFWEEK COMMAND" >> /var/spool/cron/crontabs/apache
|<tt>'''man xxx'''</tt>||display the xxx command manual page.
+
# echo "*/15  *  *  *  * /var/www/htdocs/owncloud/occ system:cron" >> /var/spool/cron/crontabs/apache
|-
+
# echo "0 2  *  *  * /var/www/htdocs/owncloud/occ dav:cleanup-chunks" >> /var/spool/cron/crontabs/apache
|<tt>'''more xxx'''</tt>||display file xxx with the possibility of moving up and down. '''less''' and '''most''' are similar commands.
+
# chgrp apache /var/spool/cron/crontabs/apache
|-
+
#
|<tt>'''mount -t ttt /dev/xxx /mnt/ddd'''</tt>||mount device xxx as type ttt under directory ddd.
+
 
|-
+
== Configure Log Rotation ==
|<tt>'''(u)mount /mnt/ddd'''</tt>||(u)mount device ddd as specified in /etc/fstab.
+
 
|-
+
# FILE="/etc/logrotate.d/owncloud"
|<tt>'''nmap <i>host</i>'''</tt>||check filtering status of ports on <i>host</i>. '''-sU''' for UDP.
+
# cat <<EOM >$FILE
|-
+
/var/www/htdocs/owncloud/data/owncloud.log {
|<tt>'''ntpdate -bv 0.fr.pool.ntp.org'''</tt>|| force ntp synchronization.
+
size 10M
|-
+
rotate 12
|<tt>'''ps -ef'''</tt>||list the running processes.
+
copytruncate
|-
+
missingok
|<tt>'''pwd'''</tt>||print working directory.
+
compress
|-
+
compresscmd /bin/gzip
|<tt>'''rm -r'''</tt>||remove file or directory recursively.
+
}
|-
+
EOM
|<tt>'''route'''</tt>||display the network routing table.
+
#
|-
 
|<tt>'''scp -p usr1@hst1:/str1  usr2@hst2:/str2'''</tt>||copy files between hosts.
 
|-
 
|<tt>'''screen <i>-S<name></i>'''</tt>||screen offers a frame to run a shell, detach from it (<ctrl>-a d) and later reattach to it.
 
|-
 
|<tt>'''ssh <i>host</i>'''</tt>||connect remotely to site <i>host</i>.
 
|-
 
|<tt>'''su -l uuuu'''</tt>||execute shell as another user. if -l is used an environment similar to what the other user would have had with a direct login is provided.
 
|-
 
|<tt>'''telinit n'''</tt>||go to the runlevel n (1=single-user, 3=multi-user, 4=graphical, 6=reboot).
 
|-
 
|<tt>'''umask'''</tt>||edit /etc/profile to change the default umask value of 022 and '''set it to 027''' (files not readable by other users), a good setting except when installing as root server software to be ran as a standard user account (permission issues).
 
|-
 
|<tt>'''useradd <<i>group</i>> <<i>user</i>>'''</tt>||add <<i>user</i>> as a member of group <<i>group</i>>.
 
|-
 
|<tt>'''vi'''</tt>||run the vi text editor. To get rid of the message "skipping N old session files", delete files elvis*.ses in /var/tmp.
 
|}
 
  
 
<br clear=all>
 
<br clear=all>
  
{{pFoot|[[Maintaining Slackware]]|[[Main Page]]|[[Configuration files]]}}
+
{{pFoot|[[Asterisk]]|[[Main Page]]|[[Desktop software]]}}

Revision as of 15:44, 21 March 2026

What is OwnCloud ?

OwnCloud is a file synchronization server. It affords keeping a hierarchy of files synchronized on different clients and operating systems.

The Owncloud install doc provided is for Ubuntu.

It is adapted below for Slackware 15.0.

Installing OwnCloud

OwnCloud is a PHP application. download tarball then untar and install.

# tar -C /usr/local -xvf owncloud-complete-20240724.tar.bz2
# chown -R apache:apache owncloud
# cd /var/www/htdocs
# ln -s /usr/local/owncloud owncloud
# chown -R apache:apache owncloud

Creating the occ helper script

occ is an OwnCloud administration command.

# FILE="/usr/local/bin/occ"
# cat <<EOM >$FILE
> #! /bin/bash
> cd /usr/local/owncloud
> sudo -E -u apache /usr/bin/php /usr/local/owncloud/occ "\$@"
> EOM
# chmod u+x $FILE

Creating the OwnCloud database

OwnCloud can use a variety of databases. We will be using MySQL. The database can be created as follows :

# mysql -u root -e \
  "CREATE DATABASE IF NOT EXISTS owncloud; \
  CREATE USER IF NOT EXISTS 'owncloud'@'localhost' IDENTIFIED BY 'password'; \
  GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' WITH GRANT OPTION; \
  FLUSH PRIVILEGES;"
# mysql -u root -e \
  CREATE USER 'owncloud'@'127.0.0.1' IDENTIFIED BY 'password';
  GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'127.0.0.1';
  FLUSH PRIVILEGES;
#

It is also possible to create user owncloud@localhost and database from phpmyadmin.

setting up the owncloud database

The admin user is the one who will manage the other users and OwnCloud from the OwnCloud web page.

# occ maintenance:install \
    --database "mysql" \
    --database-name "owncloud" \
    --database-user "owncloud" \
    --database-pass "password" \
    --data-dir "/var/www/htdocs/owncloud/data" \
    --admin-user "admin" \
    --admin-pass "admin"
ownCloud was successfully installed
#

Configure ownCloud’s Trusted Domains

# my_ip=$(hostname -I|cut -f1 -d ' ')
# occ config:system:set trusted_domains 1 --value="$my_ip"
System config value trusted_domains => 1 set to string x.y.z.t
# occ config:system:set trusted_domains 2 --value="$HOSTNAME"
System config value trusted_domains => 2 set to string your.domain.tld
#

Configure the cron jobs

Set your background job mode to cron:

# occ background:cron
Set mode for background jobs to 'cron'
#

Configure the execution of the cron job to every 15 min and the cleanup of chunks every night at 2 am:

# echo "MIN HOUR DAY MONTH DAYOFWEEK COMMAND" >> /var/spool/cron/crontabs/apache
# echo "*/15  *  *  *  * /var/www/htdocs/owncloud/occ system:cron" >> /var/spool/cron/crontabs/apache
# echo "0  2  *  *  * /var/www/htdocs/owncloud/occ dav:cleanup-chunks" >> /var/spool/cron/crontabs/apache
# chgrp apache /var/spool/cron/crontabs/apache
#

Configure Log Rotation

# FILE="/etc/logrotate.d/owncloud"
# cat <<EOM >$FILE
/var/www/htdocs/owncloud/data/owncloud.log {
size 10M
rotate 12
copytruncate
missingok
compress
compresscmd /bin/gzip
}
EOM
#


Asterisk Main Page Desktop software