Hi everyone,

I'm looking for tips for Installing Flarum.

One of my clients would like a product-support forum installed as a subdomain. I saw that Sean installed Flarum on the server to power this community. I found this old post by a mysterious person named "Opalsean" 🤣 So I know we can install this here hypothetically. It may even appear as a one-click someday, but in the meantime I want to get a forum up and running.

I've been looking for a good tutorial or guide that can apply to our shared hosting environment. Most of the tutorials I can find have us installing dependency managers and such. I don't think that's something we can do here. My SSH session doesn't seem to recognize composer.

$ composer -v
-bash: composer: command not found

Same for docker.

There is THIS thing which purports to being good for shared hosting, but I wanted to hear from the pros before moving forward.

Also this would involve pointing a subdomain to a possible subfolder or different app instance, and I'm not sure what practices would be best there also.

Any tips?

Thanks,
-Techism

  • sean replied to this.

    techism This very forum is a Flarum install running on Opalstack on a managed account so I'm certain you can run it on your own account.

    Docker is 100% not required. I've never used the "flarum-ez-install" thing that you linked to, but it seems quite old and isn't really needed on a flexible hosting platform like Opalstack.

    Instructions for installing composer are here: https://docs.opalstack.com/topic-guides/php/#installing-composer

    After you've installed composer, create a MariaDB user and MariaDB database: https://docs.opalstack.com/user-guide/mariadb-databases/

    Next go back to your shell user where you've installed composer and create your Flarum project. I'll use "myforum" as the project name in this example:

         mkdir ~/myforum
         cd ~/myforum
         composer create-project flarum/flarum .

    Back in the dashboard, create a Nginx (or Apache) PHP Symlink app pointing at /home/shelluser/myforum/public/: https://docs.opalstack.com/topic-guides/symlinks/

    Once the app is created, route it to a site: https://docs.opalstack.com/user-guide/sites/

    Finally, visit the site and Flarum should guide you through the rest of the setup.

    Hope this helps 🙂

    Fantastic Sean, thanks so much for the quick reply! I'll begin at once and post here if I run into any trouble. I'll step-by-step it with code-examples for future readers.

    Hi Sean. I think I got most of this done, the place I'm hung up is the final step: creating the site. I've created a subdomain, the application and all that - but I don't see how to route the site to the public folder of the application. Ideas?
    Thanks,
    -Techism

    • sean replied to this.

      techism the application in this case is supposed to be a symlink app pointing to the public folder, eg almost exactly like the Laravel example in the symlink doc: https://docs.opalstack.com/topic-guides/symlinks/#example-serving-a-laravel-project-with-a-symlink-app

      If you've followed the instructions in my previous reply and have created the symlink app pointing to your public folder, then all you should need to do is route the symlink app to / when you create the site.

      Oh right! I'll double check that. Thanks!

      For composer, I do it using php directly where composer.phar is located :
      php composer.phar require package/name

      • sean replied to this.

        anjanesh For composer, I do it using php directly where composer.phar is located :
        php composer.phar require package/name

        Did you need to run this step while installing Flarum? It should not be necessary.

          sean Oh sorry - I was just replying the OP of why composer was not found
          -bash: composer: command not found

          • sean replied to this.

            anjanesh in this case the OP wasn't able to run composer because they had not yet installed composer.

            If you follow the instructions in our documentation to install and run composer then the syntax you're using isn't necessary because composer will be on your executable path and you can just run it.

            4 years later

            I just got Flarum installed very simply thanks to this thread, thank you.

            I can't get the emails to work though. The default is to use mail and the "test email" button shows an error ("Oops! Something went wrong. Please reload the page and try again.").

            Should I be using the SMTP option, and should I be setting up a proper "from" address with all the SPF, DKIM etc?

            Thanks,
            Stephen.

            • sean replied to this.

              scp SMTP should not be required but you absolutely must be using a valid sender address.

              • scp replied to this.

                Just another note in case anyone else installs Flarum...

                I'm using CloudFlare for my DNS so it took a little while before OpalStack's systems managed to obtain an SSL certificate for my forum's domain name. This meant that I set the forum up using HTTP and then later it all started getting redirected to HTTPS. At this point lots of things stopped working and I could see in the browser dev tools that it was because of "mixed content" errors.

                Anyway, to cut it short, there's a file config.php in the root of the Flarum install where you need to change the url entry to be "https" instead of "http", then it's all fine again.

                sean I've updated the CloudFlare DNS records to add MX records for the sub-domain I am using for the forum. I've set up an email address in OpalStack (forwarded to an existing mailbox for now). I've tested I can send an email to the forum address from an external system.

                The error in the Flarum logs is:

                 flarum.ERROR: Swift_TransportException: Expected response code 220 but got an empty response in /home/scp/mcw-forum/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:447

                Googling it turns up a lot of people with the same issue but I think the solution lies with the hosting provider mostly so the responses are generally not useful. Do you have any thoughts? Is there a PHP function I need to enable?

                • sean replied to this.

                  scp please email the details (mailbox, email address, and date and time (with time zone) of the error) so that we may investigate.

                  Mastodon