Experience and tips based off these Ubuntu 20.04 instructions:
https://join-lemmy.org/docs/en/administration/from_scratch.html

I thought trying to detail problems and extra steps in public might help some people.

RoundSparrow
creator
banned
link
fedilink
2
edit-2
1Y

I ran as root:

cargo install lemmy_server --target-dir /usr/bin/ --locked --features embed-pictrs

And the final lines of output said:

Installing /root/.cargo/bin/lemmy_server
Installed package `lemmy_server v0.17.3` (executable `lemmy_server`)

Which is not where the install expects the binary to be, in /root/.cargo - isn’t the “target-dir” being ignored here or something?

RoundSparrow
creator
banned
link
fedilink
11Y

This is where I am currently stuck.

I manually did:

cp /root/.cargo/bin/lemmy_server /usr/bin

Next:

systemctl start lemmy

But the journalctl -u lemmy logs show that it is unable to run the DB Migrations:

lemmy_server: INFO lemmy_db_schema::utils: Running Database migrations (This may take a lo>
lemmy_server: thread ‘main’ panicked at ‘Couldn’t run DB Migrations’

There is an issue with the cargo build. It works if you build from git as follows. Make sure you are using release tags as the main branch will break things. Current built as of this message is 0.17.3. Both the front and back end need to match. Rustup needs to already be installed and the shell PATH configured.

Database. Follow the doc and then run this command:
sudo -iu postgres psql -c "ALTER USER lemmy WITH SUPERUSER;"

Back end:
mkdir -p /root/lemmy/
cd /root/lemmy/

git clone https://github.com/LemmyNet/lemmy.git --recursive .
git branch -a
git checkout 0.17.3
echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"

cargo build --release --target-dir /root/lemmy/ --locked --features embed-pictrs
mv /root/lemmy/release/lemmy_server /usr/bin/lemmy_server

Front end:
mkdir /var/lib/lemmy-ui
cd /var/lib/lemmy-ui
chown lemmy:lemmy .

sudo -u lemmy bash
git clone https://github.com/LemmyNet/lemmy-ui.git --recursive .
git checkout 0.17.3
echo "export const VERSION = \"v$(git describe --tag)\";" > "/var/lib/lemmy-ui/src/shared/version.ts"
yarn install --pure-lockfile
npx browserslist@latest --update-db
yarn build:prod

Past that use the systemd unit files from the build from scratch doc: https://join-lemmy.org/docs/en/administration/from_scratch.html

RoundSparrow
creator
banned
link
fedilink
2
edit-2
1Y

Front end:

are your ‘git pull’ instructions incomplete? I did:
git clone https://github.com/LemmyNet/lemmy-ui.git --recursive .

Whoops… Yes you are correct. I had switched to git pull since that’s what I will use going forward to update.

I’ve update the above text so hopefully it is a complete guide.

RoundSparrow
creator
banned
link
fedilink
2
edit-2
1Y

On Back end: I’m still running into the same problem as 2 other people have reported, the log file shows:

thread 'main' panicked at 'Couldn't run DB Migrations', crates/db_schema/src/utils.rs:165:25

I did try the drop table and create table you posted on Reddit thread, didn’t help, always runs into DB Migrations failure on attempt to start lemmy_server

Try this:
sudo -iu postgres psql -c "ALTER USER lemmy WITH SUPERUSER;"

You might need to dump the DB before restarting lemmy_server
sudo -iu postgres psql -c "DROP DATABASE lemmy;"
sudo -iu postgres psql -c "CREATE DATABASE lemmy WITH OWNER lemmy ENCODING 'UTF8' TEMPLATE template0 LC_COLLATE 'C' LC_CTYPE 'C';"

RoundSparrow
creator
banned
link
fedilink
2
edit-2
1Y

sudo -iu postgres psql -c “ALTER USER lemmy WITH SUPERUSER;”

Ok, that seems to have helped!
curl localhost:8536/api/v3/site now works!

Lemmy logs everything, and I mean everything. I haven’t found a setting to dial it back so I’ve banned it from writing to syslog and moved journal to memory only. Here is what I ran to stop it from filling up my disk with logs.

echo 'if $programname == "lemmy_server" then stop' >> /etc/rsyslog.d/ignore-lemmy_server.conf
systemctl restart rsyslog

sed -i 's/#SystemMaxUse=/SystemMaxUse=25M/g' /etc/systemd/journald.conf
sed -i 's/#Storage=auto/Storage=volatile/g' /etc/systemd/journald.conf systemctl restart systemd-journald

curl localhost:8536/api/v3/site now works!

Nice! Sorry my notes are a mess and nothing is in order since I was trying a lot of different things at the time.

RoundSparrow
creator
banned
link
fedilink
2
edit-2
1Y

Compared to your reply on Reddit: here you have cargo build to be run before and after doing the checkout of 0.17.3? twice?

I just updated my comment to fix those two errors. This was copy/paste out of my notes txt file from figuring out how to do this.

A dot after recursive will drop the git files into the current directory. In this case /root/lemmy/
git clone https://github.com/LemmyNet/lemmy.git --recursive .

And don’t run that first cargo command that I’ve since removed. Only the second one, now only one. This uses the git cargo files instead of the crates app (install lemmy_server.)
cargo build --release --target-dir /root/lemmy/ --locked --features embed-pictrs

RoundSparrow
creator
banned
link
fedilink
21Y

Ok, thanks.

Let me know if it works. I had the same DB migration issues using the install lemmy_server options and found a post, I think on github, about there being an issues with there. I can’t find that post now.

RoundSparrow
creator
banned
link
fedilink
2
edit-2
1Y

needed to install some packages

 apt  install protobuf-compiler

Yeah I installed that too. Does this resolve the issue with the target-dir though?

This post seemed promising but didn’t work for me either https://lemmy.ml/comment/468003

RoundSparrow
creator
banned
link
fedilink
21Y

Seems like we are stuck with the same issues.

RoundSparrow
creator
banned
link
fedilink
11Y

After installing lemmy-ui, which seems to work with curl on port 1234

docs section “Configure reverse proxy and TLS”

Aren’t these instructions kind of backwards? Shouldn’t you put the nginix config file on the disk before you generate the certificate?

RoundSparrow
creator
banned
link
fedilink
11Y

lemmy-ui and nodejs versions

The from_scratch instructions say to install node 12.x, that’s really old. Can this run on node version 20?

RoundSparrow
creator
banned
link
fedilink
1
edit-2
1Y

Ubuntu 22.04’s nodejs is old, so I did this as root:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs yarn

Note that this is 20.x and not the 12.x in the current from_scratch instructions.

I really need to reinstall my Ubuntu 22.04.2 from scratch and re-test all these steps, as there was a lot of other things I tried that failed and system is now kind of cluttered up and not sure these are all the steps that actually worked.

RoundSparrow
creator
banned
link
fedilink
11Y

4 hours ago (as of this comment), someone created a posting in !lemmy_support@lemmy.ml on the same topic: https://lemmy.ml/post/1165322

RoundSparrow
creator
banned
link
fedilink
1
edit-2
1Y

Assumption: Do these instructions assume you are doing everything as root? I did run as root… none of the instructions had a ‘sudo’, so I assumed root?

RoundSparrow
creator
banned
link
fedilink
1
edit-2
1Y

deleted by creator

Lemmy Administration
!lemmy_admin@lemmy.ml

    Anything about running your own Lemmy instance. Including how to install it, maintain and customise it.

    Be sure to check out the docs: https://join-lemmy.org/docs/en/administration/administration.html

    If you have any problems, describe them here and we will try to help you fixing them.

    • 0 users online
    • 5 users / day
    • 2 users / week
    • 2 users / month
    • 2 users / 6 months
    • 1 subscriber
    • 61 Posts
    • 265 Comments
    • Modlog