In this guide I will show how you can install Xenforo (https://xenforo.com/) on Fedora using Nginx and HHVM (old HipHop php).
For this guide I used the following:
forum01 (1x cpu, 512mb ram)
Fedora 21 (HHVM does not yet support F22)
Xenforo 1.4.10 (Requires a License)
I used myself for this guide the "5" dollar server from DigitalOcean, see my guide on the url below how to create a server there:
This guide should also work on RHEL and CentOS but you might need to change some directory locations or use slightly different commands.
Step 1: Add the Ulyaoth repository
For Fedora 21 use:
For another Fedora or RHEL see my repository post for the correct rpm:Code:$ sudo yum install -y https://downloads.ulyaoth.net/rpm/Fedora/x86_64/ulyaoth-1.0.6-1.fc21.x86_64.rpm
Step 2: install the required packages
Step 3: Create the following directoriesCode:$ sudo yum install -y ulyaoth-nginx ulyaoth-hhvm mariadb mariadb-server policycoreutils-python
Step 4: Download Xenforo (this is a paid application)Code:$ sudo mkdir -p /etc/nginx/access-lists $ sudo mkdir -p /etc/nginx/ssl $ sudo mkdir -p /srv/nginx/xenforo/public $ sudo mkdir -p /var/log/nginx/xenforo
Go to "http://xenforo.com" and login to your customer portal.
Now click on "Download Xenforo" and do not select "Download the upgrade package only" so you download the full version.
Again this step assumes you already did buy a license for Xenforo.
Step 5: Unzip your Xenforo zip file.
You should now have a folder "upload".Code:$ unzip xenforo_*_full.zip
Step 6: Move all Xenforo file to the right directory
Step 7: Download the vhost and access-list file for nginxCode:$ sudo mv upload/* /srv/nginx/xenforo/public/
Code:$ sudo wget -q https://raw.githubusercontent.com/sbagmeijer/ulyaoth/master/guides/xenforo/nginx/xenforo.conf -O /etc/nginx/sites-available/xenforo.conf
Step 8: Install your certificates
Get the certificates from where you bought them or once you generated yourself and place them in:
To create your dhparams file please use the following command:
Remember if your certificate files are not called "ulyaoth-xenforo.crt", "ulyaoth-xenforo.key" and "ulyaoth-xenforo.ca" then you have to rename them in your xenforo.conf vhost file so it will use the right certificates.Code:sudo $ openssl dhparam -out /etc/nginx/ssl/dhparam.pem 4096
Step 9: Change the vhost file to fit your setup.
Now change all the domain names from "ulyaoth.net" to your domain name, please make sure to double check your whole file.Code:$ sudo vi /etc/nginx/sites-available/xenforo.conf
Then double check all the certficiate names and name them how your certificates are names (check the whole file):
Now as final you have to create a "sha256 pin" with the following command: (update so it uses your key)Code:ssl_certificate /etc/nginx/ssl/ulyaoth-xenforo.pem; ssl_certificate_key /etc/ssl/certs/ulyaoth-xenforo.key; ssl_trusted_certificate /etc/ssl/certs/ulyaoth-xenforo.ca;
It should give an output like this:Code:$sudo openssl rsa -in /etc/nginx/ssl/ulyaoth-xenforo.key -outform der -pubout | openssl dgst -sha256 -binary | openssl enc -base64
Then in the vhost update this bit with your key:Code:writing RSA key zcoKJuisd789hasddasasd32k4VUxsof3d3w22332b7k=
That is it now continue with the guide!Code:add_header Public-Key-Pins "pin-sha256=\"zcoKJuisd789hasddasasd32k4VUxsof3d3w22332b7k=\"; max-age=172800;";
Step 10: symbolic link your vhost
Step 11: Copy the example config for a small MariaDB database to real config location.Code:$ sudo ln -s /etc/nginx/sites-available/xenforo.conf /etc/nginx/sites-enabled/xenforo.conf
Of-course if you expect a large database you have to or make your own MariaDB config or in the location "/usr/share/mariadb/" you have more examples:Code:$ sudo cp /usr/share/mariadb/my-small.cnf /etc/my.cnf
Step 12: Start the MariaDB database
Step 13: run the MariaDB secure installation scriptCode:$ sudo systemctl start mariadb.service
I would recommend to do the steps I did below:Code:$ sudo /usr/bin/mysql_secure_installation
Enter current password for root (enter for none): (ENTER)
Set root password? [Y/n] Y
Re-enter new password:
Password updated successfully!
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Step 14: Login to the MariaDB database
(you have to use the password from Step 13 that you created)Code:$ sudo mysql -uroot -p
Step 15: In the MariaDB client create the following user and database
(Make sure to change to example password "ulyaoth007" to something random)Code:CREATE DATABASE xenforo; GRANT ALL PRIVILEGES ON xenforo.* TO "xenforo"@"localhost" IDENTIFIED BY "ulyaoth007"; GRANT ALL PRIVILEGES ON xenforo.* TO "xenforo"@"127.0.0.1" IDENTIFIED BY "ulyaoth007"; FLUSH PRIVILEGES;
Step 16: exit the MariaDB client
Step 17: Put everything on autostartCode:exit
Step 18: Chown the web directory to hhvm:nginxCode:$ sudo systemctl enable mariadb.service $ sudo systemctl enable hhvm.service $ sudo systemctl enable nginx.service
Step 19: Fix directory permissionsCode:$ sudo chown -R hhvm:nginx /srv/nginx/xenforo/
Step 20: fix SelinuxCode:$ sudo chmod 777 /srv/nginx/xenforo/public/data $ sudo chmod 777 /srv/nginx/xenforo/public/internal_data
Step 21: configure firewalldCode:$ sudo setsebool -P httpd_can_network_connect on $ sudo chcon -R -t httpd_sys_content_t /srv/nginx/xenforo/public/ $ sudo chcon -R -t httpd_sys_rw_content_t /srv/nginx/xenforo/public/data $ sudo chcon -R -t httpd_sys_rw_content_t /srv/nginx/xenforo/public/internal_data $ sudo semanage port -a -t http_port_t -p tcp 80 $ sudo restorecon /etc/nginx/ssl/*
You can check with this command to see it is all added:Code:$ sudo firewall-cmd --permanent --zone=public --add-service=http $ sudo firewall-cmd --permanent --zone=public --add-port=443/tcp $ sudo firewall-cmd --reload
You probably have to change "zone=public" to your servers setup.Code:$ sudo firewall-cmd --zone=public --list-all
Step 22: Start nginx and hhvm
Congratulations this should be everything your require to do on the server so now lets start with the installation of Xenforo!Code:$ sudo systemctl start hhvm.service $ sudo systemctl start nginx.service
Step 23: Start and finish the installation of Xenforo
Start by going to your website for me "https://www.ulyaoth.net" and you should see the following: (make sure to use your domain name)
A small note I left the pictures from version 1.4.10 because it should be the same for 1.4.10 I did see no difference, also sometimes it might complain it cannot verify your php installation this is because of hhvm, just continue and it will work fine.
You should see this:
Now simply press on "Begin Installation"
You should now see a page like this:
On this screen we have to fill in the database information from Step 15.
MySQL Server: localhost
MySQL Port: 3306
MySQL User Name: xenforo
MySQL Password: ulyaoth007
MySQL Database Name: xenforo
Of-course change all this to your information and then your screen should look filled in like this:
Now press on "Test & Generate Configuration" to continue.
If you Followed the guide correctly you should now see the following:
Now press on "Save Configuration".
It should now download a file called "config.php" now you or have to scp this file to your server or you open it with notepad and copy the file contents to the server.
for scp do something like this:
For manual copy paste just do this on the server:Code:scp config.php firstname.lastname@example.org:/srv/nginx/xenforo/public/library/
Once you have done one of the two steps above run the following commands on the server:Code:$ sudo vi /srv/nginx/xenforo/public/library/config.php
Now after you done this go back to your website and press on "Continue with Installation".Code:$ sudo chown -R hhvm:nginx /srv/nginx/xenforo/public/library/config.php $ sudo chcon -R -t httpd_sys_content_t /srv/nginx/xenforo/public/library/config.php
If you did everything correct you should now see the following screen:
So just click on "Begin Installation" and you should see a screen like this:
This will probably take a minute so just let it do what it needs to do till you see the website change to:
Now as you can see on this screen you will need to create a Administrator account, be smart and do not use a username like "admin" or "administrator" use some random nickname.
The reason for this is that any script or bot will first try those usernames in order to get access to your website and you do not want this ofcourse.
After you have filled in everything you press on "Create Administrator" and you will see the following screen next:
On this screen fill only in the following two fields:
Contact Email Address:
The other fields should be automatically filled in and should only be changed if you know what you are doing.
Now press on "Setup Options" to complete the installation.
Congratulations you have successfully completed my guide and installed Xenforo with HHVM.
What next? well press the "Enter your control panel" button and play around with your website or browse to your website url to see the front page of your newly installed forum.
It should look like this:
As always if you have any improvements or your see any mistakes please let me know so I can update the guide.