Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- #
- # Install dependencies
- apt install curl unzip libncurses5 postgresql postgresql-contrib nginx certbot libmagic-dev -y
- #
- # Install optional dependencies (# next line if you don't want them)
- apt install imagemagick ffmpeg libimage-exiftool-perl -y
- sleep 3
- clear
- #
- # Time to start setup
- echo "Let's begin setup shall we"
- sleep 3
- # Installing Postgresql RUM indexes
- # Available only on Buster/19.04
- # NOTE: Check version manually. install instructions said 11 but i had to get 12.
- #
- apt install postgresql-12-rum -y
- # Restart Postgresql
- systemctl restart postgresql
- #
- # Installing Pleroma (script coppied from website instructions below)
- # Create a Pleroma user
- adduser --system --shell /bin/false --home /opt/pleroma pleroma
- #
- # Set the flavour environment variable to the string you got in Detecting flavour section.
- # For example if the flavour is `amd64-musl` the command will be
- # NOTE: change to proper arch
- export FLAVOUR="amd64-musl"
- #
- # Clone the release build into a temporary directory and unpack it
- su pleroma -s $SHELL -lc "
- curl 'https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=$FLAVOUR' -o /tmp/pleroma.zip
- unzip /tmp/pleroma.zip -d /tmp/
- "
- #
- # Move the release to the home directory and delete temporary files
- su pleroma -s $SHELL -lc "
- mv /tmp/release/* /opt/pleroma
- rmdir /tmp/release
- rm /tmp/pleroma.zip
- "
- # Create uploads directory and set proper permissions (skip if planning to use a remote uploader)
- # Note: It does not have to be `/var/lib/pleroma/uploads`, the config generator will ask about the upload directory later
- #
- mkdir -p /var/lib/pleroma/uploads
- chown -R pleroma /var/lib/pleroma
- #
- # Create custom public files directory (custom emojis, frontend bundle overrides, robots.txt, etc.)
- # Note: It does not have to be `/var/lib/pleroma/static`, the config generator will ask about the custom public files directory later
- mkdir -p /var/lib/pleroma/static
- chown -R pleroma /var/lib/pleroma
- #
- # Create a config directory
- mkdir -p /etc/pleroma
- chown -R pleroma /etc/pleroma
- #
- # Run the config generator
- touch /etc/pleroma/config.exs
- chown -R pleroma /etc/pleroma
- su pleroma -s $SHELL -lc "./bin/pleroma_ctl instance gen --force --output /etc/pleroma/config.exs --output-psql /tmp/setup_db.psql"
- #
- # Create the postgres database
- su postgres -s $SHELL -lc "psql -f /tmp/setup_db.psql"
- #
- # Create the database schema
- su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate"
- #
- # If you have installed RUM indexes uncommend and run
- # su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
- #
- # Start the instance to verify that everything is working as expected
- su pleroma -s $SHELL -lc "./bin/pleroma daemon"
- #
- # Wait for about 20 seconds and query the instance endpoint, if it shows your uri, name and email correctly, you are configured correctly
- sleep 20 && curl http://localhost:4000/api/v1/instance
- #
- # Stop the instance
- su pleroma -s $SHELL -lc "./bin/pleroma stop"
- #
- # Setup Lets Encrypt
- # NOTE: change yourinstance.tld to your domain name below
- systemctl stop nginx.service
- certbot certonly --standalone --preferred-challenges http -d yourinstance.tld
- #
- # Copy Pleroma nginx configuration to the nginx folder
- cp /opt/pleroma/installation/pleroma.nginx /etc/nginx/sites-available/pleroma.conf
- ln -s /etc/nginx/sites-available/pleroma.conf /etc/nginx/sites-enabled/pleroma.conf
- #
- #
- # visit https://docs.pleroma.social/backend/installation/otp_en/
- # Refer to the section titled "Edit the nginx config"
- # NOTE: you need to replace yourinstance.tld with the domain name in /etc/nginx/sites-availible/pleroma.conf
- # That line appears a number of times. use the find command in your editor.
- #
- #
- #systemctl start nginx.service
- #
- #Setup Pleroma service at boot (copied from install instructions)
- # Copy the service into a proper directory
- #cp /opt/pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service
- #
- # Start pleroma and enable it on boot
- #systemctl start pleroma
- #systemctl enable pleroma
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement