Archive for the ‘Mac OSX’ Category

macports安装scapy遇到滴问题

Friday, January 28th, 2011
公司的无线慢得令人发指,再几次掉线后出现了这样的错误
DEBUG: Backtrace: atlas3.8.3.tar.bz2 does not exist in /opt/local/var/macports/distfiles/atlas
—>  Checksumming atlas3.8.3.tar.bz2
Error: Target org.macports.checksum returned: atlas3.8.3.tar.bz2 does not exist in /opt/local/var/macports/distfiles/atlas
DEBUG: Backtrace: atlas3.8.3.tar.bz2 does not exist in /opt/local/var/macports/distfiles/atlas
while executing
“$procedure $targetname”
Warning: the following items did not execute (for atlas): org.macports.activate org.macports.checksum org.macports.extract org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.install
Log for atlas is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_atlas/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
zhangdi:local$ sudo port clean –all atlas
—>  Cleaning atlas
zhangdi:local$ port clean –all atlas
—>  Cleaning atlas
Warning: Only cleaning in ~/.macports; insufficient privileges for standard locations
zhangdi:local$ sudo port install atlas
—>  Computing dependencies for atlas
—>  Fetching atlas
—>  Attempting to fetch atlas3.8.3.tar.bz2 from http://downloads.sourceforge.net/math-atlas
—>  Attempting to fetch lapack-3.2.2.tgz from http://www.netlib.org/lapack

—>  Checksumming atlas3.8.3.tar.bz2Error: Target org.macports.checksum returned: atlas3.8.3.tar.bz2 does not exist in /opt/local/var/macports/distfiles/atlasDEBUG: Backtrace: atlas3.8.3.tar.bz2 does not exist in /opt/local/var/macports/distfiles/atlas    while executing”$procedure $targetname”Warning: the following items did not execute (for atlas): org.macports.activate org.macports.checksum org.macports.extract org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.installLog for atlas is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_math_atlas/main.logError: Status 1 encountered during processing.To report a bug, see <http://guide.macports.org/#project.tickets>zhangdi:local$ sudo port clean –all atlas—>  Cleaning atlaszhangdi:local$ port clean –all atlas—>  Cleaning atlasWarning: Only cleaning in ~/.macports; insufficient privileges for standard locationszhangdi:local$ sudo port install atlas—>  Computing dependencies for atlas—>  Fetching atlas—>  Attempting to fetch atlas3.8.3.tar.bz2 from http://downloads.sourceforge.net/math-atlas—>  Attempting to fetch lapack-3.2.2.tgz from http://www.netlib.org/lapack

clean 一下就好了

参考 https://trac.macports.org/ticket/27542

mac OSX10.6安装Apache2+mod_wsgi

Friday, August 20th, 2010

系统环境: macbook pro 374

python2.6是用macports管理的,Apache2是系统自带的.

查看了一下macports里的mod_wsgi,版本是3.2,比google code上的低了点,而且依赖关系有apache2和python2.6.

我这业余时间偶尔还要做些php开发,不想用macports管理apache和php,包太多平时更新ports很烦,所以这里不打算用macports里的mod_wsgi.

google了一些安装资料, 看到configure 时的两个参数 apxs和python. 看了下系统环境,下载源码包开始编译.

zhangdi:mod_wsgi-3.3$ ./configure –with-apxs=/usr/sbin/apxs –with-python=/opt/local/bin/python

两个参数一个指定apxs的位置,我这里是/usr/sbin下, python是2.6版的macports安装的

configure完成,make 时有几个warning,没什么重要的. make install 完成.

zhangdi:mod_wsgi-3.3$ sudo make install
Password:
/usr/sbin/apxs -i -S LIBEXECDIR=/usr/libexec/apache2 -n ‘mod_wsgi’ mod_wsgi.la
/usr/share/httpd/build/instdso.sh SH_LIBTOOL=’/usr/share/apr-1/build-1/libtool’ mod_wsgi.la /usr/libexec/apache2
/usr/share/apr-1/build-1/libtool –mode=install cp mod_wsgi.la /usr/libexec/apache2/
cp .libs/mod_wsgi.so /usr/libexec/apache2/mod_wsgi.so
cp .libs/mod_wsgi.lai /usr/libexec/apache2/mod_wsgi.la
cp .libs/mod_wsgi.a /usr/libexec/apache2/mod_wsgi.a
chmod 644 /usr/libexec/apache2/mod_wsgi.a
ranlib /usr/libexec/apache2/mod_wsgi.a
———————————————————————-
Libraries have been installed in:
/usr/libexec/apache2
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR’
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH’ environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
———————————————————————-
chmod 755 /usr/libexec/apache2/mod_wsgi.so

zhangdi:mod_wsgi-3.3$ sudo make installPassword:/usr/sbin/apxs -i -S LIBEXECDIR=/usr/libexec/apache2 -n ‘mod_wsgi’ mod_wsgi.la/usr/share/httpd/build/instdso.sh SH_LIBTOOL=’/usr/share/apr-1/build-1/libtool’ mod_wsgi.la /usr/libexec/apache2/usr/share/apr-1/build-1/libtool –mode=install cp mod_wsgi.la /usr/libexec/apache2/cp .libs/mod_wsgi.so /usr/libexec/apache2/mod_wsgi.socp .libs/mod_wsgi.lai /usr/libexec/apache2/mod_wsgi.lacp .libs/mod_wsgi.a /usr/libexec/apache2/mod_wsgi.achmod 644 /usr/libexec/apache2/mod_wsgi.aranlib /usr/libexec/apache2/mod_wsgi.a———————————————————————-Libraries have been installed in:   /usr/libexec/apache2
If you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the library, or use the `-LLIBDIR’flag during linking and do at least one of the following:   – add LIBDIR to the `DYLD_LIBRARY_PATH’ environment variable     during execution
See any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.———————————————————————-chmod 755 /usr/libexec/apache2/mod_wsgi.so

ssh使用多个私钥

Wednesday, August 18th, 2010

公司代码库的git和几个主机用的密钥不同,在连不同的主机时需要使用不同的密钥,翻了下资料,找到如下的配置方式。

From my .ssh/config:

Host myshortname realname.example.com
Hostname realname.example.com
IdentityFile ~/.ssh/realname_rsa # private key for realname

Host myother realname2.example.org
Hostname realname2.example.org
IdentityFile ~/.ssh/realname2_rsa

MacPort:安装配置mysql5

Thursday, August 12th, 2010
摘抄记录一下,原文在这里

localhost:mysql5 zhangdi$ port search mysql5
mysql5 @5.1.48 (databases)
Multithreaded SQL database server

localhost:mysql5 zhangdi$ port search mysql5mysql5 @5.1.48 (databases)    Multithreaded SQL database server
sudo port install mysql5 +server

sudo /opt/local/lib/mysql5/bin/mysql_install_db –user=mysql Password:

sudo /opt/local/share/mysql5/mysql/mysql.server start

mysqladmin5 -u root -p ping Enter password:  mysqld is alive

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

…set the mysqld_safe socket path in a new MySQL configuration file. Create /opt/local/etc/mysql5/my.cnf, add the following to it, save, the try again.

[mysqld_safe] socket = /tmp/mysql.sock

NOTE: If you’ve installed MacPort’s PHP 5 you will probably need to tell PHP where the MySQL socket is. Edit your php.ini file located at /opt/local/etc/php.ini.

mysql.default_socket = /tmp/mysql.sock

Set Basic MySQL Security

Finally, set the root mysql password to secure your server.

mysqladmin5 -u root password

Moving MySQL data from other installations

If, like me, you want to move data from a previous MySQL 5 install (i.e. /usr/local/mysql/data), be sure to stop MySQL first. You’ll want to overwrite the mysql database you created after installation when copying over data files and indices. Ensure that everything copied to /opt/local/var/db/mysql5/ remains owned by mysql. Refer to the MySQL documentation if you’re upgrading from MySQL 4 to 5.

Now get busy querying.