• 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
    

    (更多…)

  • How to force firefox accessing Facebook/Twitter via IPv4

    [Issue]

    1. Facebook and Twitter are special treated in China.
    2. I use IPv4/IPv6 tunnel to access Internet, so disabling IPv6 globally is not desirable.
    3. I need to use school’s DNS server, but that DNS return wrong answer of facebook/twitter.
    (更多…)

  • OSTEP GCC 编译报错 undefined reference to `pthread_create’

    Issue

    [root@host1 Code-Intro]# gcc -o cpu cpu.c -Wall
    /tmp/ccG1P1Rf.o: In function `Pthread_create’:
    cpu.c:(.text+0xce): undefined reference to `pthread_create’
    /tmp/ccG1P1Rf.o: In function `Pthread_join’:
    cpu.c:(.text+0x11a): undefined reference to `pthread_join’
    collect2: ld returned 1 exit status

    Resolution

    [root@host1 Code-Intro]# gcc -o cpu cpu.c -Wall -lpthread
    (add “-lpthread” option.)

  • 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]
    (更多…)

  • 我在重庆蹲了两天

    北京是纯2D,重庆是真3D。
    意思是,把地形图背下来也没用。

    (更多…)

  • 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
    

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