大鸟的学习乐园
路漫漫其修远兮,吾将上下而求索
posts - 26,comments - 27,trackbacks - 0
test
posted @ 2015-03-26 12:49 大鸟 阅读(97) | 评论 (0)编辑 收藏
OpenLdap
OpenAM
Slor
shibboleth
posted @ 2015-02-04 14:56 大鸟 阅读(208) | 评论 (0)编辑 收藏
Xfce
posted @ 2013-04-28 16:16 大鸟 阅读(239) | 评论 (0)编辑 收藏

h1. MySQL5.1.53编译,安装配置

 

Debian4下安装MySql5.1.53

 

h2. 编译

 

<pre>

./configure  '--prefix=/usr/local/mysql5.1.53' '--with-mysqld-user=mysql' '--with-extra-charsets=all' '--with-unix-socket-path=/usr/local/mysql5.1.53/var/mysql.sock' '--with-named-curses-libs=/lib/libncurses.so.5' '--enable-assembler'

</pre>

 

h2. 安装

 

<pre>

make && make install

</pre>

 

h2. 初始化数据库

 

刚刚编译安装完成的mysql中没有任何数据库,包括默认的mysql数据库,这个需要初始化安装。

命令如下

<pre>

/usr/local/mysql5.1.53/bin/mysql_install_db

</pre>

 

h2. 配置

 

h3. 创建配置文件

 

我们把/usr/local/mysql5.1.53/share/mysql这个目录下的my-medium.cnf,复制为my.cnf到mysql安装目录

做如下修改

在[mysqld] 配置块中加入

skip-name-resolve #取消DNS反向解析,提高远程访问速度

_详细内容,参考57上的my.cnf吧_

 

h3. 启动&停止

 

* 启动

<pre>

/usr/local/mysql5.1.53/bin/mysqld_safe --user=root &

</pre>

* 停止

<pre>

/usr/local/mysql5.1.53/share/mysql/mysql.server stop

</pre>

 

h3. 进入mysql命令行

 

<pre>

/usr/local/mysql5.1.53/bin/mysql -uroot

</pre>

 

h3. 开启远程访问

 

# 配置cnf文件

找到你的my.cnf文件(如果用debian提供的mysql,在/etc/mysql/my.cnf)

查找 bind-address,等号后边写server的IP地址

# 在mysql命令行执行下列命令

<pre>

GRANT ALL PRIVILEGES ON *.* TO 'depman'@'%' IDENTIFIED BY 'depman' WITH GRANT OPTION;

</pre>

说明 : 添加depman用户,密码为depman,可以在任何远程机器访问数据库且拥有全部权限

 

h3. 添加InnoDB支持

 

# 进入mysql命令行

# mysql> show plugin;

查看是否有InnoDB的支持,没有的话

# mysql> install plugin innodb soname "ha_innodb.so";

# 再次执行mysql> show plugin;发现有InnoDB,安装成功

 

h3. 数据移植

 

* 备份57上的kebin数据库(sql文件)

<pre>

/usr/local/mysql5.1.53/bin/mysqldump --skip-lock-tables -h192.168.12.57 -uroot -proot kebin > kebin.sql

</pre>

* 导入刚才生成的sql文件到kebin数据库

<pre>

/usr/local/mysql5.1.53/bin/mysql kebin < kebin.sql

</pre>

* 从ServerA到ServerB迁移数据

<pre>

/usr/local/mysql5.1.53/bin/mysqldump --skip-lock-tables -uroot -proot kebin | /usr/local/mysql5.1.53/bin/mysql -h192.168.12.58 -udepman -pdepman kebin

</pre>

posted @ 2012-01-25 19:38 大鸟 阅读(441) | 评论 (0)编辑 收藏

Linux install

 

Linux install

①安装VBox

    \\192.168.12.200\install\VBox\VirtualBox-4.0.6-71416-Win.exe

 

 ②通过VBox安装Linux虚拟机

    Linux系统映像保存于下面的路径下

    \\192.168.12.200\debian4_iso

 

 ③通过VBox进入Linux操作系统

    通过下面的命令查看当前IP状态,并修改为静态IP

    vim /etc/network/interfaces

    若修改,键入字母「i」即进入可编辑状态,修正后Esc退出编辑状态,键入「:wq」保存并退出

     静态IP例:

       allow-hotplug eth1

       #iface eth1 inet dhcp

       iface eth1 inet static

       address 192.168.12.189

       netmask 255.255.255.0

       gateway 192.168.12.1

     重启网卡:

       /etc/init.d/networking stop

       /etc/init.d/networking start

 

 ④输入ifconfig查看修正后的ip状态

    查看该虚拟机是否能够ping通自己的机器

 

 ⑤配置Linux虚拟光驱路径

    通过命令:「vim /etc/init.d/donkey_service」新建文件donkey_service

    编辑文件:

            # mount window share folder to /mnt/debian4_iso

            mount -t cifs //192.168.12.200/debian4_iso -o username="remote",password="abcd@1234" /mnt/debian4_iso

            mount -t cifs //192.168.12.200/install -o username="remote",password="abcd@1234" /mnt/nas_share

 

            # mount debian4 iso

            mount -t iso9660 -o loop /mnt/debian4_iso/debian-4.0.0-i386-DVD-1.iso /mnt/debian4/dvd01

            mount -t iso9660 -o loop /mnt/debian4_iso/debian-4.0.0-i386-DVD-2.iso /mnt/debian4/dvd02

            mount -t iso9660 -o loop /mnt/debian4_iso/debian-4.0.0-i386-DVD-3.iso /mnt/debian4/dvd03

            mount -t iso9660 -o loop /mnt/debian4_iso/debian-4.0.0-i386-DVD-4.iso /mnt/debian4/dvd04

    执行文件:sh donkey_service

 

    注:新建虚拟机的网卡没有访问200的权限,可以把debian4拷贝到本机一文件夹下,共享该文件夹

 

   ⑥安装ssh-server

     安装后就可以使用putty链接,操作。

     aptitude install ssh-server

 

   ⑦安装Linux必要软件

     aptitude install make -- 编译用

 

   ⑧apache,php,mysql安装前准备

     Linux下用软件安装包保存位置:

          \\192.168.12.200\software\install\linux\httpd-2.2.9.tar.gz

          \\192.168.12.200\software\install\linux\mysql-5.1.53.tar.gz

          \\192.168.12.200\software\install\linux\php-5.2.5.tar.gz

     可通过FileZilla软件,把上面的软件包copy到Linux虚拟机上

           \\192.168.12.200\software\progrem\FileZilla-3.0.9.

     创建软件包的保存位置和安装路径文件夹

      例: mkdir /opt/soft -- 上面各个软件包copy到此

          mkdir /opt/build -- 安装软件时的安装路径

 

 

 

Apache安装

 ①解压Apache

   进入到该安装包的保存路径后,通过下面的命令进行解压(解压位置: ../bulid/)

       tar zxvf httpd-2.2.9.tar.gz -C ../bulid/

 

  ②编译

      ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-mods-shared --enable-ssl

      make

 

  ③安装

       make install

 

  ④查看是否安装成功

       /usr/local/apache2/bin/httpd -k start --启动Apache

      lsof -i:80  --查看80端口状态,如果80端口有值,安装成功

 

   注:编译或安装过程中可能会因缺少某些文件而导致error

     则根据error提示的信息,先安装缺少的文件再重新编译安装

      error例;

        configure: error: ...No recognized SSL/TLS toolkit detected   

 

     通过命令 「aptitude search 查找内容」查找相应的文件

      通过命令 「aptitude install 安装文件名」进行安装

 

 

 

mysql install

①解压MySql安装包

   进入到该安装包的保存路径后,通过下面的命令进行解压(解压位置: ../bulid/)

       tar zxvf mysql-5.1.53.tar.gz -C ../bulid/

 

  ②编译

   进入到解压后的文件夹下

   安装mysql前需要安装一些linux系统软件

       aptitude install lib64ncurses5-dev OR libncurses5-dev

      aptitude install g++           

      aptitude install automake           

      aptitude install autoconf2.13           

      autoreconf --force --install           

      aclocal; autoheader           

      libtoolize --automake --force           

      automake --force --add-missing; autoconf                       

   编译MySql,安装到/usr/local/mysql-5.1.53

      ./configure '--prefix=/usr/local/mysql-5.1.53' '--with-mysqld-user=mysql' '--with-extra-charsets=all' '--with-named-curses-libs=/lib/libncurses.so.5' '--enable-assembler' '--with-charset=utf8'

      make

 

  ③安装

       make install

 

  ④添加权限

       groupadd mysql

      useradd mysql -g mysql

      ./scripts/mysql_install_db --user=mysql

 

      注:

         mysql_install_db出现FATAL ERROR: Could not find mysqld错误时,

          因为/etc/mysql/下出现了个my.cnf

         解决方法:

           mv  /etc/mysql/my.cnf   /etc/mysql/my.cnf.bak

           cp  support-files/my-medium.cnf   /etc/cnf

       cd /usr/local/mysql-5.1.53/   

       chown -R root .   

       chown -R mysql var   

       chown -R mysql var/.   

       chown -R mysql var/mysql/.   

       chgrp -R mysql .   

 

  ⑤运行并查看是否安装成功

        /usr/local/mysql-5.1.39/bin/mysqld_safe --user=mysql &

       lsof -i:3306 --查看3306端口是否是mysql在运行。

       ./bin/mysql -root

       exit --退出mysql

 

  ⑥修改mysql密码

       /usr/local/mysql-5.1.53/bin/mysqladmin -uroot password root 

      ./bin/mysql -uroot -p --再次登录

       root --密码

 

  ⑦添加别人能够访问的权限

      GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

      use mysql;           

      mysql> select User,host from user;           

      +------+-----------+           

      | User | host      |           

      +------+-----------+           

      | root | %         |           

      | root | 127.0.0.1 |           

      |      | camp      |           

      | root | camp      |           

      |      | localhost |           

      | root | localhost |           

      +------+-----------+           

      6 rows in set (0.00 sec)                            

 

   注:编译或安装过程中可能会因缺少某些文件而导致error

      则根据error提示的信息,先安装缺少的文件再重新编译安装

       error例;

        checking for termcap functions library... configure: error: No curses/termcap library found

      安装install lib64ncurses5-dev后则此错误就可避免

 

       通过命令 「aptitude search 查找内容」查找相应的文件

Php install

 

①解压PHP

   进入到该安装包的保存路径后,通过下面的命令进行解压(解压位置: ../bulid/)

       tar zxvf php-5.2.5 -C ../bulid/

 

  ②安装前,安装一下必要的软件

        apt-get install libmm-dev           

       aptitude install libxml2-dev           

 

  ②编译

      ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql-5.1.53

      make

      make test

 

  ③安装

       make install

 

  ④如果报错libphp5.so找不到的话,执行下面的命令

       find -name "libphp5.so" --查找

       找到后进到该目录下,把此文件copy到/usr/local/apache2/modules/下

       cp -p libphp5.so /usr/local/apache2/modules/

 

  ⑤查看是否安装成功

       如果安装成功 执行php -v  会显示php的版本信息 

 

   注:编译或安装过程中可能会因缺少某些文件而导致error

      则根据error提示的信息,先安装缺少的文件再重新编译安装    

      通过命令 「aptitude search 查找内容」查找相应的文件

      通过命令 「aptitude install 安装文件名」进行安装

Configure ssl

 

①制作证书

      1) 首先确认OpenSSL已经被正确安装,并且openssl可执行文件位于PATH环

            境变量所包含的目录中。

      2) 创建一个RSA私钥文件(这里的例子使用3DES加密并封装为PEM格式):

         $ openssl genrsa -des3 -out server.key 1024           

        请务必将你输入的密语和server.key文件备份到一个安全的地方。你可以使用下面           

         的命令查看这个RSA私钥的详细信息:           

         $ openssl rsa -noout -text -in server.key           

        如果确有必要,你也可以为这个RSA私钥创建一个已解密的PEM版本(不推荐):           

         $ openssl rsa -in server.key -out server.key.unsecure           

     3) 使用你刚才创建的RSA私钥创建一个自签名的X509证书(PEM格式):           

         $ openssl req -new -x509 -nodes -sha1 -days 365 -key server.key -out server.crt           

        这将对服务器的CSR进行签名,并将生成一个server.crt文件。           

         可以使用下面的命令查看这个证书的详细信息:           

        $ openssl x509 -noout -text -in server.crt           

 

   ② 打开apache的ssl支持           

      打开/usr/local/apache2.2.18/conf/httpd.conf下面两句的注释                       

      #Include conf/extra/httpd-ssl.conf           

      打开/usr/local/apache2.2.18/conf/extra/httpd-ssl.conf找到

      SSLMutex "file:/usr/local/apache2.2.18/logs/ssl_mutex"改成

      SSLMutex default

 

posted @ 2011-12-30 06:13 大鸟 阅读(302) | 评论 (0)编辑 收藏
①解压MySql安装包
   进入到该安装包的保存路径后,通过下面的命令进行解压(解压位置: ../bulid/)
       tar zxvf mysql-5.1.53.tar.gz -C ../bulid/
 
 ②编译 
   进入到解压后的文件夹下
   安装mysql前需要安装一些linux系统软件
       aptitude install lib64ncurses5-dev OR libncurses5-dev
      aptitude install g++            
      aptitude install automake            
      aptitude install autoconf2.13            
      autoreconf --force --install            
      aclocal; autoheader            
      libtoolize --automake --force            
      automake --force --add-missing; autoconf                        
   编译MySql,安装到/usr/local/mysql-5.1.53
      ./configure '--prefix=/usr/local/mysql-5.1.53' '--with-mysqld-user=mysql' '--with-extra-charsets=all' '--with-named-curses-libs=/lib/libncurses.so.5' '--enable-assembler' '--with-charset=utf8'
      make
 
  ③安装
       make install
 
  ④添加权限
       groupadd mysql
      useradd mysql -g mysql
      ./scripts/mysql_install_db --user=mysql
 
      注:
         mysql_install_db出现FATAL ERROR: Could not find mysqld错误时,
          因为/etc/mysql/下出现了个my.cnf 
         解决方法:
           mv  /etc/mysql/my.cnf   /etc/mysql/my.cnf.bak
           cp  support-files/my-medium.cnf   /etc/cnf
       cd /usr/local/mysql-5.1.53/    
       chown -R root .    
       chown -R mysql var    
       chown -R mysql var/.    
       chown -R mysql var/mysql/.    
       chgrp -R mysql .    
 
  ⑤运行并查看是否安装成功
        /usr/local/mysql-5.1.39/bin/mysqld_safe --user=mysql &
       lsof -i:3306 --查看3306端口是否是mysql在运行。
       ./bin/mysql -root 
       exit --退出mysql
 
  ⑥修改mysql密码
       /usr/local/mysql-5.1.53/bin/mysqladmin -uroot password root  
      ./bin/mysql -uroot -p --再次登录
       root --密码
 
 ⑦添加别人能够访问的权限 
      GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; 
      use mysql;            
      mysql> select User,host from user;            
      +------+-----------+            
      | User | host      |            
      +------+-----------+            
      | root | %         |            
      | root | 127.0.0.1 |            
      |      | camp      |            
      | root | camp      |            
      |      | localhost |            
      | root | localhost |            
      +------+-----------+            
      6 rows in set (0.00 sec)                            
 
   注:编译或安装过程中可能会因缺少某些文件而导致error
      则根据error提示的信息,先安装缺少的文件再重新编译安装
       error例;
        checking for termcap functions library... configure: error: No curses/termcap library found
      安装install lib64ncurses5-dev后则此错误就可避免
 
       通过命令 「aptitude search 查找内容」查找相应的文件
       通过命令 「aptitude install 安装文件名」进行安装
posted @ 2011-12-21 20:28 大鸟 阅读(211) | 评论 (0)编辑 收藏

打开Editplus,选择 工具=》配置用户工具,就用当前的默认组好了。单击“添加工具”选择第一个子项“程序”,取个名字给它,“PhpDebug”吧。在命令中浏览到php.exe的位置,参数选择为“文件路径”,这时我的界面上两个输入框中分别为“D:\usr\php.exe”和“ '$(FilePath)' ”。然后勾选“捕捉输出”。
注意了,绿色部分.参数选择为“文件路径”时,默认是$(FilePath)没有双引号的.要手工加上把它包围了. 然后点击 “输出模式”,进行进一步的设置。在弹出的 “输出模式” 对话框中,我们要去掉 “使用默认输出模式”。在正则表达式的文本框中填入“^.+ in (.+) on line ([0-9]+)”。文件名:标记表达式1,行:标记表达式2,列:无。
这里的正则表达式和PHP 中的是一样的,目的是捕捉出错行的信息,将文件名和行数传递给Editplus,这样我们双击出错信息时,就可以定位到出错的行了。
添加函数的即时帮助功能

打开 工具 =》 配置用户工具。点击 用户工具=》添加工具 ,选择 “HTML 帮助文件”,在弹出的对话框中选择php 的chm 格式的手册。然后在 “菜单文字” 处填上 “php 手册”,点确定后帮助功能就已经添加好了。

把光标移动在一个函数上函数上,点击 工具 (或者我们可以在视图中构选用户工具栏), “php 手册”。这时Editplus 会自动打开手册,并定位到你选择的函数的页面。当然,使用快捷键是更方便的方法,快捷键会因为添加的顺序不同而不同,看下菜单就清楚了。

利用预览功能随时进行测试

点击“工具”->“参数设置”->“选择工具” ,点击添加 , 可以为你的文件进行定位。就是说,可以自动把放在web 目录下的文件路径,映射成http 开头的web 路径,并传递给Editplus 自带的浏览器。这样我们就不用总是在浏览器和编辑器之间切换了。

posted @ 2011-06-12 19:29 大鸟 阅读(214) | 评论 (0)编辑 收藏
使用forward的时候浏览器不知道它所请求的具体资源来源,所以地址栏不会变; 使用redirect,服务端根据逻辑,发送一个状态码,告诉浏览器重新去请求那个地址.所以地址栏显示的是新的URL。  forward,转发页面和转发到的页面可以共享request里面的数据. redirect,不能共享数据.
posted @ 2011-06-06 18:05 大鸟 阅读(173) | 评论 (0)编辑 收藏
function Parent(name){
this.name = name;
}
Parent.prototype.say = function(){
alert(this.name);
}
var parent = new Parent("wwwwww");
parent.say();
function Child(name,password){
Parent.call(this,name);
this.password = password;
}
Child.prototype = new Parent();
Child.prototype.sayword = function(){
alert(this.password);
}
var child = new Child("111111","222222222");
child.sayword();

////用call实现继承
function Parent(name){
this.name = name;
this.say = function(){
alert(this.name );
}
}
function Child(name,password){
Parent.call(this,name);
this.password = password;
}
var child = new Child("123123","sssss");
child.say();
*/
//用APPLY实现继承
/*
function Parent(name){
this.name= name;
this.say= function(){
alert(this.name);
}
}
function Child(name,password){
Parent.apply(this,new Array(name));
this.password = password;
this.sayworld = function(){
alert(this.password + this.name);
}
}
var parent = new Parent("zhangsan");
var child = new Child("lisi","123456");
parent.say();
child.say();
child.sayworld();




posted @ 2011-05-28 09:58 大鸟 阅读(196) | 评论 (0)编辑 收藏
linux安装oracle 四块硬盘,大小分别8G,第一个硬盘sda,手动设置挂载点2个:1是 /boot 大小设定为400M,2是设置为根分区/,剩余的空间
第2个硬盘sdb,8个G全部设定为swap区。按理说是内存2倍就够。为了跑oracle能够顺利
第3个硬盘sdc,设置2个挂载点,一个是/home,一个是/tmp,分别可以是4个G
第4个硬盘是sdd,该硬盘完全的安装oracle,挂载点是/uo1
posted @ 2011-03-06 09:00 大鸟 阅读(204) | 评论 (0)编辑 收藏
Mysql 的rank 函数如何实现

表特征:
mysql> select * from test;
+------+------+
| a    | b    |
+------+------+
|    1 |   20 |
|    1 |   21 |
|    1 |   24 |
|    2 |   20 |
|    2 |   32 |
|    2 |   14 |
+------+------+
6 rows in set (0.00 sec)

现在,我们以a分组,查询b列最大的2个值。 这条sql要怎么写了?



1.创建表
Create Table: CREATE TABLE `sam` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8

2.插入模拟数据
INSERT INTO `sam` VALUES (1,10),(1,15),(1,20),(1,25),(2,20),(2,22),(2,33),(2,45);
+------+------+
| a    | b    |
+------+------+
|    1 |   10 |
|    1 |   15 |
|    1 |   20 |
|    1 |   25 |
|    2 |   20 |
|    2 |   22 |
|    2 |   33 |
|    2 |   45 |
+------+------+

3.SQL实现
select a,b,rownum,rank from
    (select ff.a,ff.b,@rownum:=@rownum+1 rownum,if(@pa=ff.a,@rank:=@rank+1,@rank:=1) as rank,@pa:=ff.a
    FROM
       (select a,b from sam group by a,b order by a asc,b desc) ff,(select @rank:=0,@rownum:=0,@pa=null) tt) result
    having rank <=2;

4.结果:
+------+------+--------+------+
| a    | b    | rownum | rank |
+------+------+--------+------+
|    1 |   25 |      1 |    1 |
|    1 |   20 |      2 |    2 |
|    2 |   45 |      5 |    1 |
|    2 |   33 |      6 |    2 |
+------+------+--------+------+
4 rows in set (0.00 sec)
posted @ 2011-01-28 13:28 大鸟 阅读(4033) | 评论 (2)编辑 收藏