Installing Midgard 1.4.1 CMS on Debian GNU/Linux Sid/unstable

Updated: August 7th, 2011Published: February 23rd, 2003
Time to read: 6 min

Article tags:

1. Introduction

Note: this document is now outdated, and is here for reference only, since there are Debian packages for Midgard nowadays. Use them for a much more convenient install.

This setup is well suited for a VPS provider, such as DigitalOcean.

1.1. Concepts

Throughout this document, you will see either hash symbols (#) or dollar signs ($) in front of the commands. These indicate whether the command should be run as a regular user or with superuser privileges (ie. root). Do not include these in the commands! And by the way, copy-pasting commands is not such a great idea.

1.4. Disclaimer

Use the information in this document at your own risk. I disavow any potential liability for the contents of this document. Use of the concepts, examples, and/or other content of this document is entirely at your own risk.

All copyrights are owned by their owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark.

Naming of particular products or brands should not be seen as endorsements.

You are strongly recommended to make a backup of your system before major installation and should make backups at regular intervals.

2. Download software

I downloaded the sources to a directory called /home/user/Midgard and extracted them there (except for Nadmin, which will be used when the Midgard install is completed).

Next, I downloaded and installed Curses/termcap compat libs needed by MySQL, Zlib and some compiling tools needed later on and, of course, Perl.

# apt-get update
# apt-get install ncurses3.0 ncurses3.0-altdev termcap-compat ncurses3.4 \
libncurses4-dev zlib-bin zlib1 zlib1-altdev zlib1g zlib1g-dev autoconf \
automake libtool flex perl

3. MySQL database installation

# groupadd mysql
# useradd -g mysql mysql
$ tar xfvz mysql-3.23.45.tar.gz
$ cd ~/mysql-3.23.45
$ ./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql
$ make
# make install
# ./scripts/mysql_install_db
# chown -R mysql.mysql /usr/local/mysql
# /usr/local/mysql/bin/safe_mysqld --user=mysql &
# /usr/local/mysql/bin/mysqladmin -u root password myMySQLpassWord
# /usr/local/mysql/bin/mysqladmin -u root -h debian password myMySQLpassWord

I added /usr/local/mysql/lib/mysql to my /etc/ and ran ldconfig as root.

4. Glib, Expat-lib and Berkeley-DB installation

$ cd /home/user/Midgard/glib-1.2.9
$ ./configure
$ make
# make install

$ cd /home/user/Midgard/expat-1.95.2
$ ./configure
$ make
# make install

$ cd /home/user/Midgard/db-3.3.11/build_unix
$ ../dist/configure --prefix=/usr
$ make
# make install

I also added /usr/local/lib to my /etc/ and ran ldconfig as root.

5. OpenSSL and mod_ssl installation

$ cd /home/user/Midgard/openssl-0.9.6b
$ ./config --prefix=/usr/local/ssl
$ make
# make test
# make install
$ cd /home/user/Midgard/mod_ssl-2.8.4-1.3.20
$ ./configure --with-apache=../apache_1.3.20

6. Apache httpd installation

# groupadd apache
# useradd -g apache apache
$ cd /home/user/Midgard/apache_1.3.20
$ ./configure --prefix=/usr/local/apache \
            --enable-module=ssl \
            --enable-module=so \
            --with-perl=/usr/bin/perl \
            --enable-shared=ssl \
            --enable-shared=max \
            --server-uid=apache \
            --server-gid=apache \
$ make
# make certificate TYPE=custom
# make install
# /usr/local/apache/bin/apachectl start

7. PHP4 installation

$ cd /home/user/Midgard/php-4.3.1
$ ./configure --with-mysql=/usr/local/mysql \
            --with-xml \
            --with-apxs=/usr/local/apache/bin/apxs \
            --enable-track-vars \
$ make
# make install
# cp php.ini-dist /usr/local/lib/php.ini
# php-config --extension-dir

I edited the /usr/local/lib/php.ini file so, that it loads from the proper extension dir, which I got by running php-config.

8. Midgard installation

8.1. Midgard-lib installation

$ cd /home/user/Midgard/midgard-lib-1.4.1-5
$ ./configure --prefix=/usr/local/midgard \
            --with-sitegroups \
            --with-mysql=/usr/local/mysql \
$ make
# make install

I also added /usr/local/midgard/lib to /etc/ and ran ldconfig as root.

8.2. Midgard-data installation

$ cd /home/user/Midgard/midgard-data-1.4.1-5
$ ./configure --with-db-admin=root \
            --with-db-admin-password=myMySQLpassWord \
            --with-db-user=midgard \
            --with-db-user-password=midgard \
            --with-db=midgard \
            --with-lang=en \
            --with-midgard=/usr/local/midgard \
            --with-php=4 \
            --with-blobdir=/var/www/blobs \
            --with-apxs=/usr/local/apache/bin/apxs \
            --with-apache-user=apache \
# PATH=$PATH:/usr/local/mysql/bin
# ./dbinstall
# cp -r images/ /usr/local/apache/htdocs/       (for old admin images)
# cp midgard-data.conf /usr/local/apache/conf/

8.3. mod_midgard installation

# PATH=$PATH:/usr/local/midgard/bin/
$ cd /home/user/Midgard/mod_midgard-1.4.1-5
$ ./configure --with-midgard=/usr/local/midgard \
                --with-mysql=/usr/local/mysql \
                --with-expat=/usr/local \
$ make
# make install
# cp midgard-root.php /usr/local/apache/libexec/

8.4. midgard-php4 installation

# PATH=$PATH:/usr/local/apache/bin/
# ./mkall /usr/local/midgard

9. Apache configuration

Added this to the last line of httpd.conf for Midgard to work:

 Include midgard-data.conf

Uncommented the following lines for PHP4 to work (needed by Midgard):

 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps

I created a host called (my hostname) using the old admin site and added a VirtualHost to Apache's configuration file (/usr/local/apache/conf/httpd.conf) like this one:

MidgardEngine On
DocumentRoot "/usr/local/apache/htdocs/user"

I restarted Apache:

# /usr/local/apache/bin/apachectl restart

10. Midgard configuration

I edited /usr/local/apache/conf/midgard-data.conf:

Set MidgardRootFile to /usr/local/apache/libexec/midgard-root.php

11. Testing it all

Point browser to http://localhost:80/asgard/ to see if it worked. It did. Point browser to http://localhost:80/admin/ to see if it worked. It did. Point browser to to see if it worked. It did.

12. nAdmin installation

# mv fimages.tgz /usr/local/apache/htdocs/
# tar xfvz fimages.tgz
# /usr/local/midgard/bin/repligard -c /usr/local/midgard/etc/repligard.conf \
  -i /usr/local/apche/htdocs/nadmin_141_core.xmlgz

About the author
I'm a millennial digital nomad and a seasoned IT professional with over 20 years of cross-industry experience, ready to help you with supercharging your business. Drop me a note or read more about what I can do for you!


This website is only intended to provide a quick overview of what I do. Please drop me a line if you'd like me to send you my full CV, references, certifications or any additional information.


Subscribe now to get notified of blog updates (no more than one email/month). No spam, promise!

Unsubscribe at any time. Signing up implies that you agree to the Terms.
This blog contains affiliate links to third parties. By using this site you agree to the Terms.