Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

netbsd_en.md 4.7KB

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