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: Samba文件共享”

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