Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation instructions for 4.3 on Ubuntu 24.04 and Debian 12 #1537

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 43 additions & 52 deletions content/en/admin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ menu:

## Pre-requisites {#pre-requisites}

* A machine running **Ubuntu 22.04** or **Debian 11** that you have root access to
* A machine running **Ubuntu 24.04** or **Debian 12** that you have root access to
* A **domain name** (or a subdomain) for the Mastodon server, e.g. `example.com`
* An e-mail delivery service or other **SMTP server**

You will be running the commands as root. If you aren’t already root, switch to root: `sudo su -`
We will be using `example.com` as the domain in the following example. Please remember to replace it with your own domain before running any commands.

You will be running the commands as root. If you aren’t already root, switch to root: `sudo -i`

### System repositories {#system-repositories}

Expand Down Expand Up @@ -52,52 +54,18 @@ apt install -y \

#### Yarn {#yarn}

```bash
corepack enable
yarn set version classic
```

### Installing Ruby {#installing-ruby}

We will use rbenv to manage Ruby versions as it simplifies obtaining the correct versions and updating them when new releases are available. Since rbenv needs to be installed for an individual Linux user, we must first create the user account under which Mastodon will run:

```bash
adduser --disabled-login mastodon
```

We can then switch to the user:

```bash
su - mastodon
```

And proceed to install rbenv and rbenv-build:

```bash
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec bash
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
```

Once this is done, we can install the correct Ruby version:
Enable `corepack` so that the correct version of `yarn` can be installed automatically:

```bash
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.3
rbenv global 3.2.3
corepack enable
```

We’ll also need to install the bundler:

```bash
gem install bundler --no-document
```
### Creating the `mastodon` user {#creating-the-mastodon-user}

Return to the root user:
This is the user account under which Mastodon will run:

```bash
exit
adduser --disabled-password mastodon
```

## Setup {#setup}
Expand All @@ -106,7 +74,7 @@ exit

#### Performance configuration (optional) {#performance-configuration-optional}

For optimal performance, you may use [pgTune](https://pgtune.leopard.in.ua/#/) to generate an appropriate configuration and edit values in `/etc/postgresql/16/main/postgresql.conf` before restarting PostgreSQL with `systemctl restart postgresql`
For optimal performance, you may use [pgTune](https://pgtune.leopard.in.ua/#/) to generate an appropriate configuration and edit values in `/etc/postgresql/16/main/postgresql.conf` before restarting PostgreSQL with `systemctl restart postgresql`.

#### Creating a user {#creating-a-user}

Expand Down Expand Up @@ -144,6 +112,25 @@ git clone https://github.com/mastodon/mastodon.git live && cd live
git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)
```

#### Installing Ruby {#installing-ruby}

We will use rbenv to manage Ruby versions as it simplifies obtaining the correct versions and updating them when new releases are available.
Install rbenv and ruby-build:

```bash
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec bash
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
```

Once this is done, we can install the correct Ruby version:

```bash
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install
```

#### Installing the last dependencies {#installing-the-last-dependencies}

Now to install Ruby and JavaScript dependencies:
Expand All @@ -152,7 +139,7 @@ Now to install Ruby and JavaScript dependencies:
bundle config deployment 'true'
bundle config without 'development test'
bundle install -j$(getconf _NPROCESSORS_ONLN)
yarn install --pure-lockfile
yarn install
```

{{< hint style="info" >}}
Expand All @@ -164,7 +151,7 @@ The two `bundle config` commands are only needed the first time you're installin
Run the interactive setup wizard:

```bash
RAILS_ENV=production bundle exec rake mastodon:setup
RAILS_ENV=production bin/rails mastodon:setup
```

This will:
Expand Down Expand Up @@ -204,21 +191,25 @@ rm /etc/nginx/sites-enabled/default
Then edit `/etc/nginx/sites-available/mastodon` to

1. Replace `example.com` with your own domain name
2. Uncomment the `ssl_certificate` and `ssl_certificate_key` lines and replace the two lines with (ignore this step if you are bringing your own certificate)
2. Uncomment the `ssl_certificate` and `ssl_certificate_key` (ignore this step if you are bringing your own certificate):

```
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
```
```
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;;
```

3. Make any other adjustments you might need.

Un-comment the lines starting with `ssl_certificate` and `ssl_certificate_key`, updating the path with the correct domain name.
Allow other users to traverse the mastodon user's home directory, so that nginx's `www-data` user can access asset files:

```bash
chmod o+x /home/mastodon
```

Reload nginx for the changes to take effect:
Restart nginx for the changes to take effect:

```bash
systemctl reload nginx
systemctl restart nginx
```

At this point, you should be able to visit your domain in the browser and see the elephant hitting the computer screen error page. This is because we haven’t started the Mastodon process yet.
Expand Down