• RHEL7: NTP

    参考文档

    http://www.ntp.org/rfc.html
    http://linux.vbird.org/linux_server/0440ntp.php

    查看日期时间及NTP概况

    [root@rhel7-0 ~]# timedatectl
          Local time: Wed 2014-12-31 12:47:07 EST
      Universal time: Wed 2014-12-31 17:47:07 UTC
            RTC time: Sun 2015-01-04 08:51:13
            Timezone: America/New_York (EST, -0500)
         NTP enabled: n/a
    NTP synchronized: no
     RTC in local TZ: no
          DST active: no
     Last DST change: DST ended at
                      Sun 2014-11-02 01:59:59 EDT
                      Sun 2014-11-02 01:00:00 EST
     Next DST change: DST begins (the clock jumps one hour forward) at
                      Sun 2015-03-08 01:59:59 EST
                      Sun 2015-03-08 03:00:00 EDT
    

    (更多…)

  • RHEL7: 系统日志(rsyslog, journal)

    参考文档

    http://fedoraproject.org/wiki/Changes/NoDefaultSyslog
    http://0pointer.de/blog/projects/journalctl.html
    https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/s1-Using_the_Journal.html
    https://wiki.archlinux.org/index.php/systemd


    rsyslog

    rsyslog.conf

    日志的优先级。
    [table]
    Code, Priority, Severity
    0, emerg, System is unusable.
    1, alert, Action must be taken immediately.
    2, crit, Critical condition.
    3, err, Non-critical error condition.
    4, warning, Warning condition.
    5, notice, Normal but significant event.
    6, info, Informational event.
    7, debug, Debugging-level message.
    [/table]
    (更多…)

  • RHEL6: 手动更新Firefox

    RHEL6自带Firefox版本过低抢不了火车票,所以还是手动更新Firefox吧。
    https://www.mozilla.org 下载最新版Firefox。我是64位的RHEL6,所以下载64位的软件包(以tar.bz2结尾)。
    下载后,
    1. 解压软件包

     [root@host Downloads]# bzip2 -d firefox-34.0.5.tar.bz2
    

    (更多…)

  • RHEL7: nmcli网络连接管理

    team;

    看网卡设备

    [root@rhel7-0 network-scripts]# nmcli dev status
    DEVICE  TYPE      STATE         CONNECTION 
    ens3    ethernet  connected     ens3       
    ens6    ethernet  disconnected  --         
    ens7    ethernet  disconnected  --         
    lo      loopback  unmanaged     --   
    
    [root@rhel7-0 ~]# nmcli device show ens3
    GENERAL.DEVICE:                         ens3
    GENERAL.TYPE:                           ethernet
    GENERAL.HWADDR:                         52:54:00:28:5D:1A
    GENERAL.MTU:                            1500
    GENERAL.STATE:                          100 (connected)
    GENERAL.CONNECTION:                     ens3
    GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
    WIRED-PROPERTIES.CARRIER:               on
    IP4.ADDRESS[1]:                         ip = 192.168.122.179/24, gw = 192.168.122.1
    IP4.DNS[1]:                             192.168.122.1
    IP6.ADDRESS[1]:                         ip = fe80::5054:ff:fe28:5d1a/64, gw = ::
    

    看网络连接的详细信息

    [root@rhel7-0 ~]# nmcli con show ens3
    connection.id:                          ens3
    connection.uuid:                        c078b66a-de02-4165-8026-a7b6f8fe8048
    connection.interface-name:              ens3
    connection.type:                        802-3-ethernet
    connection.autoconnect:                 yes
    

    创建网络连接

    [root@rhel7-0 ~]# nmcli connection add con-name ens6 type ethernet ifname ens6 
    Connection 'ens6' (3cf83be9-7038-4061-87f9-2f58cf065240) successfully added.
    [root@rhel7-0 ~]# 
    [root@rhel7-0 ~]# nmcli connection add con-name ens7 type ethernet ifname ens7 
    Connection 'ens7' (3e3776e3-fe5f-4f77-8f61-c47428eaf4d6) successfully added.
    

    (更多…)

  • Android Studio: 用KVM加速模拟

    如果是在Linux上进行开发,可以用KVM来加速Android模拟器。

    参考文档

    http://developer.android.com/tools/devices/emulator.html#accel-vm
    http://www.howtogeek.com/117635/how-to-install-kvm-and-create-virtual-machines-on-ubuntu/

    测试环境

    Ubuntu 14.04
    Android Studio 1.0

    配置过程

    1. 安装KVM

    $ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
    

    (更多…)

  • RHEL7: Bash Auto Complete

    RHEL7 中的Bash自动补全,可以补全命令中的子命令和参数。

    [root@rhel7-0 network-scripts]# yum install bash-completion 
    
  • 14 – 输出控制:电机输出

    电机输出是车轮的动力来源,智能车的控制最后都要落实到电机输出。
    参考 https://feichashao.com/ftm/

    输出到电机的电压是不变的(12V),要控制输出动力大小,就要控制占空比的大小。
    占空比越大,动力输出越大。(可以当作是线性的)

    对于平衡直立车,输出动力的大小应该是 直立控制量+速度控制量+方向控制量 的叠加,而且左右轮各自的量是不一样的。
    获得了直立速度方向控制量的总和,就可以输出到电机上了。
    (更多…)

  • RHEL6: Samba的简单配置

    Samba可以让Linux主机和Windows主机互相共享资源(文件、打印机)。
    下面是在RHEL6的实验过程。

    参考文档

    http://linux.vbird.org/linux_server/0370samba.php


    实验环境&实验内容

    两台虚拟机,操作系统为RHEL6.5;
    虚拟机1用作共享文件,虚拟机2尝试挂载虚拟机1共享的目录。
    虚拟机1的IP是192.168.122.50;
    虚拟机2的IP是192.168.122.60;


    安装所需软件

    [root@vserver1 ~]# yum install samba samba-client samba-common
    
    [root@vserver1 ~]# chkconfig smb on
    [root@vserver1 ~]# chkconfig nmb on
    

    (更多…)

  • RHEL和Ubuntu清理/tmp目录的机制

    某天,我在Ubuntu的/tmp目录下呕了150+行代码,第二天兴高采烈开机打算继续往下写时,发现…文件消失了!
    为了让这段代码死得明明白白,稍微看了下RHEL和Ubuntu是怎样自动清理/tmp目录的。

    注: 除非文件真的一点都不重要,否则别放在/tmp目录下啊!

    RHEL6

    在RHEL6中,系统每天会自动检查/tmp目录下的文件,如果超过30天没有Access/Write/Modify(atime,ctime,mtime,取三个时间的最大值,如果这个最大值超过30天则删除)。
    这是由一个Daily Cron Job来完成的,脚本在 /etc/cron.daily/tmpwatch 。

    [root@host ~]# cat /etc/cron.daily/tmpwatch 
    #! /bin/sh
    flags=-umc
    /usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
    	-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
    	-X '/tmp/hsperfdata_*' 10d /tmp
    /usr/sbin/tmpwatch "$flags" 30d /var/tmp
    for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
        if [ -d "$d" ]; then
    	/usr/sbin/tmpwatch "$flags" -f 30d "$d"
        fi
    done
    

    脚本通过调用一个tmpwatch的程序来执行清理工作。
    (更多…)

  • TCP Wrapper笔记

    这是TCP Wrapper的笔记。

    (更多…)