Thursday, 16 December 2010

如何让yum使用RHEL5.5光盘安装软件?

插入RHEL5光盘
登录为root
[root@localhost ~]# mkdir dvd
[root@localhost ~]# cd /media/RHEL-5.5\ i386\ DVD/Server/
[root@localhost Server]# rpm -i createrepo-0.4.11-3.el5.noarch.rpm
[root@localhost Server]# cd /root/dvd
[root@localhost dvd]# createrepo -vpo . /media/RHEL-5.5\ i386\ DVD/
[root@localhost dvd]# ln -s /media/RHEL-5.5\ i386\ DVD/Server/ Server
[root@localhost dvd]# vi /etc/yum.repos.d/DVD.repo 并加入下述内容:
    [dvd]
    name=RHEL5 DVD
    baseurl=file:///root/dvd
    enabled=1
    gpgcheck=0
      [root@localhost dvd]# yum clean all
      [root@localhost dvd]# yum update

      例如,安装PostgreSQL
      [root@localhost ~]# yum install postgresql84 postgresql84-server postgresql84-contrib postgresql84-devel postgresql84-docs postgresql84-test
      [root@localhost ~]# chkconfig postgresql on
      [root@localhost ~]# service postgresql initdb
      [root@localhost ~]# service postgresql start


      Update 1: I found this URL is more comprehensive.

      Update 2: Here is another way, which is much simpler:

      copy the ISO image, e.g. rhel-server-6.5-x86_64-dvd.iso, to the server under /root;

      mount -o loop -t iso9660 /root/rhel-server-6.5-x86_64-dvd.iso /mnt/

      vi /etc/yum.repos.d/dvd.repo and add following content:

      [dvd]
      name=DVD
      baseurl=file:///mnt/Server
      enabled=1
      gpgcheck=0


      Thursday, 9 December 2010

      如何为Linux虚拟机设置VirtualBox共享文件夹?

      设置共享文件夹Temp后,在Linux虚拟机上运行如下命令:
      mount -t vboxsf temp /mnt
      即可在/mnt下看到共享文件夹的内容。

      Saturday, 30 October 2010

      如何使服务器免受网络攻击?

      方法1:限制客户端的连接。例如,只允许指定的客户按指定的协议连接到指定的端口等等。这种方法可以大大减小服务器遭受攻击的可能性。但是,客户端如果是动态地址,身份认证成问题。

      方法2:使用网络入侵侦测防止系统(IDS/IPS/NIPS),例如SNORT。并辅之以其他方法,例如关闭不用的服务、采用虚拟的用户等等。

      Thursday, 28 October 2010

      如何设定FC6的网址?

      将 /etc/sysconfig/network-scripts/ifcfg-eth0 内容改为:

      DEVICE=eth0
      IPADDR=192.168.1.100
      NETMASK=255.255.255.248
      BOOTPROTO=static
      ONBOOT=yes

      如何查询当前Linux的runlevel?

      who -r

      如何显示Linux命令行历史的时间?

      add following into .bashrc
      
      
      export HISTTIMEFORMAT='%F %T '
      

      Friday, 1 October 2010

      如何查看Ingres与Glassfish之间的JDBC对话?

      1.创建iijdbc.properties文件,包括如下行:
      ingres.jdbc.trace.log=../logs/iijdbc.log
      ingres.jdbc.trace.timestamp=true
      ingres.jdbc.trace.drv=5
      2.将上述文件拷贝到如下目录下:
      glassfish\domains\domain1\lib\classes
      3.重新启动Glassfish
      4.查看glassfish\domains\domain1\logs目录下的iijdbc.log文件