Install and Run MechGen on Unix or Linux Systems - SAPRC/MechGen GitHub Wiki

Guide for Installing and Using Your Own MechGEN on UNIX or Linux

This guide will walk you through the process of setting up your own MechGEN on a UNIX or Linux system and accessing it through LambdaMOO, a text-based virtual world server.

Step 1: Download and Install Requirements

  1. Download the MechGEN database

    wget https://intra.engr.ucr.edu/~carter/MechGen/MechGen_v1.db
    
  2. Download and Install the LambdaMOO server.

    You can obtain the server v1.8.1 from https://sourceforge.net/projects/lambdamoo/ and install it following the instructions in its README file:

    sh configure
    make
    

    This will compile LambdaMOO, resulting in an executable file called moo.

  3. Optional: Download and Install the MOO server extension: File Utilities Package (FUP). FUP facilitates the downloading of MechGen output files directly into your MechGen using the fileout command (for further details, refer to the MechGen manual). If not installed, it will not impact any other functionality of your MechGen database.

    You can download FUP from https://www.moo-cows.com/ftp/ext-FUP-1.8.tgz and follow the installation guidelines provided in the ext-FUP.INSTALL file:

    # Copy the files: ext-FUP.c and ext-FUP_options.h into your MOO source folder.
    cp ext-FUP.c [moo_src_folder]/.
    cp ext-FUP_options.h [moo_src_folder]/.
    # Update the extensions.c file in the MOO source folder to enable FUP functionality.
    cp extensions.c [moo_src_folder]/extensions.c
    

    You can also modify #define EXTERN_FILES_DIR in the ext-FUP_options.h to designate your preferred location for saving MechGen output files. These files will be stored in a Users subfolder at the path you specify, or by default, in the files/ directory within the MOO server source folder.

    Important! You must create the folder to store the outputs:

    mkdir -p [your_EXTERN_FILES_DIR]/Users
    

    After configuring FUP, please recompile the MOO server as instructed previously.

  4. Install the Telnet protocol to enable access via Telnet

    sudo apt-get install telnet  # Use 'yum' or other package managers if needed
    

Step 2: Launch the MechGen Database

  1. Prepare the Database File

    To ensure compatibility with Linux, remove CRLF sequences (Windows line-termination characters) from the MechGen database:

    tr -d '\015' < MechGen_unix.db > out.db
    

    This command generates a new Linux-compatible MechGen database named MechGen_v1_new.db.

  2. Run the MechGen Database with the Moo Server

    Launch the modified MechGen database with the Moo Server and create a checkpoint database named MechGen_v1_new_out.db:

    ./[path_to_LambdaMOO]/moo MechGen_v1_new.db MechGen_v1_new_out.db [port_number] &
    

    Before executing the command, make sure to:

    • Replace [path_to_LambdaMOO] with the actual LambdaMOO installation path.
    • Optionally, specify a [port_number] that is not in use (the default is 7777 if not provided).

    Example:

    ./MOO-1.8.1/moo MechGen_v1_new.db MechGen_v1_new_out.db 7777 &
    

Step 3: Connect to MechGen via Telnet

If the previous steps were successful, you should have your MechGen running in the background, and you can connect to it via Telnet in a new terminal:

telnet localhost [port_number]  # Use the port number specified earlier (or 7777 if not specified)
  1. Configure MechGen in the First Login

    During the first-time login, you will need to connect as an owner to set up a password for your MechGen account following the instructions displayed on the screen:

    connect owner
    [your_password] # Initialize your password
    yes # Confirm the configuration
    

    Upon successful completion, you'll be logged out automatically.

  2. Log In and Access the MechGen Reactor

    After the initial login, you can relog in and access the MechGen Reactor as follows:

    telnet localhost [port_number]
    connect mechgen [your_password]
    

    Now you can generate your own mechanisms following the instructions in the users' maunal. Enjoy!

Step 4: Close the Connection to MechGen

To close the connection to MechGen, you need to stop the process that runs MechGen in the background.

  1. Find the Process Using the Port Number

    lsof -i :[port_number]   # Replace [port_number] with the port number used for MechGen
    
  2. Kill the Process

    kill [PID]   # Replace [PID] with the PID obtained from the previous step