# Install FocalBoard - Project and Task Management Platform - on Linux

## What is FocalBoard?

> Focalboard is an open source, multilingual, self-hosted project management tool that's an alternative to Trello, Notion, and Asana. It helps define, organize, track and manage work across individuals and teams. -https://github.com/mattermost/focalboard

## Installation

1. Log into the Linux device
2. Run the following commands in a terminal:
   # update software repositories
   sudo apt update
   # install any available software updates
   sudo apt upgrade -y
   # install nginx and MySQL database
   sudo apt install nginx mariadb-server mariadb-client -y
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type N and press Enter to not switch to socket authentication
5. Type Y and press Enter to set a root password, type the password twice to confirm
6. Type Y and press Enter to remove anonymous users
7. Type Y and press Enter to disallow root login remotely
8. Type Y and press Enter to remove the test database
9. Type Y and press Enter to reload privilege tables
10. Run the following command to login into MySQL:
    mysql -u root -p
11. Authenticate with the root password set earlier
12. Run the following commands to create the database and database user
    CREATE DATABASE focalboard DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    GRANT ALL ON focalboard.* TO 'focalboard_rw'@'localhost' IDENTIFIED BY 'Foc@lB0a4d';
    FLUSH PRIVILEGES;
    EXIT;
    exit
13. Continue with the following commands to download and extract FocalBoard to the webroot
    # fetch the latest download URL
    regex='"browser_download_url": "(https:\/\/github.com\/mattermost\/focalboard\/releases\/download\/[^/]*\/focalboard-server-linux-amd64\.tar\.gz)"' && response=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/mattermost/focalboard/releases) && [[ $response =~ $regex ]] && downloadURL="${BASH_REMATCH[1]}"
    # download latest focalboard version
    wget -O /tmp/focalboard.tar.gz $downloadURL
    # extract the downloaded archive
    sudo tar -xvzf /tmp/focalboard.tar.gz -C /opt
    # edit focalboard configuration
    sudo nano /opt/focalboard/config.json
14. Update the dbtype and dbconfig to the following

    "dbtype": "mysql",
    "dbconfig": "focalboard_rw:Foc@lB0a4d@tcp(127.0.0.1:3306)/focalboard",

15. Continue with the following commands
    # create nginx config file
    sudo nano /etc/nginx/sites-available/focalboard
16. Paste the following configuration

    upstream focalboard {
    server localhost:8000;
    keepalive 32;
    }
    server {
    listen 80 default_server;
    server_name focalboard.example.com;
    location ~ /ws/* {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    client_max_body_size 50M;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Frame-Options SAMEORIGIN;
    proxy_buffers 256 16k;
    proxy_buffer_size 16k;
    client_body_timeout 60;
    send_timeout 300;
    lingering_timeout 5;
    proxy_connect_timeout 1d;
    proxy_send_timeout 1d;
    proxy_read_timeout 1d;
    proxy_pass http://focalboard;
    }
    location / {
    client_max_body_size 50M;
    proxy_set_header Connection "";
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Frame-Options SAMEORIGIN;
    proxy_buffers 256 16k;
    proxy_buffer_size 16k;
    proxy_read_timeout 600s;
    proxy_cache_revalidate on;
    proxy_cache_min_uses 2;
    proxy_cache_use_stale timeout;
    proxy_cache_lock on;
    proxy_http_version 1.1;
    proxy_pass http://focalboard;
    }
    }

17. Press CTRL+O, Enter, CTRL+X to write the changes
18. Continue with the following commands
    # remove default nginx site
    sudo rm /etc/nginx/sites-enabled/default
    # enable the focalboard site config
    sudo ln -s /etc/nginx/sites-available/focalboard /etc/nginx/sites-enabled/focalboard
    # restart nginx service
    sudo nginx -t && sudo /etc/init.d/nginx reload
    # create focalboard service
    sudo nano /lib/systemd/system/focalboard.service
19. Paste the following service configuration

    [Unit]
    Description=Focalboard server

    [Service]
    Type=simple
    Restart=always
    RestartSec=5s
    ExecStart=/opt/focalboard/bin/focalboard-server
    WorkingDirectory=/opt/focalboard

    [Install]
    WantedBy=multi-user.target

20. Press CTRL+O, Enter, CTRL+X to write the changes
21. Continue with the following commands
    # reload services
    sudo systemctl daemon-reload
    # start and enable focalboard service
    sudo systemctl enable focalboard.service --now
22. Open a web browser and navigate to http://DNSorIP
23. Click the link to create an account
24. Completed the form by entering an email, username and password > Click Register
25. Welcome to FocalBoard

Source: https://www.focalboard.com/download/personal-edition/ubuntu/