How to install MyBB in Ubuntu

To install MyBB in Ubuntu

MyBB is an Open Source Software was developed by using PHP and MySQL. Forum software will allows you to post private messages. It will require you to setup LAMP server. Installation of MyBB is explained in this article.

Installation of MyBB

Update your repositories by running the following command.

root@linuxhelp:~# apt-get update  
Hit http://in.archive.ubuntu.com wily InRelease
Get:1 http://in.archive.ubuntu.com wily-updates InRelease [65.9 kB]   
Get:2 http://security.ubuntu.com wily-security InRelease [65.9 kB]
Hit http://in.archive.ubuntu.com wily-backports InRelease             
Hit http://in.archive.ubuntu.com wily/main Sources                       
Get:3 http://security.ubuntu.com wily-security/main Sources [55.8 kB]
Hit http://in.archive.ubuntu.com wily/restricted Sources                            
Hit http://in.archive.ubuntu.com wily/universe Sources             
Get:4 http://security.ubuntu.com wily-security/restricted Sources [2,854 B]
.
.
.
Hit http://in.archive.ubuntu.com wily-backports/main i386 Packages                                                                                                          
Hit http://in.archive.ubuntu.com wily-backports/restricted i386 Packages                                                                                                    
Hit http://in.archive.ubuntu.com wily-backports/universe i386 Packages                                                                                                      
Hit http://in.archive.ubuntu.com wily-backports/multiverse i386 Packages                                                                                                    
Hit http://in.archive.ubuntu.com wily-backports/main Translation-en                                                                                                         
Hit http://in.archive.ubuntu.com wily-backports/multiverse Translation-en                                                                                                   
Hit http://in.archive.ubuntu.com wily-backports/restricted Translation-en                                                                                                   
Hit http://in.archive.ubuntu.com wily-backports/universe Translation-en                                                                                                     
Fetched 1,893 kB in 14s (131 kB/s)                                                                                                                                          
Reading package lists... Done


Run the below command to install the packages to setup LAMP server.

root@linuxhelp:~# apt-get install lamp-server^ -y 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting ' apache2-utils'  for task ' lamp-server' 
Note, selecting ' liblua5.1-0'  for task ' lamp-server' 
Note, selecting ' mysql-server-core-5.6'  for task ' lamp-server' 
Note, selecting ' mysql-server-5.6'  for task ' lamp-server' 
Note, selecting ' libaio1'  for task ' lamp-server' 
Note, selecting ' mysql-client-core-5.6'  for task ' lamp-server' 
.
.
.
apache2_invoke: Enable module php5
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...


Navigate to the root directory and download MyBB zip package by running the following command.

root@linuxhelp:~# cd /var/www/html/ 
root@linuxhelp:/var/www/html# wget https://resources.mybb.com/downloads/mybb_1807.zip 
--2016-09-30 13:15:33--  https://resources.mybb.com/downloads/mybb_1807.zip
Resolving resources.mybb.com (resources.mybb.com)... 104.24.9.55, 104.24.8.55, 2400:cb00:2048:1::6818:837, ...
Connecting to resources.mybb.com (resources.mybb.com)|104.24.9.55|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2211839 (2.1M) [application/zip]
Saving to: ‘ mybb_1807.zip’ 

mybb_1807.zip                               100%[==========================================================================================> ]   2.11M   319KB/s   in 6.5s   

2016-09-30 13:15:41 (335 KB/s) - ‘ mybb_1807.zip’  saved [2211839/2211839]


Extract the downloaded zip file for MyBB.

root@linuxhelp:/var/www/html# unzip mybb_1807.zip  
Archive:  mybb_1807.zip

   creating: Documentation/
  inflating: Documentation/credits.html  
   creating: Documentation/images/
 extracting: Documentation/images/logo.png  
 extracting: Documentation/images/notice_credits.png  
 extracting: Documentation/images/notice_install.png  
 extracting: Documentation/images/notice_license.png  
 extracting: Documentation/images/notice_upgrade.png  
  inflating: Documentation/index.html  
  inflating: Documentation/install.html  
  inflating: Documentation/license.html  
  inflating: Documentation/data-stylesheet.css  
  inflating: Documentation/upgrade.html  
   creating: Upload/
.
.
.
  inflating: Upload/uploads/avatars/index.html  
  inflating: Upload/uploads/index.html  
  inflating: Upload/usercp.php       
  inflating: Upload/usercp2.php      
  inflating: Upload/warnings.php  
  inflating: Upload/xmlhttp.php


After extracting you can see a directory “ Upload” will be created under your document root, you can rename it to MyBB.

root@linuxhelp:/var/www/html# ls 
Documentation  mybb_1807.zip  Upload
root@linuxhelp:/var/www/html# mv Upload mybb 


Change the ownership for the directory Mybb under your document root.

root@linuxhelp:/var/www/html# chown -R www-data:www-data /var/www/html/mybb 


Create database and database user for Mybb in Mysql database.

root@linuxhelp:/var/www/html# mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with   or g.
Your MySQL connection id is 2
Server version: 5.6.31-0ubuntu0.15.10.1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.

mysql>  create database mybbdb 
Query OK, 1 row affected (0.00 sec)

mysql>  grant all privileges on mybbdb.* to mybbuser@localhost identified by ' 123'  
Query OK, 0 rows affected (0.04 sec)

mysql>  flush privileges 
Query OK, 0 rows affected (0.00 sec)

mysql>  exit
Bye


Move to MyBB directory and rename the file as shown below.

root@linuxhelp:/var/www/html# cd mybb/
root@linuxhelp:/var/www/html/mybb# mv inc/config.default.php inc/config.php 


Next we need to create the virutal host entry for MyBB. Run the below command to create the new configuration file for apache to configure virtual host

root@linuxhelp:/var/www/html/mybb# vim /etc/apache2/sites-available/mybb.conf 

< /VirtualHost *:80> 

ServerAdmin admin@linuxhelp.com
DocumentRoot /var/www/html/mybb/
ServerName linuxhelp.com
ServerAlias www.linuxhelp.com

< Directory /var/www/html/mybb/> 

Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all

< /Directory> 

ErrorLog /var/log/apache2/linuxhelp.com-error_log
CustomLog /var/log/apache2/linuxhelp.com-access_log common

< /VirtualHost> 

Enable the newly created site.

root@linuxhelp:/var/www/html/mybb# a2ensite mybb.conf 
Enabling site mybb.
To activate the new configuration, you need to run:
  service apache2 reload


Restart the apache service by running the following command.

root@linuxhelp:/var/www/html/mybb# systemctl restart apache2 


Open the browser and navigate to http://< IP_address> /mybb

Read the license agreement and click Next to proceed further.

Then check the requirements.

Configure the database by entering the details.




Fill the board configuration and click Next.

Create Administrator Account and click Next.


After finishing installation, click “ Admin Control Panel” .

Login with the user credentials.

Tag : MyBB
FAQ
Q
shall I use a customized URL in MyBB?
A
yes you can but make sure you have an entry at host file in MyBB
Q
How can I already have a lamp stack installed by the manual method in MyBB?
A
You are good to go but make sure you install all the dependecies
Q
why would I use HTML directory in MyBB?
A
if you point it in someother location your application don’t work
Q
Does unzip command has arguments in MyBB?
A
Yes, it does which you can verify by navigating to man page in MyBB
Q
Shall I create a local user as a database user in MyBB?
A
Yes, you can but make sure you secure the installation in MyBB.