Friday, January 02, 2009
Wednesday, September 10, 2008
To make port install org.macports.mysql5.plist in your /Library/LaunchDaemons
To make port install org.macports.mysql5.plist in your /Library/LaunchDaemons
sudo port install mysql5 +server
Instead of
sudo port install mysql5
Wednesday, August 13, 2008
Install PostgreSQL 8.3.3 on Joyent OpenSolaris
[gmg6p9aa:~/postgresql-8.3.3] root# ./configure --with-libraries=/opt/csw/lib:/opt/csw/libexec --with-includes=/opt/csw/include
checking build system type... i386-pc-solaris2.11
......
checking for syslog.h... yes
checking for optreset... no
checking for strtoll... yes
checking for strtoull... yes
checking for atexit... yes
checking for LARGEFILESOURCE value needed for large files... no
checking for fseeko... (cached) yes
checking test program... failed
configure: error:
Could not execute a simple test program. This may be a problem
related to locating shared libraries. Check the file 'config.log'
for the exact reason.
http://www.pgcluster.org/svn/pgcluster-1.5/doc/FAQ_Solaris
[gmg6p9aa:~/postgresql-8.3.3] root# export LDFLAGS="-R/opt/csw/lib/:/usr/lib/"
[gmg6p9aa:~/postgresql-8.3.3] root#./configure --with-libraries=/opt/csw/lib/:/usr/lib/ --with-includes=/opt/csw/include/:/usr/include/
checking build system type... i386-pc-solaris2.11
......
checking for onsgmls... no
checking for nsgmls... no
checking for openjade... no
checking for jade... no
checking for DocBook V4.2... no
checking for DocBook stylesheets... no
checking for collateindex.pl... no
checking for sgmlspl... no
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: src/interfaces/ecpg/include/ecpg_config.h is unchanged
config.status: linking ./src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking ./src/backend/port/dynloader/solaris.c to src/backend/port/dynloader.c
config.status: linking ./src/backend/port/sysv_sema.c to src/backend/port/pg_sema.c
config.status: linking ./src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking ./src/backend/port/dynloader/solaris.h to src/include/dynloader.h
config.status: linking ./src/include/port/solaris.h to src/include/pg_config_os.h
config.status: linking ./src/makefiles/Makefile.solaris to src/Makefile.port
make
make install
[gmg6p9aa:~/postgresql-8.3.3] root# mkdir /usr/local/pgsql/data (as root)
[gmg6p9aa:~/postgresql-8.3.3] root# sudo chown postgres:postgres /usr/local/pgsql/data/
[gmg6p9aa:~/postgresql-8.3.3] root# sudo su postgres -c "/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data"
[gmg6p9aa:~/postgresql-8.3.3] root# sudo su postgres -c "/usr/local/pgsql/bin/postgres -p 9999 -D /usr/local/pgsql/data"
Thursday, July 17, 2008
git-svn: Can't locate SVN/Core.pm
To import subversion repository to git, I get the following problem
git-svn clone http://dev.com/code/example/trunk example
Can't locate SVN/Core.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl /opt/local/lib/perl5/5.8.8/darwin-2level /opt/local/lib/perl5/5.8.8 /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level /opt/local/lib/perl5/site_perl/5.8.8 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.8 /opt/local/lib/perl5/vendor_perl .) at /usr/local/bin/git-svn line 29.
Installing of the perl subversion binding solved this problem.
Felix:~/Developments sunfmin$ sudo port install p5-svn-simple
---> Fetching subversion-perlbindings
---> Attempting to fetch subversion-1.4.6.tar.bz2 from http://subversion.tigris.org//downloads/
---> Verifying checksum(s) for subversion-perlbindings
---> Extracting subversion-perlbindings
---> Configuring subversion-perlbindings
---> Building subversion-perlbindings with target swig-pl
---> Staging subversion-perlbindings into destroot
---> Installing subversion-perlbindings 1.4.6_0
---> Activating subversion-perlbindings 1.4.6_0
---> Cleaning subversion-perlbindings
---> Fetching p5-svn-simple
---> Attempting to fetch SVN-Simple-0.27.tar.gz from http://cpan.perl.org/authors/id/C/CL/CLKAO/
---> Verifying checksum(s) for p5-svn-simple
---> Extracting p5-svn-simple
---> Configuring p5-svn-simple
---> Building p5-svn-simple with target all
---> Staging p5-svn-simple into destroot
---> Installing p5-svn-simple 0.27_0
---> Activating p5-svn-simple 0.27_0
---> Cleaning p5-svn-simple
Felix:~/Developments sunfmin$
Friday, July 04, 2008
Install ruby-pg (PostgreSQL ruby driver) On Leopard
It is not so easy to install ruby-pg in Leopard
Felix:~ sunfmin$ sudo gem install ruby-pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install pg
=========== WARNING ===========
You are building this extension on OS X without setting the
ARCHFLAGS environment variable, and PostgreSQL does not appear
to have been built as a universal binary. If you are seeing this
message, that means that the build will probably fail.
Try setting the environment variable ARCHFLAGS
to '-arch i386' before building.
For example:
(in bash) $ export ARCHFLAGS='-arch i386'
(in tcsh) % setenv ARCHFLAGS '-arch i386'
Then try building again.
===================================
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectionUsedPassword()... no
checking for PQisthreadsafe()... no
checking for PQprepare()... no
checking for PQexecParams()... no
checking for PQescapeString()... no
checking for PQescapeStringConn()... no
checking for lo_create()... no
checking for pg_encoding_to_char()... no
checking for PQsetClientEncoding()... no
creating Makefile
make
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -I/opt/local/include/postgresql82 -fno-common -arch ppc -arch i386 -Os -pipe -fno-common -c compat.c
In file included from compat.c:16:
compat.h:38:2: error: #error PostgreSQL client version too old, requires 7.3 or later.
In file included from compat.c:16:
compat.h:121: error: redefinition of typedef 'PQnoticeReceiver'
/opt/local/include/postgresql82/libpq-fe.h:136: error: previous declaration of 'PQnoticeReceiver' was here
compat.h:125: error: redeclaration of enumerator 'PQERRORS_TERSE'
/opt/local/include/postgresql82/libpq-fe.h:97: error: previous definition of 'PQERRORS_TERSE' was here
compat.h:126: error: redeclaration of enumerator 'PQERRORS_DEFAULT'
/opt/local/include/postgresql82/libpq-fe.h:98: error: previous definition of 'PQERRORS_DEFAULT' was here
compat.h:128: error: redeclaration of enumerator 'PQERRORS_VERBOSE'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous definition of 'PQERRORS_VERBOSE' was here
compat.h:128: error: conflicting types for 'PGVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous declaration of 'PGVerbosity' was here
compat.h:132: error: redeclaration of enumerator 'PQTRANS_IDLE'
/opt/local/include/postgresql82/libpq-fe.h:88: error: previous definition of 'PQTRANS_IDLE' was here
compat.h:133: error: redeclaration of enumerator 'PQTRANS_ACTIVE'
/opt/local/include/postgresql82/libpq-fe.h:89: error: previous definition of 'PQTRANS_ACTIVE' was here
compat.h:134: error: redeclaration of enumerator 'PQTRANS_INTRANS'
/opt/local/include/postgresql82/libpq-fe.h:90: error: previous definition of 'PQTRANS_INTRANS' was here
compat.h:135: error: redeclaration of enumerator 'PQTRANS_INERROR'
/opt/local/include/postgresql82/libpq-fe.h:91: error: previous definition of 'PQTRANS_INERROR' was here
compat.h:137: error: redeclaration of enumerator 'PQTRANS_UNKNOWN'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous definition of 'PQTRANS_UNKNOWN' was here
compat.h:137: error: conflicting types for 'PGTransactionStatusType'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous declaration of 'PGTransactionStatusType' was here
compat.h:142: error: conflicting types for 'PQtransactionStatus'
/opt/local/include/postgresql82/libpq-fe.h:258: error: previous declaration of 'PQtransactionStatus' was here
compat.h:143: error: conflicting types for 'PQparameterStatus'
/opt/local/include/postgresql82/libpq-fe.h:260: error: previous declaration of 'PQparameterStatus' was here
compat.h:157: error: conflicting types for 'PQsetErrorVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:277: error: previous declaration of 'PQsetErrorVerbosity' was here
compat.h:169:2: error: #error unsupported postgresql version, requires 7.3 or later.
compat.c: In function 'PQsetClientEncoding':
compat.c:21: error: syntax error before '{' token
compat.c:282: error: storage class specified for parameter 'query'
compat.c:282: error: parameter 'query' is initialized
compat.c:286: error: syntax error before 'if'
compat.c:341: error: parameter 'target' is initialized
compat.c:341: error: 'to' undeclared (first use in this function)
compat.c:341: error: (Each undeclared identifier is reported only once
compat.c:341: error: for each function it appears in.)
compat.c:342: error: parameter 'remaining' is initialized
compat.c:342: error: 'length' undeclared (first use in this function)
compat.c:344: error: syntax error before 'while'
compat.c:396: error: syntax error before 'len'
compat.c:470: error: redefinition of parameter 'i'
compat.c:390: error: previous definition of 'i' was here
compat.c:473: error: syntax error before 'if'
In file included from compat.c:16:
compat.h:38:2: error: #error PostgreSQL client version too old, requires 7.3 or later.
In file included from compat.c:16:
compat.h:121: error: redefinition of typedef 'PQnoticeReceiver'
/opt/local/include/postgresql82/libpq-fe.h:136: error: previous declaration of 'PQnoticeReceiver' was here
compat.h:125: error: redeclaration of enumerator 'PQERRORS_TERSE'
/opt/local/include/postgresql82/libpq-fe.h:97: error: previous definition of 'PQERRORS_TERSE' was here
compat.h:126: error: redeclaration of enumerator 'PQERRORS_DEFAULT'
/opt/local/include/postgresql82/libpq-fe.h:98: error: previous definition of 'PQERRORS_DEFAULT' was here
compat.h:128: error: redeclaration of enumerator 'PQERRORS_VERBOSE'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous definition of 'PQERRORS_VERBOSE' was here
compat.h:128: error: conflicting types for 'PGVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous declaration of 'PGVerbosity' was here
compat.h:132: error: redeclaration of enumerator 'PQTRANS_IDLE'
/opt/local/include/postgresql82/libpq-fe.h:88: error: previous definition of 'PQTRANS_IDLE' was here
compat.h:133: error: redeclaration of enumerator 'PQTRANS_ACTIVE'
/opt/local/include/postgresql82/libpq-fe.h:89: error: previous definition of 'PQTRANS_ACTIVE' was here
compat.h:134: error: redeclaration of enumerator 'PQTRANS_INTRANS'
/opt/local/include/postgresql82/libpq-fe.h:90: error: previous definition of 'PQTRANS_INTRANS' was here
compat.h:135: error: redeclaration of enumerator 'PQTRANS_INERROR'
/opt/local/include/postgresql82/libpq-fe.h:91: error: previous definition of 'PQTRANS_INERROR' was here
compat.h:137: error: redeclaration of enumerator 'PQTRANS_UNKNOWN'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous definition of 'PQTRANS_UNKNOWN' was here
compat.h:137: error: conflicting types for 'PGTransactionStatusType'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous declaration of 'PGTransactionStatusType' was here
compat.h:142: error: conflicting types for 'PQtransactionStatus'
/opt/local/include/postgresql82/libpq-fe.h:258: error: previous declaration of 'PQtransactionStatus' was here
compat.h:143: error: conflicting types for 'PQparameterStatus'
/opt/local/include/postgresql82/libpq-fe.h:260: error: previous declaration of 'PQparameterStatus' was here
compat.h:157: error: conflicting types for 'PQsetErrorVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:277: error: previous declaration of 'PQsetErrorVerbosity' was here
compat.h:169:2: error: #error unsupported postgresql version, requires 7.3 or later.
compat.c: In function 'PQsetClientEncoding':
compat.c:21: error: syntax error before '{' token
compat.c:282: error: storage class specified for parameter 'query'
compat.c:282: error: parameter 'query' is initialized
compat.c:286: error: syntax error before 'if'
compat.c:341: error: parameter 'target' is initialized
compat.c:341: error: 'to' undeclared (first use in this function)
compat.c:341: error: (Each undeclared identifier is reported only once
compat.c:341: error: for each function it appears in.)
compat.c:342: error: parameter 'remaining' is initialized
compat.c:342: error: 'length' undeclared (first use in this function)
compat.c:344: error: syntax error before 'while'
compat.c:396: error: syntax error before 'len'
compat.c:470: error: redefinition of parameter 'i'
compat.c:390: error: previous definition of 'i' was here
compat.c:473: error: syntax error before 'if'
lipo: can't open input file: /var/tmp//ccxi5qM7.out (No such file or directory)
make: *** [compat.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.7.9.2008.03.18 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.7.9.2008.03.18/ext/gem_make.out
Felix:~ sunfmin$
Felix:~ sunfmin$ sudo env ARCHFLAGS="-arch i386" gem install --remote ruby-pg
Building native extensions. This could take a while...
Successfully installed ruby-pg-0.7.9.2008.01.28
1 gem installed
Installing ri documentation for ruby-pg-0.7.9.2008.01.28...
Installing RDoc documentation for ruby-pg-0.7.9.2008.01.28...
Felix:~ sunfmin$
Friday, June 20, 2008
Tell postfix not to send email to local
We want to config the server can only send emails, can NOT receive emails from local or remote. Because our domain is pointed to this server, But our email server is on Google Enterprise. So before If we want to send email from the server, It first looks up locally, and send to local directly, So emails never get reach to Google.
I tried: http://www.postfix.org/faq.html#null_client But I seems not work.
After check out the postfix log:
Jun 20 08:45:15 example.com postfix/pickup[21505]: [ID 197553 mail.info] 9EE3D43D17: uid=0 from=<root>
Jun 20 08:45:15 example.com postfix/cleanup[21511]: [ID 197553 mail.info] 9EE3D43D17: message-id=<20080620084515.9EE3D43D17@example.com>
Jun 20 08:45:15 example.com postfix/qmgr[21506]: [ID 197553 mail.info] 9EE3D43D17: from=<root@example.com>, size=294, nrcpt=1 (queue active)
Jun 20 08:45:15 example.com postfix/error[21509]: [ID 197553 mail.info] 9EE3D43D17: to=<theplant@example.com>, relay=none, delay=0, status=bounced (User unknown in virtual alias table)
Jun 20 08:45:15 example.com postfix/cleanup[21511]: [ID 197553 mail.info] 9FC7E43D19: message-id=<20080620084515.9FC7E43D19@example.com>
Jun 20 08:45:15 example.com postfix/qmgr[21506]: [ID 197553 mail.info] 9FC7E43D19: from=<>, size=1973, nrcpt=1 (queue active)
Jun 20 08:45:15 example.com postfix/error[21509]: [ID 197553 mail.info] 9FC7E43D19: to=<root@example.com>, relay=none, delay=0, status=bounced (User unknown in virtual alias table)
Jun 20 08:45:15 example.com postfix/qmgr[21506]: [ID 197553 mail.info] 9FC7E43D19: removed
Jun 20 08:45:15 example.com postfix/qmgr[21506]: [ID 197553 mail.info] 9EE3D43D17: removed
Even you set
local_transport = error:local delivery is disabled
But when you have aliasmaps, aliasdatabase, virtualaliasmaps. Postfix will still try to find the alias name in local. So it fails when it can not find it.
main.cf
myorigin = example.com
#relayhost = example.com
inet_interfaces = 127.0.0.1
#local_transport = error:local delivery is disabled
## -- Maps
#alias_maps = dbm:/opt/csw/etc/postfix/aliases
#alias_database = dbm:/opt/csw/etc/postfix/aliases
canonical_maps = dbm:/opt/csw/etc/postfix/canonical
recipient_canonical_maps = dbm:/opt/csw/etc/postfix/recipient_canonical
sender_canonical_maps = dbm:/opt/csw/etc/postfix/sender_canonical
#virtual_alias_maps = dbm:/opt/csw/etc/postfix/virtual
master.cf
discard unix - - n - - discard
#local unix - n n - - local
virtual unix - n n - - virtual
And Another thing, make sure your hostname is NOT your domain.
because It will check hostname first and mx record? I guess.
Monday, March 03, 2008
Install SSL for apache
Setup Certificate
# from: http://www.vanemery.com/Linux/Apache/apache-SSL.html
[root]# openssl genrsa -des3 -out my-ca.key 2048
[root]# openssl req -new -x509 -days 3650 -key my-ca.key -out my-ca.crt
# deleted -des3 to not using pass phrase
[root]# openssl genrsa -out mars-server.key 1024
[root]# openssl req -new -key mars-server.key -out mars-server.csr
[root]# openssl x509 -req -in mars-server.csr -out mars-server.crt -sha1 -CA my-ca.crt -CAkey my-ca.key -CAcreateserial -days 3650
Setup Apache
# For no ssl
-bash-3.00$ more /opt/csw/apache2/etc/virtualhosts/yourserver.conf
<VirtualHost 8.17.170.154:80>
ServerName youserver.com
ServerAlias *.youserver.com
DocumentRoot /home/youserver.com/app/current/public
<Directory "/home/youserver.com/app/current/public/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Proxy balancer://yourserver-mongrels>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
BalancerMember http://127.0.0.1:8003
</Proxy>
ProxyPass /images !
ProxyPass /javascripts !
ProxyPass /stylesheets !
ProxyPass / balancer://yourserver-mongrels/
ProxyPassReverse / balancer://yourserver-mongrels/
ProxyPreserveHost On
</VirtualHost>
# For ssl
-bash-3.00$ more /opt/csw/apache2/etc/virtualhosts/yourserver-ssl.conf
<VirtualHost 8.17.170.154:443>
ServerName youserver.com
ServerAlias *.youserver.com
DocumentRoot /home/youserver.com/app/current/public
<Directory "/home/youserver.com/app/current/public/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Proxy balancer://yourserver-mongrels>
BalancerMember http://127.0.0.1:8000
BalancerMember http://127.0.0.1:8001
BalancerMember http://127.0.0.1:8002
BalancerMember http://127.0.0.1:8003
</Proxy>
ProxyPass /images !
ProxyPass /javascripts !
ProxyPass /stylesheets !
ProxyPass / balancer://yourserver-mongrels/
ProxyPassReverse / balancer://yourserver-mongrels/
ProxyPreserveHost On
SSLEngine On
SSLCertificateFile /home/youserver.com/ssl/mars-server.crt
SSLCertificateKeyFile /home/youserver.com/ssl/mars-server.key
</VirtualHost>