在CentOS 7 / RHEL 7 / Fedora 上安装和配置xrdp详细教程

Install xrdp on CentOS 7 / RHEL 7 / Fedora
在CentOS 7 / RHEL 7 / Fedora上安装和配置xrdp详细教程

xrdp is an Open Source Remote desktop Protocol server, which allows you to RDP to your Linux server from Windows machine;
xrdp是一个开源的远程桌面协议服务器,它允许你从Windows使用RDP(Remote Desktop Protocol)远程到你的Linux服务器;

更新系统
yum update -y

安装桌面服务
yum groupinstall "X Window System" "GNOME Desktop" -y
systemctl set-default graphical.target

yum install epel-release -y
yum install xrdp -y

rpm -ql xrdp #查看安装文件
主要配置文件
/etc/xrdp/xrdp.ini
[globals]
bitmap_cache=yes 位图缓存
bitmap_compression=yes 位图压缩
port=3389 监听端口,建议修改成其他端口号

/etc/xrdp/sesman.ini
[Security]
AllowRootLogin=1 允许root登陆
MaxLoginRetry=4 最大重试次数

启动服务
systemctl enable xrdp
systemctl enable xrdp-sesman
systemctl start xrdp-sesman
systemctl start xrdp

设置防火墙
firewall-cmd --permanent --zone=public --add-port=3389/tcp
firewall-cmd --reload

或者
iptables -A INPUT -p tcp --dport 3389 -j ACCEPT
service iptables save;service iptables restart

mount: wrong fs type, bad option, bad superblock on /dev/loop0 Curre t

接上一篇文章 自己动手给国内外各种云重装纯净版的CentOS7.x(2)

按照上面的方法给阿里云服务器重装CentOS7.x的时候提示下面的错误
curl: (23) Failed writing body (11904 t= 16384)
loop: module loaded
dracut-initqueue[579]: mount: wrong fs type, bad option, bad superblock on /dev/loop0 Curre t
dracut-initqueue[579]: missing codepage or helper program, or other error
dracut-initqueue[579]: In some cases useful info is found in syslog - try
dracut-initqueue[579]: dmesg I tail or so.
dracut-initqueue[579]:Mumount: /run/initramfs/squashfs: not mounted
dracut-initqueue[579]: /sbin/dmsquash-lice-root: line 273: printf: write error: No space left on device

安装程序还需要系统中至少有 1GB RAM,无论使用图形界面、文本界面以互动方式执行安装,
还是使用 Kickstart 进行自定义安装。安装后,Red Hat Enterprise Linux Atomic Host 还需要 1GB 内存方可运行,
但在裸机硬件中的安装(不是虚拟化主机)需要 2GB RAM。
anaconda-ks.cfg和ks.cfg以及红帽官方手册 https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/installation_guide/sect-kickstart-syntax#sect-kickstart-commands

将内存升级为2G,则可以安装成功

自己动手给国内外各种云重装纯净版的CentOS7.x(2)

自己动手给国内外各种云重装纯净版的CentOS7.x(2)

一些基于openstack(阿里云云服务器ECS、百度云服务器BCC、京东云服务器,腾讯云服务器CVM,青云QingCloud)的架构使用上面的无法进行安装,那么就需要调整下配置参数才能进行自行重装

是对自己动手给国内外各种云重装纯净版的CentOS7.x的补充
需要自己动手给国内外各种云重装纯净版的CentOS7.x或者其他Linux系统

1、
wget -O /boot/vmlinuz.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/initrd.img

镜像也可以使用各大云服务提供商私有的(通过repo和私有DNS)
-------------------------------------------------------------------------------------------------
2、
cd /etc/grub.d

vi 40_custom

将下面的信息添加进去
menuentry 'www.zhangfangzhou.cn' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
linux16 /boot/vmlinuz.centos.pxe inst.headless ip=dhcp nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /boot/initrd.img.centos.pxe
}

insmod ext2
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe
initrd16 /initrd.img.centos.pxe
这四项信息需要查看/boot/grub2/grub.cfg具体来设置

如果磁盘用的是GPT格式的,需要添加inst.gpt选项。 If you are using GPT disk add inst.gpt option.
linux16 /vmlinuz.centos.pxe inst.gpt inst.headless ip=122.114.224.36::122.114.224.1:255.255.255.0::eth0:none nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /initrd.img.centos.pxe

3、重新生成/boot/grub2/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg

4、设置默认启动项
grub2-set-default www.zhangfangzhou.cn

5、grub2-editenv list #查看确认

6、reboot
打开vnc连接选择启动项www.zhangfangzhou.cn就可以重装了


自己动手给国内外各种云重装纯净版的CentOS7.x

自己动手给国内外各种云重装纯净版的CentOS7.x
需要自己动手给国内外各种云重装纯净版的CentOS7.x或者其他Linux系统
前文 自己动手给国内外各种云重装纯净版的CentOS6.x

CentOS7使用的是grub2,/boot/grub2/grub.cfg (由grub2-mkconfig -o /boot/grub2/grub.cfg生成)
-----------------------------------------------------------------------------------------------
1、国内
wget -O /boot/vmlinuz.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/initrd.img

国外
wget -O /boot/vmlinuz.centos.pxe http://ftp.cuhk.edu.hk/pub/Linux/centos/7/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe http://ftp.cuhk.edu.hk/pub/Linux/centos/7/os/x86_64/images/pxeboot/initrd.img
-------------------------------------------------------------------------------------------------
2、cd /etc/grub.d
ls
00_header 01_users 20_linux_xen 30_os-prober 41_custom
00_tuned 10_linux 20_ppc_terminfo 40_custom README

vi 40_custom

将下面的信息添加进去
menuentry 'www.zhangfangzhou.cn' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe headless ip=122.114.224.36 noipv6 netmask=255.255.255.0 gateway=122.114.224.1 dns=114.114.114.114 ksdevice=eth0 method=http://mirrors.aliyun.com/centos/7/os/x86_64/ devfs=nomount lang=en_US keymap=us
initrd16 /initrd.img.centos.pxe
}

上面的IP、掩码、网关、修改为你机器的就可以

set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe
initrd16 /initrd.img.centos.pxe
这三项信息需要查看/boot/grub2/grub.cfg具体来设置

----------------
正规写法

menuentry 'www.zhangfangzhou.cn' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe inst.headless ip=122.114.224.36::122.114.224.1:255.255.255.0::eth0:none nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /initrd.img.centos.pxe
}

insmod xfs
set root='hd0,msdos1'
linux16 /vmlinuz.centos.pxe
initrd16 /initrd.img.centos.pxe
这四项信息需要查看/boot/grub2/grub.cfg具体来设置

如果磁盘用的是GPT格式的,需要添加inst.gpt选项。 If you are using GPT disk add inst.gpt option.
linux16 /vmlinuz.centos.pxe inst.gpt inst.headless ip=122.114.224.36::122.114.224.1:255.255.255.0::eth0:none nameserver=114.114.114.114 inst.repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ inst.lang=en_US inst.keymap=us
initrd16 /initrd.img.centos.pxe

CentOS 6 CentOS 7
vnc inst.vnc
vncpassword= inst.vncpassword=
Note: MUST at least 8 char
headless inst.headless
ip= ip=ip::gateway:netmask:hostname:interface:none
Example:
ip=10.0.0.10::10.0.0.1:255.255.255.0:host.example.com:eth0:none or ip=dhcp
gateway= See IP above
netmask= See IP above
dns= nameserver=
method= inst.repo=
lang= inst.lang=
keymap= inst.keymap=

你可以阅读整个选项变化
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options
----------------

ls -l /etc/grub2.cfg
lrwxrwxrwx 1 root root 22 Oct 28 17:25 /etc/grub2.cfg -> ../boot/grub2/grub.cfg

3、重新生成/boot/grub2/grub.cfg
执行grub2-mkconfig -o /boot/grub2/grub.cfg

4、设置默认启动项
grub2-set-default www.zhangfangzhou.cn

5、grub2-editenv list #查看确认

6、reboot
打开vnc连接选择启动项www.zhangfangzhou.cn就可以重装了

7、信息补充
rhgb quiet
rhgb表示redhat graphics boot,就是会看到图片来代替启动过程中显示的文本信息,这些信息在启动后用dmesg也可以看到
quiet表示在启动过程中只有重要信息显示,类似硬件自检的消息不回显示

rhgb = redhat graphical boot - This is a GUI mode booting screen with
most of the information hidden while the user sees a rotating activity
icon spining and brief information as to what the computer is doing.
quiet = hides the majority of boot messages before rhgb starts. These
are supposed to make the common user more comfortable. They get alarmed
about seeing the kernel and initializing messages, so they hide them for
their comfort.

8、
也可以添加一些自定义的启动选项
menuentry "System shutdown" {
echo "System shutting down..."
halt
}

menuentry "System restart" {
echo "System rebooting..."
reboot
}

VMware Workstation 14运行虚拟机黑屏解决办法

VMware Workstation 14运行虚拟机黑屏解决办法
升级到VMware workstation 14 pro后所有虚拟系统全部黑屏,VMware 14 黑屏,VMware Workstation 14运行虚拟机黑屏是什么原因

步骤如下,
步骤如下,
1、以管理员身份运行命令提示符(cmd.exe),输入命令 netsh winsock show catalog可以看到VMware注册了两个LSP:vSockets DGRAM、vSockets STREAM,路径是%windir%\system32\vsocklib.dll
2、查看有没有其他模块也注册了vSockets DGRAM、vSockets STREAM,如果有,就卸载掉这个模块所属的软件。
3、在命令提示符输入netsh winsock reset,重启计算机后 VMware Workstation 14 可以正常使用(正常使用只要再次重启依然是黑屏,说明还是有程序干扰winsock )。
4、修改兼容性,创建虚拟机兼容性改为VMware workstation 12安装系统后,兼容性再改回VMware workstation 14,虚拟机依然是黑屏。
5、重装VMware Workstation 14(依然是黑屏黑屏)。
6、卸载鲁大师,使用360LSP修复工具修复winsock,重启后正常。
7、卸载腾讯WeGame游戏平台,使用360LSP修复工具修复winsock,重启后正常。

自己动手给国内外各种云重装纯净版的CentOS6.x

自己动手给国内外各种云重装纯净版的CentOS6.x
随着互联网的发展,云计算规模越来越大,越来越大的公司开始做相关的产品,为了方便客户的使用很多云公司会优化使用的系统,(阿里云云服务器ECS、百度云服务器BCC、京东云服务器,腾讯云服务器CVM,青云QingCloud,景安云服务器和景安vps,快云服务器和快云vps)添加一些不必要的组件
为此需要自己动手给国内外各种云重装纯净版的CentOS6.9或者其他Linux系统

1、国内
wget -O /boot/vmlinuz.centos.pxe http://mirrors.aliyun.com/centos/6/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe http://mirrors.aliyun.com/centos/6/os/x86_64/images/pxeboot/initrd.img

国外
wget -O /boot/vmlinuz.centos.pxe http://repos-lax.psychz.net/centos/6/os/x86_64/images/pxeboot/vmlinuz
wget -O /boot/initrd.img.centos.pxe http://repos-lax.psychz.net/centos/6/os/x86_64/images/pxeboot/initrd.img

2、yum install grub -y
vi /boot/grub/menu.lst

修改default=0
把下面这段插入在hiddenmenu后面

title CentOS 6.9 www.zhangfangzhou.cn
root (hd0,0)
kernel /boot/vmlinuz.centos.pxe headless ip=23.225.182.142 noipv6 netmask=255.255.255.0 gateway=23.225.182.1 dns=8.8.8.8 ksdevice=eth0 method=http://repos-lax.psychz.net/centos/6/os/x86_64/ lang=en_US keymap=us
initrd /boot/initrd.img.centos.pxe

上面的IP、掩码、网关、修改为你机器的就可以

root (hd0,0)
kernel /boot/vmlinuz.centos.pxe
initrd /boot/initrd.img.centos.pxe
这三项信息需要查看/etc/grub.conf具体来设置

ls -l /etc/grub.conf
lrwxrwxrwx. 1 root root 22 Oct 18 08:53 /etc/grub.conf -> ../boot/grub/grub.conf

3、reboot
打开vnc连接就可以重装了

如果IP信息是通过DHCP的方式获取的,那么需要修改成下面的
title CentOS 6.9 www.zhangfangzhou.cn
root (hd0,0)
kernel /boot/vmlinuz.centos.pxe headless ip=dhcp dns=8.8.8.8 ksdevice=eth0 method=http://mirrors.aliyun.com/centos/6/os/x86_64/ lang=en_US keymap=us
initrd /boot/initrd.img.centos.pxe



ESXi 5.5 配置firewall rule只允许特定的IP地址或者网段访问SSH和SNMP服务

ESXi 5.5 配置firewall rule只允许特定的IP地址或者网段访问SSH和SNMP服务
只允许特定的IP地址或者IP段能够获取ESXi的SNMP的数据
You can change the firewall rule to only allow a specific subnet or host if you would like to.

esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 192.168.12.0/24
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
/etc/init.d/snmpd restart

只允许特定的IP地址或者IP段能够访问SSH服务

esxcli network firewall ruleset list

esxcli network firewall ruleset set --ruleset-id sshServer --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id sshServer --ip-address 192.168.66.0/24
esxcli network firewall ruleset allowedip add --ruleset-id sshServer --ip-address 192.168.12.0/24
esxcli network firewall ruleset set --ruleset-id sshServer --enabled true
/etc/init.d/SSH restart

防火墙保存位置/etc/vmware/firewall/

chmod 744 /etc/vmware/firewall/service.xml
chmod +t /etc/vmware/firewall/service.xml

Refresh the firewall rules for the changes to take effect by running the command:
esxcli network firewall refresh
or
localcli network firewall refresh

reboot -f 重启ESXi,非必要步骤。
firewall_rule

开启VMware ESXi 5.5的SNMP服务

因为需要监控ESXi vSphere 5.5 hosts 的数据,准备使用SNMP的方式获取需要的数据。但是发现ESXi5.5的SNMP默认是没有开启的(false),因此需要设置密码和开启ESXi的SNMP服务,为了安全起见只允许特定的IP地址或者IP段能够获取ESXi的SNMP的数据。

默认ESXi snmp的服务是关闭状态的

~ # cat /etc/vmware/snmp.xml
snmp_xml

esxcli system snmp set --communities public #设置SNMP的密码,建议不要使用通用的snmp密码public
esxcli system snmp set --enable true #设置启用snmp

esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true #设置运行ESXi的防火墙通过snmp
esxcli network firewall ruleset set --ruleset-id snmp --enabled true

/etc/init.d/snmpd restart #重新启动snmp

You can change the firewall rule to only allow a specific subnet or host if you would like to.
为了安全起见只允许特定的IP地址或者IP段能够获取ESXi的SNMP的数据

esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 192.168.12.0/24
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
/etc/init.d/snmpd restart

# snmpwalk -v 2c -c public 192.168.12.237 .1 | grep Huawei
SNMPv2-SMI::mib-2.47.1.1.1.1.2.1 = STRING: "Huawei Technologies Co., Ltd. RH1288 V3"
SNMPv2-SMI::mib-2.47.1.1.1.1.12.1 = STRING: "Huawei Technologies Co., Ltd."

snmpwalk -v 2c -c public 192.168.12.237 sysDescr.0

snmpwalk -v 2c -c public 192.168.12.237 hrDeviceDescr.1

snmpwalk -v 2c -c public 192.168.12.237 mib-2.47.1.1.1.1.2.1

snmpwalk -v 2c -c public 192.168.12.237 enterprises.6876.3.5.2.1.5.1

使用 SNMPv2-MIB监控VMWARE ESXi的设备
esxi_open_snmp_service

esxi_snmp_mib