1 ### Install build requirements
4 sudo apt install git cargo libssl-dev pkg-config libpq-dev yarn curl gnupg2 espeak
6 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
7 echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
8 sudo apt update && sudo apt install yarn
13 Install Rust using [the recommended option on rust-lang.org](https://www.rust-lang.org/tools/install) (rustup).
15 Then, install [Homebrew](https://brew.sh/) if you don't already have it installed.
17 Finally, install Node and Yarn.
20 brew install node yarn
23 ### Get the source code
25 git clone https://github.com/LemmyNet/lemmy.git
26 # or alternatively from gitea
27 # git clone https://yerbamate.dev/LemmyNet/lemmy.git
30 All the following commands need to be run either in `lemmy/server` or `lemmy/ui`, as indicated
33 ### Build the backend (Rust)
37 # for development, use `cargo check` instead)
40 ### Build the frontend (Typescript)
50 sudo apt install postgresql
51 sudo systemctl start postgresql
53 # Either execute server/db-init.sh, or manually initialize the postgres database:
54 sudo -u postgres psql -c "create user lemmy with password 'password' superuser;" -U postgres
55 sudo -u postgres psql -c 'create database lemmy with owner lemmy;' -U postgres
56 export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
61 brew install postgresql
62 brew services start postgresql
63 /usr/local/opt/postgres/bin/createuser -s postgres
65 # Either execute server/db-init.sh, or manually initialize the postgres database:
66 psql -c "create user lemmy with password 'password' superuser;" -U postgres
67 psql -c 'create database lemmy with owner lemmy;' -U postgres
68 export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
71 ### Run a local development instance
73 # run each of these in a seperate terminal
74 cd server && cargo run
78 Then open [localhost:4444](http://localhost:4444) in your browser. It will auto-refresh if you edit
79 any frontend files. For backend coding, you will have to rerun `cargo run`. You can use
80 `cargo check` as a faster way to find compilation errors.
82 To speed up incremental builds, you can add the following to `~/.cargo/config`:
84 [target.x86_64-unknown-linux-gnu]
85 rustflags = ["-Clink-arg=-fuse-ld=lld"]
88 Note that this setup doesn't include image uploads or link previews (provided by pict-rs and
89 iframely respectively). If you want to test those, you should use the
90 [Docker development](contributing_docker_development.md).