2020-06-09 23:13:51 +00:00
|
|
|
### Ubuntu
|
2019-12-31 14:31:34 +00:00
|
|
|
|
|
|
|
|
2020-06-09 23:13:51 +00:00
|
|
|
#### Build requirements:
|
|
|
|
```
|
|
|
|
sudo apt install git cargo libssl-dev pkg-config libpq-dev yarn curl gnupg2 git
|
|
|
|
# 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-06-09 23:13:51 +00:00
|
|
|
#### Get the source code
|
|
|
|
```
|
|
|
|
git clone https://github.com/LemmyNet/lemmy.git
|
|
|
|
# or alternatively from gitea
|
|
|
|
# git clone https://yerbamate.dev/LemmyNet/lemmy.git
|
|
|
|
```
|
|
|
|
|
|
|
|
All the following commands need to be run either in `lemmy/server` or `lemmy/ui`, as indicated
|
|
|
|
by the `cd` command.
|
|
|
|
|
|
|
|
#### Build the backend (Rust)
|
|
|
|
```
|
2020-02-06 20:25:13 +00:00
|
|
|
cd server
|
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-06-09 23:13:51 +00:00
|
|
|
#### Build the frontend (Typescript)
|
|
|
|
```
|
|
|
|
cd ui
|
|
|
|
yarn
|
|
|
|
yarn build
|
|
|
|
```
|
2020-02-06 20:25:13 +00:00
|
|
|
|
2020-06-09 23:13:51 +00:00
|
|
|
#### Setup postgresql
|
|
|
|
```
|
|
|
|
sudo apt install postgresql
|
|
|
|
sudo systemctl start postgresql
|
|
|
|
# initialize postgres database
|
|
|
|
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
|
2020-06-09 23:13:51 +00:00
|
|
|
# or execute server/db-init.sh
|
2019-12-31 14:31:34 +00:00
|
|
|
```
|
|
|
|
|
2020-06-09 23:13:51 +00:00
|
|
|
#### Run a local development instance
|
2019-12-31 14:31:34 +00:00
|
|
|
```
|
2020-06-09 23:13:51 +00:00
|
|
|
# run each of these in a seperate terminal
|
|
|
|
cd server && cargo run
|
|
|
|
ui & yarn start
|
|
|
|
```
|
|
|
|
|
|
|
|
Then open [localhost:4444](http://localhost:4444) in your browser. It will auto-refresh if you edit
|
|
|
|
any frontend files. For backend coding, you will have to rerun `cargo run`. You can use
|
|
|
|
`cargo check` as a faster way to find compilation errors.
|
|
|
|
|
|
|
|
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).
|