<@U04UQ68083H> i want to setup ory kratos on my ub...
# ory-copilot
l
@chilly-king-10285 i want to setup ory kratos on my ubuntu. give me commands from scratch for it
c
A message from kapa.ai
Sure, here are the steps to set up Ory Kratos on Ubuntu: 1. Create a new user with prohibited login:
Copy code
bash useradd -s /bin/false -m -d /opt/kratos kratos
2. Create folders to hold the installation data and configuration files:
Copy code
bash mkdir /opt/kratos/{bin,config}
3. Install Ory Kratos:
Copy code
bash cd /opt/kratos/bin   wget <https://github.com/ory/kratos/releases/download/<version-you-want>/kratos_<version-you-want>-linux_64bit.tar.gz>   tar xfvz kratos_<version-you-want>-linux_64bit.tar.gz   rm *md   rm LICENSE
4. Download the Quickstart configuration files:
Copy code
bash cd ../config   wget <https://raw.githubusercontent.com/ory/kratos/<version-you-want>/contrib/quickstart/kratos/email-password/identity.schema.json>   wget <https://raw.githubusercontent.com/ory/kratos/<version-you-want>/contrib/quickstart/kratos/email-password/kratos.yml>
5. Add configuration for Ory Kratos in
kratos.yml
to use the Postgres database. Open
kratos.yml
and change the dsn configuration. By default
dsn: memory
is configured, so Ory Kratos is storing data in the temporary memory. Change the DSN key to use the Postgres database you configured before:
Copy code
bash - dsn: memory   + dsn: <postgres://kratos:[email> protected]:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4
6. Change the default location of the identity schema:
Copy code
bash identity:   default_schema_id: default   schemas:      - id: default   -    url: file:///etc/kratos/config/identity.schema.json   +    url: file:///opt/kratos/config/identity.schema.json
7. Apply migrations:
Copy code
bash /opt/kratos/bin/kratos -c /opt/kratos/config/kratos.yml migrate sql -y <postgres://kratos:[email> protected]:5432/kratos?sslmode=disable
8. Test your setup using the
serve
command:
Copy code
bash /opt/kratos/bin/kratos -c /opt/kratos/config/kratos.yml serve
You should see something like this once the service has been started:
Copy code
bash INFO[2022-05-10T20:51:56Z] TLS has not been configured for public, skipping  audience=application service_name=Ory Kratos service_version=<version-you-want>   INFO[2022-05-10T20:51:56Z] Starting the public httpd on: 0.0.0.0:4433    audience=application service_name=Ory Kratos service_version=<version-you-want>   INFO[2022-05-10T20:51:56Z] TLS has not been configured for admin, skipping  audience=application service_name=Ory Kratos service_version=<version-you-want>   INFO[2022-05-10T20:51:56Z] Starting the admin httpd on: 0.0.0.0:4434     audience=application service_name=Ory Kratos service_version=<version-you-want>
Please replace
<version-you-want>
with the version of Ory Kratos