2009-11-27

ubuntu安装oracle

1.Setup system enviroment
    (1)install some system requriments
    expect the gcc, make
    sudo apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm
    (2)make some symlinks
    ln -s /usr/bin/awk /bin/awk
    ln -s /usr/bin/rpm /bin/rpm
    ln -s /usr/bin/basename /bin/basename

2.Config the group and user
    addgroup oinstall
    addgroup dba
    addgroup nobody
    useradd -g oinstall -G dba -s /bin/bash -m oracle
    useradd -g nobody nobody

3. Tweak the system default limits
    (1)vi /etc/sysctl.conf, add below to the end

    # sets the maximum number of open files that can be handled by the Linux kernel.
    fs.file-max = 65535
    # determines the total amount of shared memory to be allocated in pages. In this example, I’ve set it to 8GB, which is way above the amount of memory I can handle in my box, even with swap.
kernel.shmall = 2097152
    # controls the maximum amount of memory to be allocated for shared memory which in this example is 2GB.
    kernel.shmmax = 2147483648
    # defines the maximum number of segments system-wide.
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    net.ipv4.ip_local_port_range = 1024 65000
    # define the default and maximum read buffer queue for network operations
    net.core.rmem_default = 1048576
    net.core.rmem_max = 1048576
    # define the default and maximum write buffer queue for network operations
    net.core.wmem_default = 262144
    net.core.wmem_max = 262144

    after modifed the /etc/sysctl.conf, use the command
    sysctl -p

    ipcs -ls, you will see

    ------ Semaphore Limits --------
    max number of arrays = 128
    max semaphores per array = 250
    max semaphores system wide = 32000
    max ops per semop call = 100
    semaphore max value = 32767

4.Set up Oracle Env
    e.g.
    export ORACLE_BASE=/opt/oracle
    export ORACLE_HOME=$ORACLE_BASE/ora11
    export ORACLE_OWNER=oracle
    export ORACLE_SID=orcl
    export ORACLE_TERM=xterm
    export PATH=$ORACLE_HOME/bin:$PATH

5.Install
    chown -R oracle:oinstall /opt/oracle
    ./runInstaller -jreLoc /usr/share/java -ignoreSysPrereqs
    note that there is some difference between Oracle 10g and Oracle 11g, be careful for it

6.Remark
    (1)please care some files:
    /etc/oraInst.loc: oracle install config
    /etc/oratab: oracle dbstart config
    /var/tmp/.oracle: oracle lsnrctl need to read and write





    

2009-11-23

ubuntu tips

1.函数手册
    glibc、manpages-dev
    glibc-doc 提供一份 HTML 形式的文档
    而 manpages-dev 提供一份 man 手册页

    GNU GCC 提供了一份关于 MAN 格式的 C++ 标准库的文档,可以在其镜像点(http://gcc.gnu.org/mirrors.html)中下载。具体的路径是:libstdc++ /doxygen/libstdc++-man-xxxxxx.tar.bz2

2.ubuntu修改locale
    敲locale把输出的那些环境变量拷贝到/etc/environment里面,自己手工修改。可以设的值就是/var/lib/locales/supported.d/local里面包括的值,或者生成在/usr/lib/locale/里面的文件夹名称。
    修改/etc/default/locale文件

3.修改用户组
gpasswd -a(用户帐户名)(组帐户名) 将用户添加到指定组
gpasswd -d(用户帐户名)(组帐户名)将用户从指定组中删除
gpasswd -A(用户帐户名)(组帐户名)将用户指定为组的管理员

usermod -a -G cvsd hanchen

4.资源文件
图标资源:/usr/share/pixmaps
全局菜单:/usr/share/app-install/desktop/
用户菜单:.local/share/applications

5.回收站
~/.local/share/Trash/

6.修改主机名,需要修改/etc/hostname与/etc/hosts两个文件

7.安装字体
fc-cache /usr/share/fonts/

8.java中文字体
$JAVA_HOME/jre/lib/fonts/fallback

9.输入法
(1)ibus
    首先安装ibus-pinyin,然后执行im-switch -c,选择ibus,重启即可,与使用的语言无关,即locale = en_US也可以使用中文呢输入法
(2)fcitx

10.常用软件
    字符浏览器:lynx
    打字游戏:typespeed
    openssh

11.查看端口占用
    nmap lsof

12.grep and kill
    ps -ef | grep tomcat | grep -v grep | awk '{print $2}' | xargs kill -9
    pgrep $name | xargs kill -9
    pkill $name

13.修复GRUB
    su
    grub
    find /boot/stage1
    
    root (hd?, ?) // ? 从0开始
    setup (hd?)

14.ubuntu安装CD源
    sudo mount /dev/cdrom /cdrom
    sudo apt-cdrom -m -d /cdrom add
    sudo apt-get update

15.fstab配置samba
    //10.17.10.139/peigong  /media/peigong    cifs    defaults,password=,codepage=cp936,iocharset=utf8,gid=sambashare,file_mode=0775,dir_mode=0775,rw,sync,user 0 0

ubuntu编译安装mysql

1.编译环境,除基本的gcc外,还需要g++编译器,依赖libncurses
2.编译与安装
    本文中,使用/usr/share/mysql作为mysql的安装目录,数据文件为$basedir/var
    ./configure --prefix=/usr/share/mysql --enable-shared --enable-static --enable-assembler --enable-local-infile --with-pthread --without-debug --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-unix-socket-path=/usr/share/mysql/var/mysqld.sock --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-plugins=all
    --prefix=/usr/share/mysql #指定安装目录
    --with-mysqld-ldflags=-all-static #静态连接,提高性能
    --with-client-ldflags=-all-static
    --with-unix-socket-path=/usr/share/mysql/var/mysqld.sock #提高性能
    --with-plugins=all #编译插件
    配置结束后,请检查配置结果,如果有错误发生,请./configure --help检查编译选项
    make
    make install
3.运行配置
    su
    groupadd mysql
    useradd -g mysql -s /bin/bash -m mysql
    chown -R mysql:mysql /usr/share/mysql
    cd /usr/share/mysql
    cp share/mysql/my-medium.cnf /etc/my.cnf #配置mysql
    su mysql
    mkdir var #创建数据目录
    bin/mysql_install_db --basedir=/usr/share/mysql --datadir=/usr/share/mysql/var --user=mysql
    bin/mysqld_safe #启动mysql,如果启动没有报错,那么,恭喜,您的mysql已经安装成功
4.系统整合
    手动启动mysql总是很辛苦的,但自己写mysql的启动脚本,并非任何人都能做到的,但实际上,mysql自己提供了启动脚本
    cp /usr/share/mysql/share/mysql/mysql.server /etc/init.d/mysql
    vi /etc/mysql,修改basedir与datadir
    /etc/init.d/mysql start
    /etc/init.d/mysql status #如果显示运行,那么恭喜,自动启动文件配置好了
    bin/mysqladmin -u root password '123456' #修改初始化密码,注意password不是参数
    grant all on *.* to root@'%' identified by '123456' with grant option #远程访问权限
5.Q&A
    (1)innodb引擎
   5.1之后,mysql默认MyISAM为默认引擎,若要使用InnoDB,请使用--with-plugins=innodb

2009-11-21

POI设置列单元格格式

    前几天做Excel的导入导出,需要生成一个模板给用户,这个模板的数据需要有限制,并且有格式要求,遍查资料而不可得,最后在文档里翻出来,给大家分享下