3 {! backend/installation/generic_dependencies.include !}
5 ## Installing software used in this guide
7 pkgin should have been installed by the NetBSD installer if you selected
8 the right options. If it isn't installed, install it using pkg_add.
10 Note that `postgresql11-contrib` is needed for the Postgres extensions
13 The `mksh` shell is needed to run the Elixir `mix` script.
15 `# pkgin install acmesh elixir git-base git-docs mksh nginx postgresql11-server postgresql11-client postgresql11-contrib sudo ffmpeg4 ImageMagick`
17 You can also build these packages using pkgsrc:
19 databases/postgresql11-contrib
20 databases/postgresql11-client
21 databases/postgresql11-server
32 Copy the rc.d scripts to the right directory:
35 # cp /usr/pkg/share/examples/rc.d/nginx /usr/pkg/share/examples/rc.d/pgsql /etc/rc.d
38 Add nginx and Postgres to `/etc/rc.conf`:
45 ## Configuring postgres
47 First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`.
49 ### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
51 `# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool`
53 ## Configuring Pleroma
55 Create a user for Pleroma:
59 # useradd -d /home/pleroma -m -g pleroma -s /usr/pkg/bin/mksh pleroma
60 # echo 'export LC_ALL="en_GB.UTF-8"' >> /home/pleroma/.profile
61 # su -l pleroma -c $SHELL
68 $ git clone -b stable https://git.pleroma.social/pleroma/pleroma.git
71 Configure Pleroma. Note that you need a domain name at this point:
74 $ cd /home/pleroma/pleroma
76 $ MIX_ENV=prod mix pleroma.instance gen # You will be asked a few questions here.
79 Since Postgres is configured, we can now initialize the database. There should
80 now be a file in `config/setup_db.psql` that makes this easier. Edit it, and
81 *change the password* to a password of your choice. Make sure it is secure, since
82 it'll be protecting your database. Now initialize the database:
85 $ sudo -Hu pgsql -g pgsql psql -f config/setup_db.psql
88 Postgres allows connections from all users without a password by default. To
89 fix this, edit `/usr/pkg/pgsql/data/pg_hba.conf`. Change every `trust` to
92 Once this is done, restart Postgres with `# /etc/rc.d/pgsql restart`.
94 Run the database migrations.
95 You will need to do this whenever you update with `git pull`:
98 $ MIX_ENV=prod mix ecto.migrate
103 Install the example configuration file
104 `/home/pleroma/pleroma/installation/pleroma.nginx` to
105 `/usr/pkg/etc/nginx.conf`.
107 Note that it will need to be wrapped in a `http {}` block. You should add
108 settings for the nginx daemon outside of the http block, for example:
112 error_log /var/log/nginx/error.log;
121 * Change `ssl_certificate` and `ssl_trusted_certificate` to
122 `/etc/nginx/tls/fullchain`.
123 * Change `ssl_certificate_key` to `/etc/nginx/tls/key`.
124 * Change `example.tld` to your instance's domain name.
126 ## Configuring acme.sh
128 We'll be using acme.sh in Stateless Mode for TLS certificate renewal.
130 First, get your account fingerprint:
133 $ sudo -Hu nginx -g nginx acme.sh --register-account
136 You need to add the following to your nginx configuration for the server
140 location ~ ^/\.well-known/acme-challenge/([-_a-zA-Z0-9]+)$ {
141 default_type text/plain;
142 return 200 "$1.6fXAG9VyG0IahirPEU2ZerUtItW2DHzDzD9wZaEKpqd";
146 Replace the string after after `$1.` with your fingerprint.
151 # /etc/rc.d/nginx start
154 It should now be possible to issue a cert (replace `example.com`
155 with your domain name):
158 $ sudo -Hu nginx -g nginx acme.sh --issue -d example.com --stateless
161 Let's add auto-renewal to `/etc/daily.local`
162 (replace `example.com` with your domain):
165 /usr/pkg/bin/sudo -Hu nginx -g nginx \
166 /usr/pkg/sbin/acme.sh -r \
168 --cert-file /etc/nginx/tls/cert \
169 --key-file /etc/nginx/tls/key \
170 --ca-file /etc/nginx/tls/ca \
171 --fullchain-file /etc/nginx/tls/fullchain \
175 ## Creating a startup script for Pleroma
177 Copy the startup script to the correct location and make sure it's executable:
180 # cp /home/pleroma/pleroma/installation/netbsd/rc.d/pleroma /etc/rc.d/pleroma
181 # chmod +x /etc/rc.d/pleroma
184 Add the following to `/etc/rc.conf`:
188 pleroma_home="/home/pleroma"
189 pleroma_user="pleroma"
192 Run `# /etc/rc.d/pleroma start` to start Pleroma.
196 Restart nginx with `# /etc/rc.d/nginx restart` and you should be up and running.
198 Make sure your time is in sync, or other instances will receive your posts with
199 incorrect timestamps. You should have ntpd running.
201 ## Instances running NetBSD
203 * <https://catgirl.science>
207 {! backend/installation/further_reading.include !}
211 Questions about the installation or didn’t it work as it should be, ask in [#pleroma:libera.chat](https://matrix.to/#/#pleroma:libera.chat) via Matrix or **#pleroma** on **libera.chat** via IRC.