Tutorial complété (avec les différents cas d'erreurs et solutions trouvées)


#1

Bonjour,

j’ai finalement réussi à installer un cozy sur une debian 9 strech (cozy en mode testing)

J’ai eu quelques soucis, que j’ai solutionné et documenté.

Je pense que ce sont des choses à corriger dans les installs (au moins à vérifier…)
mais je sais pas trop ou poster ce “document” pour aider ceux qui veulent se lancer…
Puis je le poster ici ?

Marc


#2

Hello Marc,

Merci beaucoup.

Oui, bien sûr, poste-le ici, nous allons regarder et améliorer notre documentation d’installation grâce à tes remarques :slight_smile:


#3

cool, le voici donc,

(je l’ai fait en anglais, …)

Activate backports

echo “Package: python3-acme
Pin: release n=stretch-backports
Pin-Priority: 510” > /etc/apt/preferences.d/cozy

Install requirements

apt install ca-certificates apt-transport-https curl

Download and install apt key ring

# stable
curl https://apt.cozy.io/cozy.gpg | apt-key --keyring /etc/apt/trusted.gpg.d/cozy.gpg add -

# unstable
curl https://apt.cozy.io/nightly/cozy.gpg | apt-key --keyring /etc/apt/trusted.gpg.d/cozy.gpg add

Activate repos

You need to choose :

#stable
echo "deb https://apt.cozy.io/debian/ stretch stable" > /etc/apt/sources.list.d/cozy.list

# testing
echo "deb https://apt.cozy.io/debian/ stretch testing" > /etc/apt/sources.list.d/cozy.list

# unstable
echo "deb https://apt.cozy.io/nightly/debian/ stretch unstable" > /etc/apt/sources.list.d/cozy.list

Backports

echo “deb http://ftp.debian.org/debian stretch-backports main” >> /etc/apt/sources.list.d/cozy.list

update package list

apt update

Install CouchDb

apt install cozy-couchdb

Follow the wizard, just answer the questions

  • Standalone mode
  • select a password for the administrator account
  • Type the password again

test couch db installation

curl http://localhost:5984/

You should have this kind of answer :

{“couchdb”:“Welcome”,“version”:“2.1.0”,“features”:[“scheduler”],“vendor”:{“name”:“The Apache Software Foundation”}}

Install Cozy-stack

apt install cozy-stack

Address: by default, it’s localhost:5984

Node name: by default, it’s couchdb@localhost

Admin user: by default, it’s admin

Admin password: put the one you choose during CouchDB setup

Cozy user: by default, it’s cozy

Cozy password: pick a password

this one is pretty annoying, in the “stable” branch it’s almost ok this solution is working

in the testing branch, the installation process ask for the password and loop forever, need to reboot…

If you have a password error at the end of the installation

# create the file "cozy-admin-passphrase"
touch /etc/cozy/cozy-admin-passphrase

# configure the passphrase
cozy-stack config passwd /etc/cozy/cozy-admin-passphrase

# Start the installation again
apt install cozy-stack

Test the installation

curl http://localhost:8080/version

You should have this kind of answer :

{“build_mode”:“production”,“build_time”:“2017-09-28T10:26:03Z”,“runtime_version”:“go1.8.1”,“version”:“0.1.0”}#

# if server is not responding..

# open file cozy.yml
cat /etc/cozy/cozy.yml

# check that the couchdb url has the correct password in the url
# url should be like:
http://cozy_user:password@127.0.0.1:5984/

Check that cozy-couchdb is correctly configured

try this

curl -X PUT “http://user:password@127.0.0.1:5984/mydb

if you have an error (unknown_error)

# Display the file /opt/couchdb/etc/vm.args
cat /opt/couchdb/etc/vm.args
# memorize the name which is used after the parameter -name
# it should be something like couchdb@localhost

# List the nodes used by couchdb
# you'll have to enter "cozy"'s password 
curl -s -X GET “http://localhost:5984/_membership” --user cozy

# if you have multiple entries in "cluster_node" array, you'll need to delete all the nodes that are not the one you memorized early.
# To delete a node, you should follow this tutorial
http://docs.couchdb.org/en/2.2.0/cluster/nodes.html

delete the test database

curl -X DELETE “http://user:password@127.0.0.1:5984/mydb

If you want to install konectors

Install prerequisits

apt install debootstrap

Create konnectors

sh /usr/share/cozy/konnector-create-chroot.sh

Activate namespaces

sysctl -w kernel.unprivileged_userns_clone=1

Cozy installation

apt install cozy

With Let’s Encrypt

Create your own domain with subdomain

in your DNS Zone : *.cozy IN A X.X.X.X

Redirect http traffic to HTTPS

cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak

nano /etc/nginx/sites-available/default

Add or replace the following lines :

server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;
server_name _;

location /.well-known/acme-challenge/ {
    alias /etc/ssl/private/acme-challenge/;
}

location / {
    return 301 https://$host$request_uri;
}

}

Test your configuration file

nginx -t

you should have “configuration successful”

install the certs tools

apt install ssl-cert

Add a user (www-data, the internet user to the ssl-cert group)

adduser www-data ssl-cert

Restart nginx

systemctl restart nginx

Export password in the environment variables

export COZY_ADMIN_PASSWORD=

create instance

cozy-coclyco create


Cozy-stack