Skip to content

Instantly share code, notes, and snippets.

@Zhiyuan-Amos
Last active March 5, 2022 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zhiyuan-Amos/119f6036dbbf125f378cf634c0064ed7 to your computer and use it in GitHub Desktop.
Save Zhiyuan-Amos/119f6036dbbf125f378cf634c0064ed7 to your computer and use it in GitHub Desktop.

Install ownCloud Infinite Scale on Raspberry Pi

Execute the following commands in a bash shell.

Configure variables

Initialize the following variables:

network={eth0|wlan0} // Ethernet or wireless respectively
ip={ip} // static IP address for the Raspberry Pi
routerIp={routerIp} // the gateway IP address for your router on the local network. Typically 192.168.0.1
dnsIp={dnsIp} // the DNS IP address (typically the same as your router’s gateway address)
ocisVersion={ocisVersion} // the version of ocis e.g. 1.16.0

E.g.

network=wlan0
ip=192.168.0.154
routerIp=192.168.0.1
dnsIp=192.168.0.1
ocisVersion=1.16.0

Helpful commands:

  1. hostname -I - Returns currently assigned IP.
  2. ip route | grep default | awk '{print $3}' - Returns Router IP

Download ownCloud

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install etcd -y
echo 'ETCD_UNSUPPORTED_ARCH=arm' | sudo tee -a /etc/default/etcd
sudo service etcd start
sudo curl "https://download.owncloud.com/ocis/ocis/${ocisVersion}/ocis-${ocisVersion}-linux-arm" --output /usr/bin/ocis
sudo chmod 755 /usr/bin/ocis

Initialize ownCloud as a service

sudo install -D /dev/null /etc/systemd/system/ocis.service
lines=('[Unit]' 'Description=OCIS server' '' '[Service]' 'Type=simple' 'User=pi' 'Group=pi' 'EnvironmentFile=/etc/ocis/ocis.env' 'ExecStart=ocis server' 'Restart=always' '' '[Install]' 'WantedBy=multi-user.target')
for line in "${lines[@]}"; do echo $line | sudo tee -a /etc/systemd/system/ocis.service; done

sudo install -D /dev/null /etc/ocis/ocis.env
lines=('PROXY_HTTP_ADDR=0.0.0.0:9200' "OCIS_URL=https://${ip}:9200" 'OCIS_INSECURE=true' 'KONNECTD_TLS=0')
for line in "${lines[@]}"; do echo $line | sudo tee -a /etc/ocis/ocis.env; done

Run ownCloud

Run systemctl enable --now ocis and access ownCloud locally or remotely on https://{ip}:9200 with the credentials:

User: admin

Password: admin

Note: If you need to restart oCIS because of configuration changes in /etc/ocis/ocis.env, run systemctl restart ocis.

Set static IP

Warning: After running the commands in this section, the Raspberry Pi will not be able to access the Internet. To undo this operation, delete the appended configurations in /etc/dhcpcd.conf and run sudo reboot.

lines=("interface ${network}" "static ip_address=${ip}/24" "static routers=${routerIp}" "static domain_name_servers=${dnsIp}")
for line in "${lines[@]}"; do echo $line | sudo tee -a /etc/dhcpcd.conf; done

Then, run sudo reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment