Installing CoffeeMud and Configuring MySQL

This is a step-by-step guide for getting CoffeeMud installed and running with a MySQL database. We will use only the command line via SSH. Several aspects of this guide are specific to divineright.org, though you may find it helpful for installations on other linux and unix based platforms as well.

Part 1: Setting Up Your Environment

  1. Log in to your shell account via SSH.
  2. You'll notice upon logging in that you see a message like this:
    JAVA USERS: The server has both Java 1.4 and 1.5
    installed. If you want to use 1.4, type this command
    to switch: java-config -s 1
    This guide is written for use with 1.5 and has not yet been tested with 1.4. You can always check to see what version you are using by issuing the following command:
    java -version
  3. We need to create two directories before we start moving files around. We'll use the mud directory to store our CoffeeMud installation, and the tmp directory to store our installer and download files. Issue the following command from your home directory:
    mkdir ./tmp ./mud
  4. Let's also make sure you have access to MySQL by using the following command. If you don't see the version information printed on the screen, contact the administrator and ask them to make sure you have been given access to MySQL.
    mysql --version

Part 2: Installing the Software

  1. Point a web browser at: http://coffeemud.zimmers.net
  2. Find the download link for the latest stable version. As of this writing, it is listed under "Downloading the Software" as "CoffeeMud v5.2"
  3. Click on that link, which should log you into an FTP server and give you a list of files.
  4. What we want to do is copy the link address for the CoffeeMud.zip file on this server. Using Firefox, you can right-click on that link, and choose "Copy Link Location".
  5. Switch back to your SSH session, and move into your tmp directory like so:
    cd tmp
  6. This next step is going to save us a bunch of time by avoiding having to switch programs, download then upload, or enter a series of commands. We'll use wget to simply grab the file we want and download it directly to our tmp directory on divineright.org. First type wget followed by a space, and then paste that link we copied earlier right next to it. It should look something like this:
    wget ftp://ftp.zimmers.net/pub/projects/coffeemud/5.2/CoffeeMud.zip
    Press enter, and you should see something like this:
    --10:17:35--  ftp://ftp.zimmers.net/pub/projects/coffeemud/5.2/CoffeeMud.zip
               => `CoffeeMud.zip'
    Resolving ftp.zimmers.net... 64.182.89.236
    Connecting to ftp.zimmers.net|64.182.89.236|:21... connected.
    Logging in as anonymous ... Logged in!
    ==> SYST ... done.    ==> PWD ... done.
    ==> TYPE I ... done.  ==> CWD /pub/projects/coffeemud/5.2 ... done.
    ==> PASV ... done.    ==> RETR CoffeeMud.zip ... done.
    Length: 23,555,010 (22M) (unauthoritative)
    Followed by a progress bar. When the progress bar reaches 100% the download will finish and you'll be returned to a prompt.
  7. You now have the CoffeeMud files on the server. Let's decompress this zip file right into the ~/mud directory that we created earlier:
    unzip CoffeeMud.zip -d ~/mud/
  8. Now that CoffeeMud is installed, it's time to start configuring it to use a MySQL database. First of all, we need to download a driver to allow Java and MySQL to communicate properly. We'll use the same wget method as before because it's much easier. Point your web browser at: http://dev.mysql.com/downloads/connector/j/5.0.html
  9. Again, let's find the direct link to the file and copy the full address of the link to the clipboard. After a few clicks, you should be able to locate a zip file that looks like the one below. Make sure you are still in your ~/tmp directory, and do the following:
    wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.0.4.zip/from/http://mysql.mirror.redwire.net/
  10. Once the file is done downloading, we can unzip it right here, since we only need to use some of these files for our CoffeeMud installation:
    unzip mysql-connector-java-5.0.4.zip
  11. This creates a new directory in your ~/tmp that has the same name as the original .zip file. Now we need to copy over some files to our CoffeeMud installation. Follow the commands below:
    cp -r ./mysql-connector-java-5.0.4/src/com/mysql ~/mud/com/
    cp ./mysql-connector-java-5.0.4/mysql-connector-java-5.0.4-bin.jar ~/mud/com/mysql/
    

Part 3: Configuring MySQL & CoffeeMud

  1. Now that we have all the necessary files installed to the right locations, it's time to do some configuration. First of all, we'll get our MySQL database created. For this command to work, the "shellaccountname" portion needs to be the same as your SSH login name for divineright.org. Where it says "databasename", you can put the name of the database you want to store your CoffeeMud data in. The entire thing is going to be the name of the database, including your "shellaccountname".
    mysqladmin -p create shellaccountname_databasename
    This will prompt you for a password. It's asking for your mysql password which is not necessarily the same as your SSH password! Scion will have given you this password separately. If you don't have one, just ask for a MySQL account.
  2. Let's make a quick change to the SQL file that will create all of our CoffeeMud tables. We need to tell the file the name of our new database. First, move into your ~/mud directory:
    cd ~/mud
    Now let's open up the file with an editor:
    vi guides/database/coffeemuddbmysql.sql
    Move down to line 9, and insert a new line. The new line should read like this:
    use shellaccountname_databasename;
    Save the file and exit your editor.
  3. Now we can execute this SQL file and it will know exactly what to do:
    mysql -p < guides/database/coffeemuddbmysql.sql
    If you don't see any errors then it succeeded!
  4. Next we need to tell CoffeeMud that we're going to use a MySQL database. Again using your editor, let's open up the .ini file:
    vi coffeemud.ini
    Scroll down to line 46, which is where the database configuration starts. All of these lines should be commented with a #, except for those listed below. If you need to add these lines, then do so:
    DBCLASS=com.mysql.jdbc.Driver
    DBSERVICE=jdbc\:mysql\://localhost\:3306/shellaccountname_databasename
    DBUSER=shellaccountname
    DBPASS=mysqlpassword
    DBCONNECTIONS=4
    DBREUSE=TRUE
    Be sure that "shellaccountname_databasename" is the same as the one you used in the previous steps, and that the "mysqlpassword" is the password you use to access mysql. Save the file and exit.
  5. Now you can start your mud! Type the following command to test it out:
    sh ./mudUNIX.sh
    Go ahead and try to connect with your mud/telnet client once you do this, and you should see that everything is working!