logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

netbsd_en.md (5609B)


  1. # Installing on NetBSD
  2. {! backend/installation/generic_dependencies.include !}
  3. ## Installing software used in this guide
  4. pkgin should have been installed by the NetBSD installer if you selected
  5. the right options. If it isn't installed, install it using pkg_add.
  6. Note that `postgresql11-contrib` is needed for the Postgres extensions
  7. Pleroma uses.
  8. The `mksh` shell is needed to run the Elixir `mix` script.
  9. `# pkgin install acmesh elixir git-base git-docs mksh nginx postgresql11-server postgresql11-client postgresql11-contrib sudo ffmpeg4 ImageMagick`
  10. You can also build these packages using pkgsrc:
  11. ```
  12. databases/postgresql11-contrib
  13. databases/postgresql11-client
  14. databases/postgresql11-server
  15. devel/git-base
  16. devel/git-docs
  17. devel/cmake
  18. lang/elixir
  19. security/acmesh
  20. security/sudo
  21. shells/mksh
  22. www/nginx
  23. ```
  24. Copy the rc.d scripts to the right directory:
  25. ```
  26. # cp /usr/pkg/share/examples/rc.d/nginx /usr/pkg/share/examples/rc.d/pgsql /etc/rc.d
  27. ```
  28. Add nginx and Postgres to `/etc/rc.conf`:
  29. ```
  30. nginx=YES
  31. pgsql=YES
  32. ```
  33. ## Configuring postgres
  34. First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`.
  35. ### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
  36. `# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool`
  37. ## Configuring Pleroma
  38. Create a user for Pleroma:
  39. ```
  40. # groupadd pleroma
  41. # useradd -d /home/pleroma -m -g pleroma -s /usr/pkg/bin/mksh pleroma
  42. # echo 'export LC_ALL="en_GB.UTF-8"' >> /home/pleroma/.profile
  43. # su -l pleroma -c $SHELL
  44. ```
  45. Clone the repository:
  46. ```
  47. $ cd /home/pleroma
  48. $ git clone -b stable https://git.pleroma.social/pleroma/pleroma.git
  49. ```
  50. Configure Pleroma. Note that you need a domain name at this point:
  51. ```
  52. $ cd /home/pleroma/pleroma
  53. $ mix deps.get
  54. $ MIX_ENV=prod mix pleroma.instance gen # You will be asked a few questions here.
  55. ```
  56. Since Postgres is configured, we can now initialize the database. There should
  57. now be a file in `config/setup_db.psql` that makes this easier. Edit it, and
  58. *change the password* to a password of your choice. Make sure it is secure, since
  59. it'll be protecting your database. Now initialize the database:
  60. ```
  61. $ sudo -Hu pgsql -g pgsql psql -f config/setup_db.psql
  62. ```
  63. Postgres allows connections from all users without a password by default. To
  64. fix this, edit `/usr/pkg/pgsql/data/pg_hba.conf`. Change every `trust` to
  65. `password`.
  66. Once this is done, restart Postgres with `# /etc/rc.d/pgsql restart`.
  67. Run the database migrations.
  68. You will need to do this whenever you update with `git pull`:
  69. ```
  70. $ MIX_ENV=prod mix ecto.migrate
  71. ```
  72. ## Configuring nginx
  73. Install the example configuration file
  74. `/home/pleroma/pleroma/installation/pleroma.nginx` to
  75. `/usr/pkg/etc/nginx.conf`.
  76. Note that it will need to be wrapped in a `http {}` block. You should add
  77. settings for the nginx daemon outside of the http block, for example:
  78. ```
  79. user nginx nginx;
  80. error_log /var/log/nginx/error.log;
  81. worker_processes 4;
  82. events {
  83. }
  84. ```
  85. Edit the defaults:
  86. * Change `ssl_certificate` and `ssl_trusted_certificate` to
  87. `/etc/nginx/tls/fullchain`.
  88. * Change `ssl_certificate_key` to `/etc/nginx/tls/key`.
  89. * Change `example.tld` to your instance's domain name.
  90. ### (Strongly recommended) serve media on another domain
  91. Refer to the [Hardening your instance](../configuration/hardening.md) document on how to serve media on another domain. We STRONGLY RECOMMEND you to do this to minimize attack vectors.
  92. ## Configuring acme.sh
  93. We'll be using acme.sh in Stateless Mode for TLS certificate renewal.
  94. First, get your account fingerprint:
  95. ```
  96. $ sudo -Hu nginx -g nginx acme.sh --register-account
  97. ```
  98. You need to add the following to your nginx configuration for the server
  99. running on port 80:
  100. ```
  101. location ~ ^/\.well-known/acme-challenge/([-_a-zA-Z0-9]+)$ {
  102. default_type text/plain;
  103. return 200 "$1.6fXAG9VyG0IahirPEU2ZerUtItW2DHzDzD9wZaEKpqd";
  104. }
  105. ```
  106. Replace the string after after `$1.` with your fingerprint.
  107. Start nginx:
  108. ```
  109. # /etc/rc.d/nginx start
  110. ```
  111. It should now be possible to issue a cert (replace `example.com`
  112. with your domain name):
  113. ```
  114. $ sudo -Hu nginx -g nginx acme.sh --issue -d example.com --stateless
  115. ```
  116. Let's add auto-renewal to `/etc/daily.local`
  117. (replace `example.com` with your domain):
  118. ```
  119. /usr/pkg/bin/sudo -Hu nginx -g nginx \
  120. /usr/pkg/sbin/acme.sh -r \
  121. -d example.com \
  122. --cert-file /etc/nginx/tls/cert \
  123. --key-file /etc/nginx/tls/key \
  124. --ca-file /etc/nginx/tls/ca \
  125. --fullchain-file /etc/nginx/tls/fullchain \
  126. --stateless
  127. ```
  128. ## Creating a startup script for Pleroma
  129. Copy the startup script to the correct location and make sure it's executable:
  130. ```
  131. # cp /home/pleroma/pleroma/installation/netbsd/rc.d/pleroma /etc/rc.d/pleroma
  132. # chmod +x /etc/rc.d/pleroma
  133. ```
  134. Add the following to `/etc/rc.conf`:
  135. ```
  136. pleroma=YES
  137. pleroma_home="/home/pleroma"
  138. pleroma_user="pleroma"
  139. ```
  140. Run `# /etc/rc.d/pleroma start` to start Pleroma.
  141. ## Conclusion
  142. Restart nginx with `# /etc/rc.d/nginx restart` and you should be up and running.
  143. Make sure your time is in sync, or other instances will receive your posts with
  144. incorrect timestamps. You should have ntpd running.
  145. ## Instances running NetBSD
  146. * <https://catgirl.science>
  147. #### Further reading
  148. {! backend/installation/further_reading.include !}
  149. ## Questions
  150. 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.