Build Your Own Forum with Ubuntu and Simple Machines Forum
Want to run your own forum service from your home or office? Tired of paying for web hosting services that don't give you the server and storage specs you want? The following guide will give you a crack at being a newbie web host yourself! And you can do it all with free, open source software.
This document contains the instructions necessary to bring a Simple Machines Forum into existence on your own personal Ubuntu web server. Don't have a web server? I'll show you how to do that too.
I will be updating this as needed and as suggestions come in. Please feel free to contribute if you find errors.
Please note: I'm no Apache guru, nor am I a Linux Ubuntu, MySQL, PHP, or any other kind of computer guru. The following guide was written by me. It is instended to be a fun way to learn about web hosting. If you are wanting to operate a webserver in a mission critical or production environment please reference the proper resources provided by the Apache Software Foundation for creating a secure webserver environment. I do not offer support in any form for this guide other than I'll do my best to answer questions, and I'll make corrections to the information as I find errors or as they are pointed out to me and I am allowed to make tham.
Also note: Unless your server is going to be located on the Internet with its own public, static IP address you will need to get a Dynamic DNS hosting service to host your DNS records. This is very easy to do. I use DynDNS, but there are many DNS hosting services available. If you don't understand in the least bit what I am referring to go to www.dyndns.com and do some research. I used their Custom DNS package because I wanted to have a top-level domain for my website. You will need to acquire some knowledge about Dynamic DNS and how to configure it before you will be able to access your web server dependably from the Internet. I talk about about Dynamic DNS in this guide, but understanding how it works requires a seperate How To in itself. But don't let that discourage you. It's a challenge that can easily be overcome on these forums.
Resounding note: I reinstalled 15 times before I got all my 'Penguins' in a row. And I don't mean Apache either, I mean the entire system. So if you're going to build a web server using these instructions you'll be dedicating a machine to this task. If you think you may want to opt out of this later and go back to what your system was used as previously make sure to backup all the data on your machine before beginning your install of Ubuntu If you already own an existing web server and intend to use this forum guide for a produciton server please install this software on a test server first before moving it to a mission critical server. This is a guide for hobbyists and enthusiasts, not necessarily for IT professionals. If you are an IT professional or otherwise proceed at your own risk.
I installed this software on an AMD Socket A 1.6 GHz Duron computer with a single stick of 512 Meg DDR400 RAM. I used an 80 gig IDE drive and two 40 Gig SATA drives for storage. A powerful GFX card would be a waste, so I just installed an old 2x AGP card to conserve RAM for the software. Low power requirements meant I could go with a cheap 400 watt power supply. I used a standard Lite-On CD-RW drive for installation. I used a PCI NIC that was compatible with my distribution of Linux.
Needless to say this has created a very beefy web server, storage-wise. So far my forum has been up for a week. It took me about three weeks of blood, sweat, and tears to figure this all out. So if you don't get it on the first try I recommend you get up and try again. If you have questions please contact me through the forum. I'd be more than glad to try and share what little I really know about hosting a web server with you. And perhaps we can learn more together.
(Optional) I also set up a Smoothwall router with three NICs for handling the Dynamic DNS updates and so that I could put my web server in a DMZ. This isn't required. But if you're interested in building a secure firewall router from an old PC check out www.smoothwall.org and download their latest Express 2.0 edition which is what I used.
(Default) You can just as easily use a standard off the shelf router between your Ubuntu server and your Internet connection. I get more into this later in the guide.
Now, to your forum.
Here's what you need to do -
After you build your server you need to get your operating system installed.
I used Ubuntu 6.10 Desktop, Alternate Install disk at www.ubuntu.com. If you love a different distribution of Linux or you don't like the newest version of Ubuntu and decide to go with something else don't have high expectations of this guide working perfectly for you as written. Your installation may require numerous modifications. For simplicity sake I recommend following these instructions as closely as possible on your first install. Where items are listed as “(Optional)” you may go with the “(Default)” setting instead where I try to describe alternative methods to the best of my ability. I recommend that once you arrive at a working web server/forum following these instructions that you start your experiments and modifications.
(Optional) Ubuntu 6.10 Desktop notes: This is the Desktop alternate installation disk. I use the desktop version because it is easier for Linux newbies like myself. The alternate install disk can be found under the download section. My server uses the PC i386 version. If you're not familiar with the download section of the Ubuntu website do some exploring. Figure out where on the planet earth you are going to download your copy of the OS. Once you do this you will see the various options available. To get the options I have listed here download the ISO image that allows other installation options. I use what is called Logical Volume Management – or LVM. This allows for an easier hard drive storage upgrades in most cases.
The standard desktop install CD does not allow you to use LVM. I like to use LVM because it makes increasing your computer's storage capacity much easier. If you don't want to use LVM then you can go with a standard install disk. The installation instructions for the OS will be different that what I describe here.
To get the downloaded ISO onto a CD properly you need to get a piece of software that burns ISO images. Search on www.google.com for ISO Recorder and download and install this piece of software on a Windows based PC. There are other program as well that can burn ISO images available.
Install Ubuntu using the Text Mode. When you get to partitioning let Ubuntu do it for you. If you know how to use LVM then create an ext3 partition about 100 to 200 MB in size and mount the /boot directory on it. Also, create a swap partition that is at least twice the size of your RAM. I recommend making it twice the size of the maximum RAM you'll ever expect to install on your server. Then make an LVM group from your remaining disks and create the necessary volumes to mount / (i.e. That is the root of the file system) to. I also mount /var/www on it's own volume. What this does is allows me to make just the space where the forum will be stored larger or smaller later if I need to using LVM. (If you want to know more about LVM ask.)
(Optional) I also run an ftp server on my machine. So I have a /ftp folder mounted on a 70 gig volume and /var/www mounted on a 60 gig volume. This is handy for backing up and restoring the forum's files over the internet or over the local network. I used vsftpd. However since an ftp server isn't required I won't go into the details of its installation here.
The rest of the Ubuntu installation is pretty much standard. There are enough installation guides available for more details on installing Ubuntu. If you have a specific question please feel free to ask.
Once Ubuntu is installed log in and open a terminal window. Open the terminal under > Applications > Accessories > Terminal, and then type the following command to install the software required for a LAMP server:
sudo apt-get install mysql-server apache2 php5 php5-mysql libapache2-mod-php5 php5-gd
LAMP server – Linux, Apache, MySQL, PHP.
(Optional) Go into the folder /etc/php5/apache2 where you will find the php.ini file. This file needs to be edited in two places that sets the maximum size of a post – 'post max filesize' and the maximum size of an attachment – 'upload max filesize'. The specific names of all the required configuration settings are in the general installation requirements listed on Simple Machines Forum homepage at www.simplemachines.org. Click on Download, then click on System Requirements. Changing these two settings is required if you want forum members to upload files larger than 2 megs. I set them each for 1000M (which is 1 Gigabyte) because my forum is a closed forum and attachments are easier to controll with the very few members it has. Also, many of the posts are made from a LAN which has considerably faster upload and download speeds than the Internet. If your forum will be public then keeping the default settings may be plenty.
As far as I can tell all other requirements and recommendations by SMF in the PHP and MySQL config files are okay by default for my needs. In any case I address them in this How To.
Next, in a terminal window type the command
to configure the root password for the MySQL server. Make sure to read the output that is produced as a result of this command. You will find the instructions for setting the MySQL root password in that output. Since the MySQL server is on the same computer as the forum you use the first of the two methods and type it precisely the same way. (Don't put quotes around your password. And use a real password, not the word 'password'. Write your password down so you don't forget it.)
Using the 6.10 version of Ubuntu allows you to install MySQL Administrator from the Add/Remove... feature integrated into the Ubuntu desktop. Click > Applications > Add/Remove and then do a search for MySQL Administrator. Install this application now so that you can configure the MySQL database.
One of my security failures in this process is that I can't get SMF to install with anything except the root user name and password I specified in the mysql_install_db step. If you know how to give smf a less privileged status that will still work, please let me know.
Notes: According to the SMF website I do know that the user account the forum uses needs at least the following priviledges:
SELECT, INSERT, UPDATE, DELETE, ALTER, and INDEX.
And, during installation and conversion:
CREATE and DROP privileges.
However, my ignorance is only a bump in the road towards your forum, and not a roadblock.
Next, point the server's web browser to SMF's website at www.simplemachines.org and download the most recent version of SMF. You need the .tar version. It downloads very quickly with a broadband connection. There is a readme file in the folder you download that should tell you how to continue with the installation. Go ahead and read that file before proceeding. My 'version' of the instructions follows:
What I do is extract every single file and folder from the download except for that single readme file to the following folder:
If you get an error open a terminal window and type the following command then try extracting the files and folders again:
sudo chmod 777 /var/www
I do not create a folder called “forum” to extract to, because I don't know much about configuring Apache. If someone has some configuration examples or guides please advise.
Now here's the tricky part. Do not run install.php until my instructions direct you to.
You presently have a LAMP server with a forum installed on it. But before running the install.php file it is very important to work out a few more steps. It is kind of important to have the server computer located where you intend it to “serve” from. In my case I connected it directly to a Smoothwall firewall router that I built. I plugged the server into the DMZ port for added security for the LAN. However, a standard router port will work on a budget Linksys type standard issue $50 router just fine. However, if your ISP has not provided you with a static IP is it very handy to have a router that supports Dynamic DNS. A Smoothwall router supports this feature without the need for additional software or modifications. This will be very important for setting up DNS with a Dynamic DNS service so you can get to your web server from the Internet. A Smoothwall router is optional, but there are other options. Some budget routers support Dynamic DNS. Read into your router's configuration documentation to learn how to set this up. Another option was suggested below:
Daniel15 from Simple Machines Community Forums suggests that running ddclient on your server will update your Dynamic DNS host just as well.
I do not know how this program works and have not tried it myself. So use your favorute search engine to research it if you decide to use this option.
It is also important that the web server have a static IP on the LAN or DMZ port depending on which one you use. If your router is set up to use DHCP for its clients either turn DHCP off and assign static IPs to your workstations or assign the Web Server an IP outside of the range of the DHCP server. This should be a private IP range address.
So get everything connected and get all the IP information for all parties configured. If you don't know how to configure Network settings on your router or Ubuntu computer take some time to learn how to do this. There are numerour How Tos on the subject, and ask for help on the Ubuntu forums.
From a workstation that is not the server but is connected to the same router and type the IP address of the server in a browser address bar and press “Enter” on your keyboard. If everything is configured right you should now see the forum setup screen for your SMF forum. If you don't then try restarting the server and repeat the instructions in this paragraph. If it still doesn't work then check your services and make sure that Apache and MySQL are running.
If all went according to plan you should get a message that the permissions of several files and folders need to be changed for the configuration to continue. So open a terminal window on the server computer and make these changes. All of these files and folders are in the folder /var/www. So do the following:
then use the following commands to change their user permissions so SMF can have permission to read, write, and execute them:
sudo chmod 777 attachments
Use this command for each file and folder listed until all the files and folder permissions are changed as specified in the list.
Now go back to your workstation and refresh the browser screen. If all goes well you should be at the next page of configuration. It asks you to fill in some information. Name your forum, etc.
Of special importance -
If you've done your homework and set up a Dynamic DNS service online you should have a web address for your web server – like www.superserver.com or something like that – and you should have your router set up to update their DNS servers when your ISP changes your IP from time to time.
Make sure you type the web address of your forum in the box requesting the URL for the server and not the LAN IP address or Loopback IP address. Example: www.superserver.com Typing in the LAN IP is wrong. You will use port forwarding in your router to forward HTTP requests to the router. However, if you use the LAN IP for the URL things just won't work and the forum will get confused and you won't be able to log in.
Here is some more about where I'm a bit stumped about using MySQL properly. This is the same “bump” in the road I was referring to earlier, and not a roadblock. The next step however is useful for confirming that your MySQL server is indeed working. So you should do it if nothing else to confirm MySQL is up and running and ready to go.
I use MySQL Administrator (start it up under the Applications Menu) and log in from the server machine at localhost, root, and then use my root password that I specified for the MySQL server. If all is well and you can log in then close it and skip the next paragraph.
If you're a MySQL Pro and you want to help me troubleshoot this then here are the details: Once I log in I can create a user accound for the forum and even give it the required permissions. But I'm still having trouble here when I use this login account information in the install.php forum setup screen. Luckily, I can try this over and over and over till I figure it out. But I finally lost patience after 30 tries.
My workaround is to simply use localhost, root, and the MySQL root password in the SMF configuration form and it just works. However, I'm pretty sure this is a security no-no.
If you can't figure it out how to do it correctly use my workaround, because it is very effective. However if I ever figure it out – or you do – there is a place in the Forum Admin section where you can change these settings – (no doubt using extreme caution as you do it.)
Finish up configuring your forum and set an administrator username and password. You should be done and you should see the forum on your workstation with a bright red warning telling you to delete the install.php file. My experience is that running install.php causes the config screens to hang from the beginning of SMF configuration. I was not able to get SMF to recognize that the files and folders that need to be chmod'ed to 777 were indeed possessing the proper permissions. So frustrated, I just reinstalled the entire system and tried again. So unless you know a lot more about php and MySQL than I do (I know just about diddly) I recommend avoiding running install.php again at all costs unless you have some knowledgable assistance.
Workaround: Again according to Daniel15 the data base files can be cleared and install.php can be run again.
Note: I don't know how to do this so I've left it out of these instructions. Read up on MySQL administration for more information.
If you need to reconfigure something go into the server folders/files that constitute SMF in the /var/www directory and look at the configuration files. They are plain text and can easily be edited with a text editor such as gedit or vim. Just make sure to start the text editor with su priviledges. And it would be wise to make a backup of a file before you alter it just so you can go back. Linux newbies tend to overlook this precaution.
cp filename filename.bakup
Now you need to log in to your router and add an item to the hosts table in your configuration:
The web address should be your server's web address, and the IP address should be the static IP you gave your web server. This way, users on your LAN will be able to reach your server using the www URL rather than having to type the IP address. And it also gets around your router's anti-spoofing rules should it have any. If you don't find a Hosts table entry then your router probably isn't that sophisticated in which case I would only worry about it if you can't reach your computer with it's web address from inside your LAN.
Also, go to the port forwarding section of your router and set it up to forward all requests for port 80 to your web server's static LAN IP. See your router's configuration documents for more information. My experience has been that port forwarding just works. If it doesn't work for you then the problem is not port forwarding, it's something else.
If your Dynamic DNS is set up correctly in your router then you should be good to go. Get a friend who's not on your LAN to try out your www address and make sure the web server can be reached okay.
Note: It sometimes takes a couple days for Dynamic DNS services to get your DNS records setup. So if it doesn't work right away give them a few days or log in and check on the status of your account.
Your now a forum owner. Woot!!!
asus P6T Del V2 w/i7 920 6g ddr3 1600
Win7 Ultimate 64-bit
Smilodon case is STILL the best ever, ever, ever!!!