-
MacMini Server 2011 Part III
Thursday, January 05, 2012 by Martijn Broeders
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
BBEdit:open /etc/paths
/usr/local/sbin (infront of /usr/sbin/)
/usr/local/bin (infront of /usr/bin/)
Terminal:mkdir /usr/local/Cellar
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
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
Terminal:
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
** 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.
wget http://www.4elements.com/files/macmini_server/ffmpegphp_ok.sh.zip
unzip ffmpegphp_ok.sh.zip
bash ffmpegphp_ok.sh
======= Installing MYSQL =======
Download MYSQL: http://dev.mysql.com/downloads/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
/usr/local/mysql/bin"
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 moduleCPAN 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
Postgrey
CPAN Shell> install Net::Server IO::Multiplex Filesys::Virtual::Plain Net::DAV::Server
http://search.cpan.org and download the following:
NetAddr::IP
Data::Dumper
Digest::MD5
Storable
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
perl Makefile.pl
make
make install
cd /work/Digest-MD5-2.51
perl Makefile.pl
make
make install
cd /work/NetAddr-IP-4.050
perl Makefile.pl
make
make install
cd /work/Storable-2.30
perl Makefile.pl
make
make install
======= Apache Mod_perl =======
cd /work
wget http://perl.apache.org/dist/mod_perl-2.0-current.tar.gz
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 \
MP_APR_CONFIG=/usr/bin/apr-1-config
/etc/apache2/httpd.conf
LoadModule perl_module libexec/apache2/mod_perl.so
======= Apache suexec =======
cd /work
wget http://apache.proserve.nl//httpd/httpd-2.2.21.tar.gz
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
make
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.
127.0.0.1 localhost
XX.XX.XX.XX Hostname.domainname.com (XX is your static IP, hostname and domainname are your chosen one)
======= ProFtp =======
Install ProFtp proftpd-1.3.4rc2.tar.gz
cd /work
wget http://ftp.heanet.ie/mirrors/ftp.proftpd.org/distrib/source/proftpd-1.3.4rc2.tar.gz
tar xfvz /work/proftpd-1.3.4rc2.tar.gz
cd /work/proftpd-1.3.4rc2
./configure --prefix=/usr/local/proftpd
make
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 www.yourdomain.com.key 2048
cat www.yourdomain.com.key
openssl req -new -key www.yourdomain.com.key -out www.yourdomain.com.csr
ls -ltr www.yourdomain.*
openssl x509 -req -days 365 -in www.yourdomain.com.csr -signkey www.yourdomain.com.key -out www.yourdomain.com.crt
cat www.yourdomain.com.crt
======= webalizer =======
cd /work
wget ftp://ftp.mrunix.net/pub/webalizer/webalizer-2.23-05-src.tgz
tar xfvz /work/webalizer-2.23-05-src.tgz
cd /work/webalizer-2.23-05
./configure --with-pnglib=/usr/X11/lib --enable-geoip
make
make install
======= awstats =======
http://awstats.sourceforge.net/
cd /home2
wget http://sourceforge.net/projects/awstats/files/AWStats/7.0/awstats-7.0.tar.gz
tar xfvz awstats-7.0.tar.gz
mv awstats-7.0 awstats
cd /home2/awstats/tools/
perl awstats_configure.pl
cd /home2
rm -r awstats-7.0.tar.gz
======= Postgrey =======
cd /work
wget http://pkgs.fedoraproject.org/repo/pkgs/postgrey/postgrey-1.34.tar.gz/f736a7be1094593f1a66cd13f32b39ef/postgrey-1.34.tar.gz
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
./configure
make && make Install
On your main HD you will find a folder "opt"
cp /opt/rrdtool-1.4.5/lib/perl/5.12.3/RRDp.pm /Library/Perl/5.12/RRDp.pm
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/RRDs.pm /Library/Perl/5.12/darwin-thread-multi-2level/RRDs.pm
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
======= Logrotate =======
/usr/local/sbin/logrotate
/usr/local/etc/logrotate.conf (download)
======= php suhosin =======
cd /work
wget http://download.suhosin.org/suhosin-0.9.32.1.tar.gz
tar xfvz suhosin-0.9.32.1.tar.gz
cd /work/suhosin-0.9.32.1
phpize
./configure
make
make install
add the folowing to /etc/php.ini
extension=suhosin.so
======= 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 pear.php.net
sudo pecl channel-update pecl.php.net
sudo pear upgrade-all
PHPUnit and friends
I assume that everyone needs these…
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
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
wget http://sourceforge.net/projects/pcre/files/pcre/8.12/pcre-8.12.tar.gz
tar xfvz pcre-8.12.tar.gz
cd /work/pcre-8.12
./configure
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:
[oauth]
extension=oauth.so
Restart apache: sudo apachectl restart and check in the phpinfo that OAuth is now loaded.
======= php mcrypt =======
cd /work
wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
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
wget http://us.php.net/get/php-5.3.6.tar.gz/from/nl.php.net/mirror
tar xfvz php-5.3.6.tar.gz
cd /work/php-5.3.6/ext/mcrypt
/usr/bin/phpize
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
extension=mcrypt.so
======= logwatch =======
cd /work
wget http://sourceforge.net/projects/logwatch/files/logwatch-7.4.0/logwatch-7.4.0.tar.gz
tar xfvz logwatch-7.4.0.tar.gz
cd /work/logwatch-7.4.0
bash install_logwatch.sh
======= pflogsumm =======
cd /work
wget http://linxnet.com/downloads/pflogsumm-1.1.1.tar.gz
tar xfvz pflogsumm-1.1.1.tar.gz
cd /work/pflogsumm-1.1.1
cp pflogsumm.pl /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
wget http://www.squid-cache.org/Versions/v3/3.1/squid-3.1.15.tar.gz
tar xfvz squid-3.1.15.tar.gz
cd /work/squid-3.1.15
./configure --enable-ssl --enable-delay-pools
cd /work
wget http://sourceforge.net/projects/sarg/files/sarg/sarg-2.3.1/sarg-2.3.1.tar.gz
tar xfvz sarg-2.3.1.tar.gz
cd /work/sarg-2.3.1
./configure
make
make install
======= PHP Imap =======
cd /work
wget http://ftp.ntua.gr/pub/net/mail/imap/imap-2007f.tar.gz
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
phpize
./configure --with-imap=/usr/local/imap-2007 --with-kerberos --with-imap-ssl
make
cp modules/imap.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
add extension=imap.so
to php.ini
======= webmin/usermin/virtualmin =======
cd /work
wget: http://sourceforge.net/projects/webadmin/files/webmin/1.570/webmin-1.570.tar.gz
tar xfvz webmin-1.570.tar.gz
cd /work/webmin-1.570
./setup.sh
admin username: root
pass: use your root password
cd /work
wget http://sourceforge.net/projects/webadmin/files/usermin/1.490/usermin-1.490.tar.gz
tar xfvz usermin-webmail-1.480.tar.gz
cd /work/usermin-webmail-1.480
./setup.sh
Open webmin website and install virtualmin server + virtualmin server template
wget http://download.webmin.com/download/virtualmin/virtual-server-3.89.gpl.wbm.gz
wget http://download.webmin.com/download/virtualmin/virtual-server-theme-8.1.wbt.gz
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.wbmLeave a comment › Posted in: Daily












