How to go from Linux to the finest Content Management System ever:
step by step.

   Everything2.com runs on an engine called eCore, created by our friends over at the Everything Development Company. It can be a bit tricky to setup your first time through, but don't give up! This is, in my opinion, one of the best content management engines around, and with a basic understanding of perl you can begin programming on it in minutes.

   I happened to have a spare Macintosh at work with a clean install of Debian on it, so all the examples from this node will be using Debian 2.2 on a powerpc kernel. So far as I've seen, this method also works on the testing and unstable trees of debian, on any platform with Apache, MySQL, and perl compiled for it.

Materials needed:

Procedure:
Your keystrokes are in bold monospace,
The computer's responses are in regular monospace.

Step one is to get all our tools lined up. We will need working copies of Perl, MySQL, Apache, mod_perl, DBI, CGI, and a handful of other perl modules. Many of the functions that require root access can be taken care of with su, but I prefer to work with sudo. Sudo is a good utility to have around if your eCore based site ever requires multiple administrators. Since sudo doesn't come pre-installed on debian's stable distribution, we need first to set it up:

danne@local:~$ su
Password: (type your root password here)
root@local:~/home/danne/# apt-get install sudo
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
  sudo
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 128kB of archives. After unpacking 340kB will be used.
Get:1 http://http.us.debian.org stable/main sudo 1.6.2p2-2 [128kB]
Fetched 128kB in 1s (80.5kB/s)
Selecting previously deselected package sudo.
(Reading database ... 20897 files and directories currently installed.)
Unpacking sudo (from .../sudo_1.6.2p2-2_powerpc.deb) ...
Setting up sudo (1.6.2p2-2) ...
No /etc/sudoers found... creating one for you.
root@local:/home/danne# visudo
   When in visudo, goto line that says "root ALL=(ALL) ALL", type 'A', press return, type in the username you're currently logged in as, type " ALL=(ALL) ALL", press escape, type ":wq", and press enter. Now, you should be out of visudo, and have it configured to grant the current user root access. Type 'exit' to return to normal user mode.

   Now that sudo's installed, we can finish setting up the base system (things like Apache, MySQL, and some perl modules). To grab some of these files, we'll need a program called wget. Wget isn't installed by default, so we need to install it. Debian makes this easy:
danne@local:~$ sudo apt-get install wget

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these two things:

        #1) Respect the privacy of others.
        #2) Think before you type.

Password:(the current user's password.  NOT the root password)
   Wget should now be installed, we can go ahead and pull eCore's install files from www.everydevel.com, the necessary perl modules from www.cpan.org, and the neccessary debian packages from http.us.debian.org. These URIs are fully operational af of the time of this writing, but there is a possibility that the ones for www.cpan.org may change. If so (if, after typing 'ls', TermReadKey or File-Spec don't show up) go to http://search.cpan.org and grab the latest URI for the module.1
danne@local:~$ mkdir ecore
danne@local:~$ cd ecore
danne@local:~/ecore$ wget http://www.everydevel.com/downloads/current-everything.tar.gz -q
danne@local:~/ecore$ wget http://www.everydevel.com/downloads/libmail-sender-perl_0.7-1.deb -q
danne@local:~/ecore$ wget http://www.cpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.17.tar -q
danne@local:~/ecore$ wget http://www.cpan.org/authors/id/R/RB/RBS/File-Spec-0.82.tar.gz -q
danne@local:~/ecore$ wget http://www.everydevel.com/downloads/apachediffs/access.conf.diff -q
danne@local:~/ecore$ wget http://www.everydevel.com/downloads/apachediffs/srm.conf.diff -q
danne@local:~/ecore$ ls
File-Spec-0.82.tar.gz    access.conf.diff           libmail-sender-perl_0.7-1.deb
TermReadKey-2.17.tar.gz  current-everything.tar.gz  srm.conf.diff

danne@local:~/ecore$ sudo apt-get install mysql-server apache-perl \
      libdbd-mysql-perl libxml-perl libxml-generator-perl libxml-parser-perl \
      libdbi-perl libcgi-perl libxml-dom-perl libapache-dbi-perl mailtools
Reading Package Lists... Done
Building Dependency Tree... Done
Sorry, apache-perl is already the newest version
Sorry, libdbi-perl is already the newest version
The following extra packages will be installed:
  expat libxmltok1
The following NEW packages will be installed:
  expat libcgi-perl libdbd-mysql-perl libxml-dom-perl libxml-generator-perl libxml-parser-perl
  libxml-perl libxmltok1 mysql-server libapache-dbi-perl
0 packages upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 1437kB of archives. After unpacking 4068kB will be used.
Do you want to continue? [Y/n] Y
Get:1 http://http.us.debian.org stable/main expat 1.1-1 [9350B]
Get:2 http://http.us.debian.org stable/main libcgi-perl 2.76-17 [125kB]
Get:3 http://http.us.debian.org stable/main libdbd-mysql-perl 1.2202-4 [106kB]
Get:4 http://http.us.debian.org stable/main libxml-dom-perl 1.25-1 [110kB]
Get:5 http://http.us.debian.org stable/main libxml-generator-perl 0.5-1 [8836B]
Get:6 http://http.us.debian.org stable/main libxml-parser-perl 2.27-3 [297kB]
Get:7 http://http.us.debian.org stable/main libxml-perl 0.05-1 [100kB]
Get:8 http://http.us.debian.org stable/main libxmltok1 1.1-1 [47.1kB]
Get:9 http://http.us.debian.org stable/main mysql-server 3.22.32-6 [633kB]
Get:10 http://http.us.debian.org stable/main libapache-dbi-perl 0.87-1 [38.6kB]
Fetched 1475kB in 10s (141kB/s)
Configuring packages ...
   At this point, depending on how debconf is setup for you, you should get some configuration dialogs. Many of them will be notices (requiring you only to press ok), but depending on what has to install, you may see more than that. Most of the questions should be very straightforward.
Selecting previously deselected package libxmltok1.
(Reading database ... 20879 files and directories currently installed.)
Unpacking libxmltok1 (from .../libxmltok1_1.1-1_powerpc.deb) ...
Selecting previously deselected package expat.
Unpacking expat (from .../expat_1.1-1_powerpc.deb) ...
Selecting previously deselected package libcgi-perl.
Unpacking libcgi-perl (from .../libcgi-perl_2.76-17_all.deb) ...
Selecting previously deselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from .../libdbd-mysql-perl_1.2202-4_powerpc.deb) ...
Selecting previously deselected package libxml-parser-perl.
Unpacking libxml-parser-perl (from .../libxml-parser-perl_2.27-3_powerpc.deb) ...
Selecting previously deselected package libxml-dom-perl.
Unpacking libxml-dom-perl (from .../libxml-dom-perl_1.25-1_all.deb) ...
Selecting previously deselected package libxml-generator-perl.
Unpacking libxml-generator-perl (from .../libxml-generator-perl_0.5-1_all.deb) ...
Selecting previously deselected package libxml-perl.
Unpacking libxml-perl (from .../libxml-perl_0.05-1_all.deb) ...
Selecting previously deselected package mysql-server.
Unpacking mysql-server (from .../mysql-server_3.22.32-6_powerpc.deb) ...
Selecting previously deselected package libapache-dbi-perl.
Unpacking libapache-dbi-perl (from .../libapache-dbi-perl_0.87-1_all.deb) ...
Setting up libxmltok1 (1.1-1) ...
Setting up expat (1.1-1) ...
Setting up libcgi-perl (2.76-17) ...
Setting up libdbd-mysql-perl (1.2202-4) ...
Setting up libxml-parser-perl (2.27-3) ...
Setting up libxml-dom-perl (1.25-1) ...
Setting up libxml-generator-perl (0.5-1) ...
Setting up libxml-perl (0.05-1) ...
Settung up libapache-dbi-perl (0.87-1) ...
Setting up mysql-server (3.22.32-6) ...
Starting MySQL database server: mysqld.

Step 2 is to load all that mess we just downloaded and set it all up. We'll be configuring Apache and our perl modules, and getting eCore ready to go. Patching the Apache config files requires root access, but I've had trouble getting sudo to do this. In this example, we'll just use su:

danne@local:~/ecore$ su
Password: (enter the root password here)
root@local:/home/danne/ecore# cat srm.conf.diff | patch /etc/apache/srm.conf
patching file `/etc/apache/srm.conf'
Hunk #1 FAILED at 24.
1 out of 2 hunks FAILED -- saving rejects to /etc/apache/srm.conf.rej
root@local:/home/danne/ecore# cat access.conf.diff | patch /etc/apache/access.conf
patching file `/etc/apache/access.conf'
root@local:/home/danne/ecore# exit
exit
    Yeah, that 'Hunk #1 FAILED' looks pretty ominous, but it doesn't get in the way of getting things setup and functioning.
    Next, we have to install and configure our three perl modules. The first of which has been packaged as a deb file, making installation a snap. The other two (like all perl modules) aren't that difficult to install, though:
danne@local:~/ecore$ sudo dpkg -i libmail-sender-perl_0.7-1.deb
Password: (enter user's password here, not root.)
Selecting previously deselected package libmail-sender-perl.
(Reading database ... 21162 files and directories currently installed.)
Unpacking libmail-sender-perl (from libmail-sender-perl_0.7-1.deb) ...
Setting up libmail-sender-perl (0.7-1) ...
danne@local:~/ecore$ tar zxf File-Spec-0.82.tar.gz
danne@local:~/ecore$ cd File-Spec-0.82
danne@local:~/ecore/File-Spec-0.82$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for File::Spec
danne@local:~/ecore/File-Spec-0.82$ make
   Look for errors here, and after every time you run 'make'. There will be alot of text floating by, but I'm not going to list it all here. Unless 'perl Makefile.pl' failed, this shouldn't fail. On the next line, we include 'UNINST=1' because the file::spec module, depending on your version of debian, might or might not be there. For the sake of consistency, we'll install the newer version:
danne@local:~/ecore/File-Spec-0.82$ sudo make install UNINST=1
   (you will see output here, but, as it varies system to system, I've left it out.)
Writing /usr/lib/perl5/5.005/powerpc-linux/auto/File/Spec/.packlist
Appending installation info to /usr/lib/perl5/5.005/powerpc-linux/perllocal.pod
danne@local:~/ecore/File-Spec-0.82$ cd ..
danne@local:~/ecore$ tar zxf TermReadKey-2.17.tar.gz
danne@local:~/ecore$ cd TermReadKey-2.17
danne@local:~/ecore/TermReadKey-2.17$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Term::ReadKey
danne@local:~/ecore/TermReadKey-2.17$ make
   (many lines omitted.  Don't forget to watch for errors!)
danne@local:~/ecore/TermReadKey-2.17$ sudo make install
   (lines once more omitted.)
danne@local:~/ecore/TermReadKey-2.17$ cd ..
   Look where it installed your perl modules (*.pm files) to. You'll need that later to patch up eCore's XML.pm.
   FInally, we get to install the eCore modules:
danne@local:~/ecore$ tar zxf current-everything.tar.gz
danne@local:~/ecore$ cd everything/
danne@local:~/ecore/everything$ perl Makefile.PL
Install directory [/usr/local/everything]: (press enter)
May I append:

        Include /usr/local/everything/everything.apache.conf

to your httpd.conf file? (N/y)Y
Where is your Apache's httpd.conf? [/etc/apache/httpd.conf](press enter)

Everything is configured to be installed as follows:
  - Install directory: /usr/local/everything
  - Append Include to: /etc/apache/httpd.conf

Is this correct? [y]:(press enter)
Warning: prerequisite XML::DOM 1.27 not found at (eval 1) line 220.
Checking if your kit is complete...
Looks good
Writing Makefile for Bundle::Everything
Writing Makefile for Everything
   The XML::DOM warning comes on debian's stable distribution only (so far as I've seen), because the installed version of libxml-dom-perl is 1.25-1. Everything seems to work fine with that version installed, however (no pun intended).
danne@local:~/ecore/everything$ make
    (Lots of text excluded.  Just watch for error messages)
danne@local:~/ecore/everything$ sudo make install
    (Lots of text excluded.  It should end with something to this effect:)
Installing /usr/local/lib/site_perl/Everything.pm
Installing /usr/local/lib/site_perl/Bundle/Everything.pm
Installing /usr/local/man/man3/Bundle::Everything.3pm
Writing /usr/local/lib/site_perl/powerpc-linux/auto/Everything/.packlist
Appending installation info to /usr/lib/perl5/5.005/powerpc-linux/perllocal.pod
   Next, we need to patch up XML.pm. Due to a glitch in the XML postprocessor, nbmasta won't import nodeballs into the database. Remember where it installed the perl modules? I've seen it install them in /usr/local/lib/site_perl/Everything and /usr/local/share/perl/5.6.1/Everything. When you earlier typed 'sudo make install', it told you where it was installing. We need to go to this directory:
danne@local:~/ cd /usr/local/lib/site_perl/Everything
danne@local:/usr/local/lib/site_perl/Everything$ sudo vi XML.pm
   We need to find this:
sub unMakeXmlSafe {
        my ($str) = @_;

        $str =~ s/\&lt\;/\</g;
        $str =~ s/\&gt\;/\>/g;
        $str =~ s/\&amp\;/\&/g;
        return $str;
}
   And insert this:
sub unMakeXmlSafe {
        my ($str) = @_;

        $str =~ s/\&lt\;/\</g;
        $str =~ s/\&gt\;/\>/g;
        $str =~ s/\&amp\;/\&/g;
        $str =~ s/\&quot\;/\"/g;
        return $str;
}

Step 3 is to setup an eCore based site and restart Apache and MySQL so they will see their new configurations and users:

danne@local:~$ cd /usr/local/everything/
danne@local:/usr/local/everything$ sudo bin/install_esite (desired site name)
found Everything install at .
found Everything install at /usr/local/everything
Ok to use /usr/local/everything for Everything directory? (N/y)Y
Please enter the root password for mysql (MySQL password.)
Creating new database 'myNewESite'
Which SQL user do you want to control 'myNewESite' [root] esite

Please specify the password for this user: [none] (press enter)
Please specify the host for this user [localhost] (press enter)
User 'esite' created!
Where is your web directory? This directory should be accessable by apache
[/var/www] (press enter)
Would you like me to create an /var/www/incoming directory where you can upload 
images and files? (N/y) Y
What user does Apache run as? [nobody] www-data
/var/www/incoming created and chown to www-data!
Installing nodeball.  Hang on.
Creating tables...
   - Done.
Skipping already installed table node!
Skipping already installed table nodetype!
Skipping already installed table setting!
Skipped tables have the right columns, though!
Installing nodetypes...
Fixing references...
   - Done.
Installing nodes...
Fixing references...
   - Done.
setting up the typeversion table...

Please set the root user password (max 10 chars): (desired password)
Please confirm the root user password: (...and again)
/usr/local/everything/everything.apache.conf has been modified.  
    Remember to restart the Apache server.

Also note, this change will not take effect unless you have:
        Include /usr/local/everything/everything.apache.conf

somewhere in your httpd.conf


Installation complete, now restart apache with:

        apachectl restart

danne@local:~/usr/local/everything$ sudo apachectl configtest
Syntax OK
danne@local:~/usr/local/everything$ sudo apachectl restart
/usr/sbin/apachectl restart: httpd restarted
danne@local:~/usr/local/everything$ sudo /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
danne@local:~/usr/local/everything$ exit
exit

   If all went well, you should be able to point a browser at that computer's IP address, domain name, or http://localhost/ (on that machine only) and see "Welcome to Everything!" with the familiar login nodelet, among others. From there, login as root, with the password you set with install_esite, and have fun!

Security Concerns

The way this is setup is stable, but very insecure. Before you get to having too much fun with your new eCore site, you need to do some MySQL maintainance:

danne@local:~$ mysql -u root mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.22.32-log

Type 'help' for help.

mysql>update user set Password=password('(desired password)') where User='root';
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> update user set Password=password('(desired password)') where User='esite';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> grant all privileges on myNewESite.* to esite@localhost;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye
danne@local:~$ sudo /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
danne@local:~$exit
exit
   These aren't the only security concerns, but they're a good start. Once you're in your site, immediately setup a normal user account and use it for regular operations (doing everything as root can be nice, but you run the risk of deleting something important.)
   If you're concerned about securing your eCore installation, everydevel.com would be a good place to direct questions to. jaybonci or myself would probably be willing to help you out, as well.


1 - I realize this might be more easily done using cpan.pm, but Configuration of that alone would take a full node to explain. This method is simpler.


N.B. - After setting eCore up more times than I can count, I've found this manner of doing it to be the simplest and most reliable. If anyone know a faster, simpler way to do this, please /msg me and I'll make a note of it here.

Thanks!

Log in or register to write something here or to contact authors.