2020-07-20 14:03:15 +00:00
### Install build requirements
#### Ubuntu
2020-06-09 23:13:51 +00:00
```
2020-08-01 23:14:54 +00:00
sudo apt install git cargo libssl-dev pkg-config libpq-dev yarn curl gnupg2 espeak
2020-06-09 23:13:51 +00:00
# install yarn
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
sudo apt update & & sudo apt install yarn
```
2019-12-31 14:31:34 +00:00
2020-07-20 14:03:15 +00:00
#### macOS
Install Rust using [the recommended option on rust-lang.org ](https://www.rust-lang.org/tools/install ) (rustup).
Then, install [Homebrew ](https://brew.sh/ ) if you don't already have it installed.
Finally, install Node and Yarn.
```
brew install node yarn
```
2020-09-15 19:26:47 +00:00
### Get the back end source code
2020-06-09 23:13:51 +00:00
```
git clone https://github.com/LemmyNet/lemmy.git
# or alternatively from gitea
2020-11-03 21:50:59 +00:00
# git clone https://yerbamate.ml/LemmyNet/lemmy.git
2020-06-09 23:13:51 +00:00
```
2020-07-20 14:03:15 +00:00
### Build the backend (Rust)
2020-06-09 23:13:51 +00:00
```
cargo build
# for development, use `cargo check` instead)
2020-02-06 20:25:13 +00:00
```
2020-09-15 19:26:47 +00:00
### Get the front end source code
2020-06-09 23:13:51 +00:00
```
2020-09-15 19:26:47 +00:00
git clone https://github.com/LemmyNet/lemmy-ui.git
2020-10-07 16:08:03 +00:00
# get the translations
git submodule init
2020-10-07 16:09:56 +00:00
git submodule update --remote
2020-06-09 23:13:51 +00:00
```
2020-02-06 20:25:13 +00:00
2020-07-20 14:03:15 +00:00
### Setup postgresql
#### Ubuntu
2020-06-09 23:13:51 +00:00
```
sudo apt install postgresql
sudo systemctl start postgresql
2020-07-20 14:03:15 +00:00
2020-09-15 19:26:47 +00:00
# Either execute db-init.sh, or manually initialize the postgres database:
2020-06-09 23:13:51 +00:00
sudo -u postgres psql -c "create user lemmy with password 'password' superuser;" -U postgres
sudo -u postgres psql -c 'create database lemmy with owner lemmy;' -U postgres
2020-02-06 20:25:13 +00:00
export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
2019-12-31 14:31:34 +00:00
```
2020-07-20 14:03:15 +00:00
#### macOS
```
brew install postgresql
brew services start postgresql
/usr/local/opt/postgres/bin/createuser -s postgres
2020-09-15 19:26:47 +00:00
# Either execute db-init.sh, or manually initialize the postgres database:
2020-07-20 14:03:15 +00:00
psql -c "create user lemmy with password 'password' superuser;" -U postgres
psql -c 'create database lemmy with owner lemmy;' -U postgres
export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
```
### Run a local development instance
2019-12-31 14:31:34 +00:00
```
2020-09-15 19:26:47 +00:00
cd lemmy
cargo run
2020-06-09 23:13:51 +00:00
```
2020-09-15 19:26:47 +00:00
Then open [localhost:1235 ](http://localhost:1235 ) in your browser. To reload back-end changes, you will have to rerun `cargo run` . You can use `cargo check` as a faster way to find compilation errors.
To do front end development:
2020-06-09 23:13:51 +00:00
2020-06-12 13:29:50 +00:00
```
2020-09-15 19:26:47 +00:00
cd lemmy-ui
yarn
yarn dev
2020-06-12 13:29:50 +00:00
```
2020-10-07 16:08:03 +00:00
and go to [localhost:1234 ](http://localhost:1234 ). Front end saves should rebuild the project.
2020-09-15 19:26:47 +00:00
2020-06-09 23:13:51 +00:00
Note that this setup doesn't include image uploads or link previews (provided by pict-rs and
iframely respectively). If you want to test those, you should use the
[Docker development ](contributing_docker_development.md ).