4 #### Build requirements:
6 sudo apt install git cargo libssl-dev pkg-config libpq-dev yarn curl gnupg2 git
8 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
9 echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
10 sudo apt update && sudo apt install yarn
13 #### Get the source code
15 git clone https://github.com/LemmyNet/lemmy.git
16 # or alternatively from gitea
17 # git clone https://yerbamate.dev/LemmyNet/lemmy.git
20 All the following commands need to be run either in `lemmy/server` or `lemmy/ui`, as indicated
23 #### Build the backend (Rust)
27 # for development, use `cargo check` instead)
30 #### Build the frontend (Typescript)
39 sudo apt install postgresql
40 sudo systemctl start postgresql
41 # initialize postgres database
42 sudo -u postgres psql -c "create user lemmy with password 'password' superuser;" -U postgres
43 sudo -u postgres psql -c 'create database lemmy with owner lemmy;' -U postgres
44 export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
45 # or execute server/db-init.sh
48 #### Run a local development instance
50 # run each of these in a seperate terminal
51 cd server && cargo run
55 Then open [localhost:4444](http://localhost:4444) in your browser. It will auto-refresh if you edit
56 any frontend files. For backend coding, you will have to rerun `cargo run`. You can use
57 `cargo check` as a faster way to find compilation errors.
59 To speed up incremental builds, you can add the following to `~/.cargo/config`:
61 [target.x86_64-unknown-linux-gnu]
62 rustflags = ["-Clink-arg=-fuse-ld=lld"]
65 Note that this setup doesn't include image uploads or link previews (provided by pict-rs and
66 iframely respectively). If you want to test those, you should use the
67 [Docker development](contributing_docker_development.md).