4elements web design & consultancy



  • like 5 05

    MacMini Server 2011 Part III

    4elements | web design Den Haag blog • MacMini Server 2011 Part III

    Part III: Installation.

    We are going to use brew to install several libs and programs.
    Big advantage of brew is that it makes simlinks into the local bin, lib and sbin folders.
    No mess as macports or fink (let's say I like this way better.)

    ======= Brew =======
    Brew will ask to add and change some path info. You may do this by editing

    open /etc/paths
    /usr/local/sbin (infront of /usr/sbin/)
    /usr/local/bin (infront of /usr/bin/)

    mkdir /usr/local/Cellar

    /usr/bin/ruby -e "$(curl -fsSL"

    Only in case there is an error.
    chown name:admin /usr/local/share
    chown name:admin /usr/local/share/man
    chown name:admin /usr/local/share/man/man1
    chown name:admin /usr/local/Cellar

    brew update

    brew install GD
    brew install wget
    brew install apc
    brew install libtiff
    brew install ghostscript
    brew install imagemagick
    brew install logrotate
    brew install mcrypt
    brew install qdbm
    brew install memcached
    brew install memcache-php
    brew install memcache-top
    brew install lynx
    brew install smartmontools
    brew install libconfig
    brew install GnuPG
    brew install re2c

    Some extra brews I could use.
    brew install xmlrpc-c
    brew install xml-coreutils
    brew install webfs
    brew install webkit2png

    Read my notes.
    brew install ffmpeg *
    brew install ffmpeg-php *
    brew install rrdtool **
    brew install ruby **
    brew install lsof **
    brew install snort **
    brew install libxml2 **
    brew install cairo **
    brew install squid ****
    brew install webalizer ***
    brew install mysql *****

    * don't use brew for this, I wrote a script that will install it all for you, and this one works smile
    ** only needed if you would like to install system stats in webmin.
    *** do not install trough brew, berkery DB will cause some problems later on. (example squid or when you want to run your own postfix version)
    **** only needed if you would like to run squid proxy.
    ***** Or follow the steps below (recommended)

    ======= Create a work folder =======
    We are going to download some software that we need to compile. The most clean way is to create a folder where we will put all the files.
    My case "work" on your main HD.

    mkdir /work

    ======= Installing FFMPEG and FFMPEG-php =======
    Download my script into the work folder.
    Open terminal and su root.
    cd /work
    This will take a while.

    ======= Installing MYSQL =======
    Download MYSQL:
    Pick the "Mac OS X ver 10.6 (x86, 64-bit), DMG" mysql-5.5.16-osx10.6-x86_64.dmg

    Turn mysql on. (system prefs)
    sudo mkdir /var/mysql
    sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

    ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
    ln -s /usr/local/mysql/bin/mysqld /usr/libexec/mysqld

    Add to /etc/paths

    sudo install_name_tool -id /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.dylib

    Set up MySQL root password: (without the {})
    /usr/local/mysql/bin/mysqladmin -u root password {password}
    /usr/local/mysql/bin/mysqladmin -u root -p{password} -h localhost password {password}
    /usr/local/mysql/bin/mysqladmin -u root -p{password} reload

    ======= Installing CPAN =======
    Su root
    cpan (OSX 10.7 has 64bit as default, all will be installed as 64bit)

    Parameters for the 'make' command? Typical frequently used setting:

    -j3 # dual processor system (on GNU make)
    your choice -j6

    CPAN Shell> install CPAN
    CPAN Shell> install YAML YAML::Syck

    CPAN Shell> install DBI
    CPAN Shell> install DBD::mysql
    CPAN Shell> install DBD::Pg
    CPAN Shell> install Bundle::DBI Bundle::DBD::mysql Bundle::DBD::Pg
    CPAN Shell> install SQL::Statement Net::SSLeay Authen::PAM Net::LDAP

    webmin, install needed for clamAV module
    CPAN Shell> install Benchmark::Timer
    CPAN Shell> install Mail::Mbox::MessageParser
    CPAN Shell> force install GD
    CPAN Shell> install GD::Graph::lines GD::Text
    CPAN Shell> install Date::Manip
    CPAN Shell> install Compress::Zlib HTML::Entities Getopt::Long IO::File
    CPAN Shell> install Net::SMTP IO::Socket Mail::Internet

    For webmin stats:
    CPAN Shell> install Cwd English CGI::Carp Bundle::LWP
    CPAN Shell> install Date::Calc Bundle::libnet Crypt::SSLeay

    CPAN Shell> install Mail::SPF Net::DNS::Resolver::Programmable
    CPAN Shell> install Bundle::Email Geo::IPfree Net::XWhois SOAP::Lite

    CPAN Shell> install Net::Server IO::Multiplex Filesys::Virtual::Plain Net::DAV::Server and download the following:

    By hand:
    tar xfvz /work/Data-Dumper-2.131.tar.gz
    tar xfvz /work/Digest-MD5-2.51.tar.gz
    tar xfvz /work/NetAddr-IP-4.050.tar.gz
    tar xfvz /work/Storable-2.30.tar.gz

    cd /work/Data-Dumper-2.131
    make install
    cd /work/Digest-MD5-2.51
    make install
    cd /work/NetAddr-IP-4.050
    make install
    cd /work/Storable-2.30
    make install

    ======= Apache Mod_perl =======
    cd /work
    tar xfvz /work/mod_perl-2.0-current.tar.gz
    cd /work/mod_perl-2.0.5
    perl Makefile.PL MP_APXS=/usr/sbin/apxs \

    LoadModule perl_module libexec/apache2/

    ======= Apache suexec =======
    cd /work
    tar xfvz httpd-2.2.21.tar.gz
    cd /work/httpd-2.2.21
    ./configure --with-layout=Darwin --enable-suexec --with-suexec-caller=_www --with-suexec-docroot=/home2 --with-suexec-userdir=public_html --with-suexec-logfile=/var/log/apache2/suexec_log

    sudo cp /work/httpd-2.2.21/support/suexec /usr/bin/
    sudo chown root:_www /usr/bin/suexec
    sudo chmod 4750 /usr/bin/suexec

    cd /work/httpd-2.2.21/modules/generators
    sudo apxs -i -a -c mod_suexec.c
    (gcc -fpic -DSHARED_MODULE -I/usr/include/apache2 -c mod_suexec.c)

    ======= host =======
    Edit host file:
    goto /etc
    open file "host" with BBEdit. localhost
    XX.XX.XX.XX (XX is your static IP, hostname and domainname are your chosen one)

    ======= ProFtp =======
    Install ProFtp proftpd-1.3.4rc2.tar.gz
    cd /work
    tar xfvz /work/proftpd-1.3.4rc2.tar.gz
    cd /work/proftpd-1.3.4rc2
    ./configure --prefix=/usr/local/proftpd
    make install
    cp /private/etc/pam.d/ftpd /private/etc/pam.d/ftp
    Shell /bin/false for FTP users is not included in /etc/shells, which may prevent FTP access.

    ======= ssl hosting =======
    Cert for ssl hosting:
    openssl genrsa -des3 -out 2048
    openssl req -new -key -out
    ls -ltr www.yourdomain.*

    openssl x509 -req -days 365 -in -signkey -out


    ======= webalizer =======
    cd /work
    tar xfvz /work/webalizer-2.23-05-src.tgz
    cd /work/webalizer-2.23-05
    ./configure --with-pnglib=/usr/X11/lib --enable-geoip
    make install

    ======= awstats =======
    cd /home2
    tar xfvz awstats-7.0.tar.gz
    mv awstats-7.0 awstats
    cd /home2/awstats/tools/
    cd /home2

    rm -r awstats-7.0.tar.gz

    ======= Postgrey =======
    cd /work
    tar xfvz postgrey-1.34.tar.gz
    cd /work/postgrey-1.34

    mkdir /var/spool/postfix/postgrey
    cp postgrey /var/spool/postfix/postgrey
    cp postgrey_whitelist_clients /etc/postfix/postgrey_whitelist_clients
    cp postgrey_whitelist_recipients /etc/postfix/postgrey_whitelist_recipients
    chown -R _amavisd /var/spool/postfix/postgrey
    chgrp -R _amavisd /var/spool/postfix/postgrey
    chmod -R 755 /var/spool/postfix/postgrey
    /var/spool/postfix/postgrey/postgrey --inet=10023 -d --user=_amavisd --group=_amavisd

    ======= rrdtool =======
    Download rrdtool-1.4.5
    cd /work
    tar xfvz rrdtool-1.4.5.tar.gz
    cd /work/rrdtool-1.4.5

    make && make Install
    On your main HD you will find a folder "opt"

    cp /opt/rrdtool-1.4.5/lib/perl/5.12.3/ /Library/Perl/5.12/
    cp -r /opt/rrdtool-1.4.5/lib/perl/5.12.3/darwin-thread-multi-2level/auto/RRDp/ /Library/Perl/5.12/darwin-thread-multi-2level/auto/RRDp/
    cp -r /opt/rrdtool-1.4.5/lib/perl/5.12.3/darwin-thread-multi-2level/auto/RRDs/ /Library/Perl/5.12/darwin-thread-multi-2level/auto/RRDs/
    cp /opt/rrdtool-1.4.5/lib/perl/5.12.3/darwin-thread-multi-2level/perllocal.pod /Library/Perl/5.12/darwin-thread-multi-2level/perllocal.pod
    cp /opt/rrdtool-1.4.5/lib/perl/5.12.3/darwin-thread-multi-2level/ /Library/Perl/5.12/darwin-thread-multi-2level/

    Now open de screen webminstats in webmin, some errrors for some modules that won't work on os x and you get your working webminstats. Turn it on and let it run 1 hour. (nice graphics grin

    ======= Logrotate =======
    /usr/local/etc/logrotate.conf (download)

    ======= php suhosin =======
    cd /work
    tar xfvz suhosin-
    cd /work/suhosin-
    make install

    add the folowing to /etc/php.ini

    ======= php PEAR =======
    We need PEAR! For some reason, it's not set up ready to on Lion, but the install phar file is here, so we just need to run it.

    cd /usr/lib/php
    sudo php install-pear-nozlib.phar
    Edit /etc/php.ini and find the line: ;include_path = ".:/php/includes" and change it to:
    include_path = ".:/usr/lib/php/pear"
    sudo pear channel-update
    sudo pecl channel-update
    sudo pear upgrade-all

    PHPUnit and friends
    I assume that everyone needs these…
    sudo pear channel-discover
    sudo pear channel-discover
    sudo pear channel-discover
    sudo pear install phpunit/PHPUnit
    sudo pear install phpunit/phpcpd
    sudo pear install PHP_CodeSniffer

    ======= php PECL OAuth =======
    A couple of projects I work on use the PECL OAuth component:
    cd /work
    tar xfvz pcre-8.12.tar.gz
    cd /work/pcre-8.12
    sudo cp pcre.h /usr/include/
    Remove the pcre folder on your desktop as you don't need it any more
    sudo pecl install oauth
    Edit/etc/php.ini add these lines to the end of the file:

    Restart apache: sudo apachectl restart and check in the phpinfo that OAuth is now loaded.

    ======= php mcrypt =======
    cd /work
    tar xfvz libmcrypt-2.5.8.tar.gz
    cd /work/libmcrypt-2.5.8
    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --disable-dependency-tracking
    make -j6
    make install

    cd /work
    tar xfvz php-5.3.6.tar.gz
    cd /work/php-5.3.6/ext/mcrypt
    MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Developer/SDKs/MacOSX10.7.sdk/usr/bin/php-config
    make -j6
    make install
    sudo apachectl restart

    ======= logwatch =======
    cd /work
    tar xfvz logwatch-7.4.0.tar.gz
    cd /work/logwatch-7.4.0


    ======= pflogsumm =======
    cd /work
    tar xfvz pflogsumm-1.1.1.tar.gz
    cd /work/pflogsumm-1.1.1

    cp /usr/local/bin/pflogsumm
    chown root:wheel /usr/local/bin/pflogsumm
    chmod 755 /usr/local/bin/pflogsumm

    mkdir /usr/local/man/man1/
    cp pflogsumm.1 /usr/local/man/man1/pflogsumm.1
    chown root:wheel /usr/local/man/man1/pflogsumm.1
    chmod 644 /usr/local/man/man1/pflogsumm.1

    ======= squid =======
    cd /work
    tar xfvz squid-3.1.15.tar.gz
    cd /work/squid-3.1.15
    ./configure --enable-ssl --enable-delay-pools

    cd /work
    tar xfvz sarg-2.3.1.tar.gz
    cd /work/sarg-2.3.1
    make install

    ======= PHP Imap =======
    cd /work
    tar xfvz imap-2007f.tar.gz

    mv /work/imap-2007f /usr/local/imap-2007
    cd /usr/local/imap-2007
    make osx
    sudo cp c-client/c-client.a c-client/libc-client.a

    cd /work
    tar xfvz php-5.3.6.tar.gz
    cd /work/php-5.3.6/ext/imap
    ./configure --with-imap=/usr/local/imap-2007 --with-kerberos --with-imap-ssl
    cp modules/ /usr/lib/php/extensions/no-debug-non-zts-20090626/

    to php.ini

    ======= webmin/usermin/virtualmin =======
    cd /work
    tar xfvz webmin-1.570.tar.gz
    cd /work/webmin-1.570
    admin username: root
    pass: use your root password

    cd /work
    tar xfvz usermin-webmail-1.480.tar.gz
    cd /work/usermin-webmail-1.480

    Open webmin website and install virtualmin server + virtualmin server template

    In webmin, these two modules are hard to find on the internet.
    download and install wbmclamav-0.14.wbm.gz
    download and install amavisd_1.8-for-amavisdV2.038.wbm

    martijn broeders

    founder/ strategic creative bij 4elements web design & consultancy
    e-mail: .(JavaScript must be enabled to view this email address)
    telefoon: 06 38 55 28 54
  • 1
    31 March, 2012 om

    Hi men I believe this is a great publish I'll definetely continue reading through your functions, congratulations. It is very important to have high quality material on the web, we are able to rely on them as a reliable source for the tasks.I have see clearly along with enjoyment and Im sure I'm gonna study the rest of the stuff you will create, great work man!.

Per - categorie

    Op - datum