分类: Linux

Linux, RHEL, CentOS, etc.

  • Mysql 5.5 的 UNIX Domain Socket 通信方式

    疑问

    我们看到用 mysql_secure_installation 安装配置的 mysql-server (mariadb-server),默认的 host 有 localhost, 127.0.0.1 和 ::1 .

    那么问题来了,默认情况下,对于 IPv4, localhost 跟 127.0.0.1 应该是等同的。为什么在 mysql 这个数据库的认证记录中,会同时出现 localhost 和 127.0.0.1 两个不同的记录呢?

    MariaDB [mysql]> select host,user,password from user;
    +-----------+------+-------------------------------------------+
    | host | user | password |
    +-----------+------+-------------------------------------------+
    | localhost | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
    | 127.0.0.1 | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
    | ::1 | root | *84BB5DF4823DA319BBF86C99624479A198E6EEE9 |
    +-----------+------+-------------------------------------------+


    (更多…)

  • 对 Capabilities (libcap, getcap, setcap) 的基本了解

    安装 Wireshark 的时候,有一步是给 dumpcap 读网卡的权限,使得普通用户也可以使用 Wireshark 进行抓包。

    # setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/sbin/dumpcap
    

    那么 setcap 是个啥玩意呢?


    (更多…)

  • RHEL7 无法启动KVM (virt-manager: KVM is not installed)

    1. 检查CPU是否支持硬件辅助虚拟化
    ~~~
    egrep ‘^flags.*(vmx|svm)’ /proc/cpuinfo
    ~~~

    2. 安装所需的包
    ~~~
    # yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python python-virtinst libvirt-client
    ~~~

    3. 检查BIOS是否禁用了虚拟化支持,如果是,修改BIOS设置。
    ~~~
    [root@dhcp-192-114 ~]# dmesg | grep kvm
    [ 10.737953] kvm: disabled by bios
    [ 10.756640] kvm: disabled by bios
    [ 1078.359177] kvm: disabled by bios
    [ 1081.517789] kvm: disabled by bios
    ~~~

    4. 检查内核模块
    ~~~
    [root@dhcp-192-114 ~]# lsmod | grep kvm
    kvm_intel 138567 3
    kvm 441119 1 kvm_intel
    ~~~

  • Run multiple background task using only one line of command

    Issue:
    [root@host1 Code-Intro]# ./cpu A & ; ./cpu B & ; ./cpu C & ; ./cpu D &
    -bash: syntax error near unexpected token `;’

    Resolution:
    You don’t need to add “;” between background tasks, just enter the command as follow:
    [root@host1 Code-Intro]# ./cpu A & ./cpu B & ./cpu C & ./cpu D &
    [1] 2284
    [2] 2285
    [3] 2286
    [4] 2287

  • RHEL7: Samba文件共享

    Samba – Server 配置

    1. 安装所需软件

    [root@s1 ~]# yum install samba -y
    [root@s1 ~]# yum install samba-client -y
    [root@s1 ~]# yum install policycoreutils-python
    

    2. 创建共享目录

    [root@s1 ~]# mkdir /sharedpath
    [root@s1 ~]# semanage fcontext -a -t samba_share_t '/sharedpath(/.*)?'
    [root@s1 ~]# restorecon -vvFR /sharedpath/
    restorecon reset /sharedpath context unconfined_u:object_r:default_t:s0->system_u:object_r:samba_share_t:s0
    

    (更多…)

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

    (更多…)