|
@@ -0,0 +1,214 @@
|
|
|
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
+ <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
|
|
+ <head>
|
|
|
+ <title>Install Lemmy Self-Hosted Reddit Alternative on Linux</title>
|
|
|
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
+ <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
|
+ <script type="text/javascript">
|
|
|
+ $(function(){
|
|
|
+ $('textarea').each(function(i,e){
|
|
|
+ theTextarea = $(this);
|
|
|
+ theTextarea.height((theTextarea[0].scrollHeight-5) +'px');
|
|
|
+ });
|
|
|
+
|
|
|
+ $('li').each(function(i,e){
|
|
|
+ var uuid = 'li_' + Math.floor(Math.random() * Math.floor(1000000)).toString() + '_' + i.toString();
|
|
|
+ $(this).contents().wrap('<span id="'+ uuid +'"><label for="cb_'+ uuid +'"></label></span>');
|
|
|
+ $(this).prepend('<input type="checkbox" class="completeBox" id="cb_' + uuid +'" rel="'+ uuid +'" />')
|
|
|
+ });
|
|
|
+
|
|
|
+ $('code,div.codeBlock,textarea.codeBlock').each(function(i,e){
|
|
|
+ theElement = $(this);
|
|
|
+ var lines = theElement.html().split("\n");
|
|
|
+ theElement.empty();
|
|
|
+ for(l=0;l<lines.length;l++){
|
|
|
+ if($.trim(lines[l]) != '' && $.trim(lines[l]).substr(0,1) != '#' && $.trim(lines[l]).indexOf(' #') == -1 && lines[l].substr(0, 4).toUpperCase() != 'REM '){
|
|
|
+ theElement.append('<input type="image" src="images/clipboard.png" value="" class="copy-text" rel="copy_'+ i +'_'+ l +'" data-clipboard-text="'+ $.trim(lines[l].replace(/"/g, '"')) +'" /><span id="copy_'+ i +'_'+ l +'">'+ lines[l] +'</span>');
|
|
|
+ } else {
|
|
|
+ theElement.append(lines[l]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on('click','input.copy-text',function(){
|
|
|
+ theButton = $(this);
|
|
|
+ $('input.copy-text').attr('src','images/clipboard.png');
|
|
|
+ $('span.copy-animation,span.copy-animation-ps').removeClass('copy-animation copy-animation-ps');
|
|
|
+ try {
|
|
|
+ if($('#'+ theButton.attr('rel')).parent('div').hasClass('PS')){
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation-ps');
|
|
|
+ } else if($('#'+ theButton.attr('rel')).parent('div').hasClass('CMD')){
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation-cmd');
|
|
|
+ } else {
|
|
|
+ $('#'+ theButton.attr('rel')).addClass('copy-animation');
|
|
|
+ }
|
|
|
+ navigator.clipboard.writeText(theButton.data('clipboard-text').replace(/<[^>]*>?/gm, ''));
|
|
|
+ theButton.attr('src','images/clipboard_active.png');
|
|
|
+ } catch(err) {
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ $(document).on('click','input.completeBox',function(){
|
|
|
+ theBox = $(this);
|
|
|
+ $('#'+ theBox.attr('rel')).addClass('strikethrough');
|
|
|
+ theBox.prop('disabled',true);
|
|
|
+ theBox.parent('li').prevAll().each(function(i,e){
|
|
|
+ theLI = $(this);
|
|
|
+ if(theLI.find('input[type=checkbox]').not(':checked')){
|
|
|
+ $('#'+ theLI.find('input[type=checkbox]').attr('rel')).addClass('strikethrough');
|
|
|
+ theLI.find('input[type=checkbox]').prop('checked',true).prop('disabled',true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ if(window.self !== window.top){
|
|
|
+ window.parent.$('iframe.stepsFrame').height((this['scrollingElement']['scrollHeight']+20) +'px');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ <link href="css/steps.css" rel="stylesheet" type="text/css" />
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div id="gridContainer">
|
|
|
+ <div class="topMargin"></div>
|
|
|
+ <div id="listName" class="topMargin">
|
|
|
+ <h1>Install Lemmy Self-Hosted Reddit Alternative on Linux</h1>
|
|
|
+ </div>
|
|
|
+ <div></div>
|
|
|
+ <div id="content">
|
|
|
+ <h2>What is Lemmy?</h2>
|
|
|
+
|
|
|
+<p><em>Lemmy is an open-source, federated link aggregator similar to Reddit and built with Rust.</em> -<a href="https://lemmy.ml/" target="_blank">https://lemmy.ml/</a></p>
|
|
|
+
|
|
|
+<ol>
|
|
|
+ <li>Log into the Linux device</li>
|
|
|
+ <li>Run the following commands in a terminal window
|
|
|
+ <div class="codeBlock"># update software repositories<br />
|
|
|
+ sudo apt update<br />
|
|
|
+ # install available software updates<br />
|
|
|
+ sudo apt upgrade -y<br />
|
|
|
+ # install prerequisites<br />
|
|
|
+ sudo apt install git build-essential gcc libssl-dev pkg-config libpq-dev curl gnupg2 espeak postgresql -y<br />
|
|
|
+ # enable the postgresql service and start it<br />
|
|
|
+ sudo systemctl enable postgresql --now<br />
|
|
|
+ # connect to postgresql<br />
|
|
|
+ sudo -u postgres psql postgres<br />
|
|
|
+ # create lemmy database user<br />
|
|
|
+ create user lemmy with password 'L3mmy' superuser;<br />
|
|
|
+ # create lemmy database<br />
|
|
|
+ create database lemmy with owner lemmy;<br />
|
|
|
+ # close postgresql connection<br />
|
|
|
+ exit<br />
|
|
|
+ # add nodejs software repository<br />
|
|
|
+ curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -<br />
|
|
|
+ # install nodejs<br />
|
|
|
+ sudo apt install nodejs -y<br />
|
|
|
+ # install yarn<br />
|
|
|
+ sudo npm install -g yarn<br />
|
|
|
+ # create lemmy user<br />
|
|
|
+ sudo useradd -m -d /opt/lemmy lemmy<br />
|
|
|
+ # install rust, enter 1 at the prompt<br />
|
|
|
+ curl https://sh.rustup.rs -sSf | sh<br />
|
|
|
+ # configure the shell<br />
|
|
|
+ source $HOME/.cargo/env<br />
|
|
|
+ # clone the lemmy git repository<br />
|
|
|
+ git clone https://github.com/LemmyNet/lemmy.git ./server<br />
|
|
|
+ # change directory to the source code<br />
|
|
|
+ cd server<br />
|
|
|
+ # build lemmy<br />
|
|
|
+ cargo build --release<br />
|
|
|
+ # change directory out of lemmy server<br />
|
|
|
+ cd ..<br />
|
|
|
+ # move lemmy to /opt/lemmy<br />
|
|
|
+ sudo mv ./server /opt/lemmy/<br />
|
|
|
+ # switch user to lemmy<br />
|
|
|
+ sudo su lemmy<br />
|
|
|
+ # change directory to lemmy home<br />
|
|
|
+ cd ~<br />
|
|
|
+ # print working directory, should output /opt/lemmy<br />
|
|
|
+ pwd<br />
|
|
|
+ # clone lemmy frontend<br />
|
|
|
+ git clone https://github.com/LemmyNet/lemmy-ui.git --recurse-submodules ./lemmy-ui<br />
|
|
|
+ # change directory to lemmy-ui<br />
|
|
|
+ cd lemmy-ui<br />
|
|
|
+ # clean npm cache<br />
|
|
|
+ npm cache clean --force<br />
|
|
|
+ # install npm dependencies<br />
|
|
|
+ npm install<br />
|
|
|
+ # fix npm vulnerabilities<br />
|
|
|
+ npm audit fix<br />
|
|
|
+ # build lemmy-ui<br />
|
|
|
+ yarn build:prod<br />
|
|
|
+ # exit lemmy shell<br />
|
|
|
+ exit<br />
|
|
|
+ # create lemmy service file<br />
|
|
|
+ sudo nano /etc/systemd/system/lemmy.service</div>
|
|
|
+ </li>
|
|
|
+ <li>Paste the following configuration into lemmy.service
|
|
|
+ <p>[Unit]<br />
|
|
|
+ Description=Lemmy</p>
|
|
|
+
|
|
|
+ <p>[Service]<br />
|
|
|
+ User=lemmy<br />
|
|
|
+ Group=lemmy<br />
|
|
|
+ Environment=LEMMY_DATABASE_URL=postgres://lemmy:L3mmy@localhost:5432/lemmy<br />
|
|
|
+ ExecStart=/opt/lemmy/server/target/release/lemmy_server<br />
|
|
|
+ WorkingDirectory=/opt/lemmy/server</p>
|
|
|
+
|
|
|
+ <p>[Install]<br />
|
|
|
+ WantedBy=multi-user.target</p>
|
|
|
+ </li>
|
|
|
+ <li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
|
|
|
+ <li>Continue with the following commands
|
|
|
+ <div class="codeBlock"># create lemmy-ui service bash file<br />
|
|
|
+ sudo nano /opt/lemmy/lemmy-ui/lemmy-ui.sh</div>
|
|
|
+ </li>
|
|
|
+ <li>Paste the following configuration into lemmy-ui.sh
|
|
|
+ <p>#!/usr/bin/bash<br />
|
|
|
+ /usr/bin/node /opt/lemmy/lemmy-ui/dist/js/server.js</p>
|
|
|
+ </li>
|
|
|
+ <li>Continue with the following commands
|
|
|
+ <div class="codeBlock"># make lemmy-ui.sh executable<br />
|
|
|
+ sudo chmod +x /opt/lemmy/lemmy-ui/lemmy-ui.sh<br />
|
|
|
+ # create lemmy service file<br />
|
|
|
+ sudo nano /etc/systemd/system/lemmy-ui.service</div>
|
|
|
+ </li>
|
|
|
+ <li>Paste the following configuration into lemmy-ui.service
|
|
|
+ <p>[Unit]<br />
|
|
|
+ Description=Lemmy-UI</p>
|
|
|
+
|
|
|
+ <p>[Service]<br />
|
|
|
+ ExecStart=/opt/lemmy/lemmy-ui/lemmy-ui.sh<br />
|
|
|
+ Restart=always<br />
|
|
|
+ User=lemmy<br />
|
|
|
+ Group=lemmy<br />
|
|
|
+ Environment=PATH=/usr/bin:/usr/local/bin<br />
|
|
|
+ Environment=NODE_ENV=production<br />
|
|
|
+ WorkingDirectory=/opt/lemmy/lemmy-ui</p>
|
|
|
+
|
|
|
+ <p>[Install]<br />
|
|
|
+ WantedBy=multi-user.target</p>
|
|
|
+ </li>
|
|
|
+ <li>Press CTRL+O, Enter, CTRL+X to write the changes</li>
|
|
|
+ <li>Continue with the following commands
|
|
|
+ <div class="codeBlock"># reload systemd services<br />
|
|
|
+ sudo systemctl daemon-reload<br />
|
|
|
+ # start lemmy service on boot and now<br />
|
|
|
+ sudo systemctl enable lemmy --now<br />
|
|
|
+ # start lemmy-ui service on boot and now<br />
|
|
|
+ sudo systemctl enable lemmy-ui --now</div>
|
|
|
+ </li>
|
|
|
+ <li>Open a web browser and navigate to http://DNSorIP:1234</li>
|
|
|
+ <li>Enter a username, email and password to create a site administrator account > Click Sign Up</li>
|
|
|
+ <li>Enter a site name and any additional optional values > Click Create</li>
|
|
|
+ <li>Welcome to Lemmy</li>
|
|
|
+</ol>
|
|
|
+
|
|
|
+<p>Sources: <a href="https://join-lemmy.org/docs/en/contributing/local_development.html" target="_blank">https://join-lemmy.org/docs/en/contributing/local_development.html</a>,<br />
|
|
|
+<a href="https://join-lemmy.org/docs/en/administration/from_scratch.html" target="_blank">https://join-lemmy.org/docs/en/administration/from_scratch.html</a></p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </body>
|
|
|
+ </html>
|
|
|
+
|