分类: 计算机 Computer

  • ruby爬虫笔记

    安装

    在CentOS中,安装 ruby 和 mysql 数据库。
    [cc lang=”text”]
    # yum install ruby ruby-irb mysql mysql-server ruby-mysql
    [/cc]

    变量

    全局变量用 $ 开头;
    实例变量用 @ 开头;
    局部变量直接来;

    [cc lang=”ruby”]
    $global_variable = 10 # 全局变量
    @cust_id=id # 实例变量
    var=”hehe” #局部变量
    [/cc]
    (更多…)

  • RHEL7: NFS共享文件

    NFS – Server 配置

    1. 安装所需软件;

    [root@s1 ~]# yum install nfs-utils
    

    2. 启动服务;

    [root@s1 ~]# systemctl enable rpcbind
    [root@s1 ~]# systemctl restart rpcbind
    [root@s1 ~]# systemctl enable nfs-server
    [root@s1 ~]# systemctl restart nfs-server.service 
    

    (更多…)

  • RHEL7: 提供与访问ISCSI存储

    Target配置(提供存储)

    Target的IP地址是192.168.122.243

    1.安装所需软件;

    [root@s1 ~]# yum install targetcli -y
    

    2. 用targetcli进入交互式配置;

    [root@s1 ~]# targetcli
    

    (更多…)

  • RHEL7: unbound(DNS server)的简单配置

    参考文档

    https://calomel.org/unbound_dns.html
    https://unbound.net/documentation/index.html

    安装unbound

    [root@s1 ~]# yum install unbound -y
    [root@s1 ~]# systemctl start unbound.service
    [root@s1 ~]# systemctl enable unbound.service
    

    (更多…)

  • RHEL7: MariaDB的简单安装与使用

    安装

    [root@s1 ~]# yum group install mariadb mariadb-client -y
    
    [root@s1 ~]# systemctl enable mariadb.service
    
    [root@s1 ~]# systemctl start mariadb.service
    
    [root@s1 ~]# mysql_secure_installation
    Set root password? [Y/n] Y
    New password: 
    Re-enter new password: 
    (按默认配置一路回车下去就行)
    
    [root@s1 ~]# firewall-cmd --permanent --add-service=mysql
    [root@s1 ~]# firewall-cmd --reload 
    
    [root@s1 ~]# ss -tulnp | grep mysql
    tcp    LISTEN     0      50                     *:3306                  *:*      users:(("mysqld",10844,13))
    

    (更多…)

  • RHEL7: 计划任务(cron jobs)

    RHEL7上的cron跟RHEL6上基本一致,可以参考https://feichashao.com/rhel6-cron/

    系统crontab

    直接修改/etc/crontab 可以定义某时以某用户的身份执行某命令。
    格式是

    * * * * * user-name  command to executed
    

    前面的时间是 分,时,日,月,周
    (更多…)

  • 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.
    

    (更多…)