Install Lemmy Self-Hosted Reddit Alternative on Linux

Channel:
Subscribers:
14,900
Published on ● Video Link: https://www.youtube.com/watch?v=OYFkWfdN3cg



Duration: 3:31
432 views
5


#Lemmy #Self-Hosted #Linux

Full steps can be found at https://i12bretro.github.io/tutorials/0583.html

What is Lemmy?
Lemmy is an open-source, federated link aggregator similar to Reddit and built with Rust. - https://lemmy.ml/
 
   01. Log into the Linux device
   02. Run the following commands in a terminal window
         # update software repositories
         sudo apt update
         # install available software updates
         sudo apt upgrade -y
         # install prerequisites
         sudo apt install git build-essential gcc libssl-dev pkg-config libpq-dev curl gnupg2 espeak postgresql -y
         # enable the postgresql service and start it
         sudo systemctl enable postgresql --now
         # connect to postgresql
         sudo -u postgres psql postgres
         # create lemmy database user
         create user lemmy with password 'L3mmy' superuser;
         # create lemmy database
         create database lemmy with owner lemmy;
         # close postgresql connection
         exit
         # add nodejs software repository
         curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
         # install nodejs
         sudo apt install nodejs -y
         # install yarn
         sudo npm install -g yarn
         # create lemmy user
         sudo useradd -m -d /opt/lemmy lemmy
         # install rust, enter 1 at the prompt
         curl https://sh.rustup.rs -sSf | sh
         # configure the shell
         source $HOME/.cargo/env
         # clone the lemmy git repository
         git clone https://github.com/LemmyNet/lemmy.git ./server
         # change directory to the source code
         cd server
         # build lemmy
         cargo build --release
         # change directory out of lemmy server
         cd ..
         # move lemmy to /opt/lemmy
         sudo mv ./server /opt/lemmy/
         # switch user to lemmy
         sudo su lemmy
         # change directory to lemmy home
         cd ~
         # print working directory, should output /opt/lemmy
         pwd
         # clone lemmy frontend
         git clone https://github.com/LemmyNet/lemmy-ui.git --recurse-submodules ./lemmy-ui
         # change directory to lemmy-ui
         cd lemmy-ui
         # clean npm cache
         npm cache clean --force
         # install npm dependencies
         npm install
         # fix npm vulnerabilities
         npm audit fix
         # build lemmy-ui
         yarn build:prod
         # exit lemmy shell
         exit
         # create lemmy service file
         sudo nano /etc/systemd/system/lemmy.service
   03. Paste the following configuration into lemmy.service
         [Unit]
         Description=Lemmy
         [Service]
         User=lemmy
         Group=lemmy
         Environment=LEMMY_DATABASE_URL=postgres://lemmy:L3mmy@localhost:5432/lemmy
         ExecStart=/opt/lemmy/server/target/release/lemmy_server
         WorkingDirectory=/opt/lemmy/server
         [Install]
         WantedBy=multi-user.target
   04. Press CTRL+O, Enter, CTRL+X to write the changes
   05. Continue with the following commands
         # create lemmy-ui service bash file
         sudo nano /opt/lemmy/lemmy-ui/lemmy-ui.sh
   06. Paste the following configuration into lemmy-ui.sh
         #!/usr/bin/bash
         /usr/bin/node /opt/lemmy/lemmy-ui/dist/js/server.js
   07. Continue with the following commands
         # make lemmy-ui.sh executable
         sudo chmod +x /opt/lemmy/lemmy-ui/lemmy-ui.sh
         # create lemmy service file
         sudo nano /etc/systemd/system/lemmy-ui.service
   08. Paste the following configuration into lemmy-ui.service
         [Unit]
         Description=Lemmy-UI
         [Service]
         ExecStart=/opt/lemmy/lemmy-ui/lemmy-ui.sh
         Restart=always
         User=lemmy
         Group=lemmy
         Environment=PATH=/usr/bin:/usr/local/bin
         Environment=NODE_ENV=production
         WorkingDirectory=/opt/lemmy/lemmy-ui
         [Install]
         WantedBy=multi-user.target
   09. Press CTRL+O, Enter, CTRL+X to write the changes
   10. Continue with the following commands
         # reload systemd services
         sudo systemctl daemon-reload
         # start lemmy service on boot and now
         sudo systemctl enable lemmy --now
         # start lemmy-ui service on boot and now
         sudo systemctl enable lemmy-ui --now
   11. Open a web browser and navigate to http://DNSorIP:1234
   12. Enter a username, email and password to create a site administrator account ≫ Click Sign Up
   13. Enter a site name and any additional optional values ≫ Click Create
   14. Welcome to Lemmy
 
Sources:  https://join-lemmy.org/docs/en/contributing/local_development.html,
 https://join-lemmy.org/docs/en/administration/from_scratch.html
 


### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro







Tags:
Self-Hosted Reddit Alternative
Install Lemmy on Linux
Install Lemmy on Debian
Lemmy
Reddit
Self-Hosted
Linux
Link Aggregator
Open Source
Install Guide
Home Lab
Browser Based
Web Based
How To
Tutorial
i12bretro