Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Flarum is still in beta so it can be quite tricky to install.
- After doing this a few times and finally mastering it, I have assembled a guide for new users to install Flarum.
- There are multiple other ways to set up the forum software, but this is the one that worked for me and other users.
- Any of the text shown in the code blocks are commands. You should paste them into your session and enter
- them unless told to do something else.
- This guide isn't for professionals, it's for people not experienced at setting up things like this (like me).
- I didn't make most of this guide, credit to @ron_jeremy (from the Flarum forum) to most of it.
- I only switched a few things around and added some stuff to make it easier for you.
- We will be using a DigitalOcean droplet.
- Here are the settings you will need for your droplet:
- Under 'one-click apps', choose the 'LAMP on 14.04' option. This will create a Ubuntu LAMP droplet.
- I chose the $10.00/mo option. With a GitHub Student Pack, you can freely use this droplet for five months.
- Any geographical location will be suitable, choose the one closest to you.
- Under the additional options, you need to select two checkboxes (one optional):
- - Private networking
- - IPv6
- - Backup (optional)
- Selecting the backup option will add an extra 20% to your cost.
- Name your droplet a hostname you will remember and then click 'create'.
- You will then receive an e-mail containing your droplet's IP, root username, and password.
- Next, we will make a SSH connection to the droplet. This guide is for Windows, so download and install PuTTY
- if you don't have it already. Enter the settings accordingly and start a session.
- You will be asked to change your password. Make it something secure and memorable.
- Now that you're connected, you will want to take note of your MySQL root password. This is important, you
- will need it for later to set up Flarum.
- cat /root/.digitalocean_password
- This will give you the root password. Copy it and save it somewhere.
- Next, we will need to install curl. This can easily be done by entering this command.
- sudo apt-get install php5-curl
- After curl is installed, we will make a new user for your droplet. Name it 'flarum'.
- adduser flarum
- Entering this command will result in being prompted for a new UNIX password. Make it something secure and
- memorable. Press enter for all the questions asked after this (such as your room number, name, etc.) until
- you reach the confirmation message. This asks if your information is accurate. Press the Y key and then press
- enter.
- Now we must give our new user sudo privileges.
- visudo
- Search for the following line:
- root ALL=(ALL:ALL) ALL
- Enter your new user's username below so it looks like this. I will do it for my 'flarum' user.
- flarum ALL=(ALL:ALL) ALL
- Type Ctrl+X to exit and then type Y. Then hit enter to exit the editor.
- Now your user can execute commands with administrative privileges. Let's logout of the root account.
- logout
- Now restart PuTTY, reconnect to your droplet, and login with the new user account. Mine is 'flarum'.
- Our droplet does not come with a swapfile by default. Let's add one and make some adjustments.
- Here we will create the file.
- sudo fallocate -l 2G /swapfile
- Now we will enable the file.
- sudo chmod 600 /swapfile
- sudo mkswap /swapfile
- sudo swapon /swapfile
- Now we will make the swapfile permanent.
- sudo nano /etc/fstab
- At the bottom of the file, add the following line.
- /swapfile none swap sw 0 0
- Type Ctrl+X to exit and then type Y. Then hit enter to exit the editor.
- Next, we will make a couple tweaks.
- sudo sysctl vm.swappiness=10
- sudo sysctl vm.vfs_cache_pressure=50
- Now we will make the above tweaks permanent.
- sudo nano /etc/sysctl.conf
- At the bottom of the file, add the following two lines.
- vm.swappiness=10
- vm.vfs_cach
- Type Ctrl+X to exit and then type Y. Then hit enter to exit the editor.
- Next, we will enable mod_rewrite. This is required for Flarum.
- sudo a2enmod rewrite
- Now we must restart Apache.
- sudo service apache2 restart
- Now we will exit the default VirtualHost to use mod_rewrite.
- sudo nano /etc/apache2/sites-available/000-default.conf
- Search for "DocumentRoot /var/www/html" and add the following lines directly below it.
- <Directory "/var/www/html">
- AllowOverride All
- </Directory>
- Type Ctrl+X to exit and then type Y. Then hit enter to exit the editor.
- Now we will restart Apache again.
- sudo service apache2 restart
- Next, we will install Composer. This is also required for Flarum to work.
- sudo curl -sS https://getcomposer.org/installer | php
- sudo mv composer.phar /usr/local/bin/composer
- Phew, with all that done it is finally time to install Flarum.
- There are many ways to do this, but this method gets the job done.
- First we will navigate to our web directory:
- cd /var/www/html
- There are already two files in this folder.
- Flarum doesn't like being installed on a folder that isn't empty. Let's delete these files.
- sudo rm index.html
- sudo rm info.php
- Now we will install Flarum.
- sudo composer create-project flarum/flarum . --stability=beta
- Composer may give you a warning that it doesn't like being ran with sudo (or as a superuser).
- Don't worry about this, it is fine.
- At this point the Flarum installer may or may not pause. If it does, it is waiting for your token.
- If the Flarum installer is waiting for your token: (skip this part if it isn't)
- There should be a web address at the bottom of your terminal window. Go to that address in your browser,
- but make sure you have a GitHub account. If not, create one. Do not change any settings, just click the
- 'generate token' button at the bottom of the screen. Then copy and paste it into the terminal and hit enter to
- finish with the Flarum installer. Everyone must do everything below, token or not.
- Now we should double-check that Flarum installed correctly. Make sure it didn't output any errors.
- If it did, search the error on the Flarum support forum and get help from there.
- Now let's see if Flarum is working properly.
- Go visit the IP of your droplet on the Internet with your web browser.
- It should show the Flarum logo first, and then show an issue with the permissions.
- Do not panic, this is to be expected. Close your browser window and follow the rest of the instructions.
- First, we need to enable headers with Apache.
- sudo a2enmod headers
- Then we will restart Apache.
- sudo service apache2 restart
- Now, we will give ownership of the following folders to Apache.
- sudo chgrp www-data /var/www/html
- sudo chgrp -R www-data /var/www/html/assets
- sudo chgrp -R www-data /var/www/html/storage
- sudo chmod 775 /var/www/html
- sudo chmod -R 775 /var/www/html/assets
- sudo chmod -R 775 /var/www/html/storage
- That's it with Flarum. You can re-visit your droplet's IP with a web browser and it should show a form.
- Don't fill it out yet, close your web browser. We need to configure MySQL first.
- First, let's secure MySQL.
- mysql_secure_installation
- Type your root password when prompted. Now you will see a message telling you that a root password
- is already set. Enter N and press enter. You can change the MySQL root password some other time.
- Press Y and enter for the rest of the questions.
- Now we should access the MySQL shell.
- mysql -u root -p
- You are asked for your MySQL root password. This is the password you noted down back at the very
- beginning, it's from the MOTD. Enter this password (or paste it in) and hit enter.
- Now, let's see the databases already installed.
- SHOW DATABASES;
- There should be three default databases. Leave them alone.
- Let's create our database, we should call it 'flarum'.
- CREATE DATABASE flarum;
- If you list the databases again, you should see the new database.
- SHOW DATABASES;
- Now, let's exit the MySQL shell. Press Ctrl+C.
- Now go back to your web browser and visit your droplet. Let's fill out that form.
- Forum Title: Enter the name of your new forum.
- MySQL Host: Leave this as 'localhost'.
- MySQL Database: Enter your database name. We named it 'flarum', so enter that.
- MySQL Username: 'root'
- MySQL Password: Enter your MySQL root password, the one you noted down from the MOTD.
- Table Prefix: 'myforum01_'
- Admin Username: Whatever you want to name your admin account.
- Admin Email: The e-mail for your admin account.
- Admin Password: The password you want to use for your admin account.
- Now press the button under the form.
- This may take a few seconds.
- Now it should redirect to the homepage of your new Flarum forum.
- You have now installed Flarum. Hooray!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement