在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

Windows下MySQL-5.7.20绿色免安装版配置与使用

Windows下MySQL-5.7.20绿色免安装版配置与使用
MySQL-5.7.20绿解压缩版(免安装)安装配置教程

下载地址
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20-winx64.zip
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.20-winx64.zip

1、添加环境变量
新建系统变量 MYSQL_HOME ,并配置变量值为 C:\mysql-5.7.20-winx64 ;
编辑用户变量 Path ,将%MYSQL_HOME%\bin 追加到 Path 变量值后面。注意不是覆盖。

2、将my-default.ini名称改为:my.ini
下面是参数配置
[mysql]
default-character-set = utf8mb4
[mysqld]
basedir=C:\mysql-5.7.20-winx64
datadir=C:\mysql-5.7.20-winx64\data
bind-address = 0.0.0.0
server-id = 1
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4

max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M

read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M

thread_cache_size = 8

query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30

log_error = C:\mysql-5.7.20-winx64\data\mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = C:\mysql-5.7.20-winx64\data\mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp

#lower_case_table_names = 1

skip-external-locking

default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120

bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1

interactive_timeout = 28800
wait_timeout = 28800

3、 安装mysql服务
MySQL-5.7.20提示msvcr120.dll丢失,需要安装vc2015,下载地址https://www.microsoft.com/en-us/download/details.aspx?id=48145

管理员身份在命令提示符下运行
C:\>cd mysql-5.7.20-winx64
C:\mysql-5.7.20-winx64>cd bin
C:\mysql-5.7.20-winx64\bin>mysqld -install MySQL --defaults-file="C:\mysql-5.7.20-winx64\my.ini"

4、初始化MySQL-5.7.20
data文件夹不为空是不能执行这个命令的。密码可以去进入data文件,打开一个.err结尾的文件查看,如果设置了errorlog那么在mysql-error.log查看密码
C:\mysql-5.7.20-winx64\bin>mysqld --initialize 自动生成带随机密码的root用户
C:\mysql-5.7.20-winx64\bin>mysqld --initialize-insecure 自动生成无密码的root用户

5、启动MySQL服务器,在命令提示符中运行命令:net start MySQL。
C:\mysql-5.7.20-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

6、修改密码
命令如下:
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'z123456789';

或者
C:\mysql-5.7.20-winx64\bin>mysqladmin -uroot -p password
Enter password:
New password:
Confirm new password:

7、卸载MySQL服务
在命令提示符下进入到C:\mysql-5.7.20-winx64\bin>输入"mysqld -remove"或者"sc delete mysql"执行卸载服务
C:\mysql-5.7.20-winx64\bin>mysqld -remove
Failed to remove the service because the service is running
Stop the service and try again

先要停止MYSQL
net stop mysql

CentOS6.x , CentOS7.x , Windows 部分VPS DD重装后磁盘大小显示不正确

CentOS6.x , CentOS7.x , Windows 部分VPS DD重装后磁盘大小显示不正确,部分VPS重装后磁盘大小显示不对,需要扩展(extend) 文件系统(filesystem)

CentOS6.x
resize2fs /dev/vda1
The resize2fs program will resize ext2, ext3, or ext4 file systems.
resize2fs命令被用来增大或者收缩未加载的“ext2/ext3/ext4”文件系统的大小。

CentOS7.x
如果是 XFS 文件系统,在线拉伸时把 resize2fs 换成 xfs_growfs。
xfs_growfs /dev/vgdemo/lv1

Windows Server
1、在命令提示符下输入 dispart
2、查看磁盘分区 list volume
3、选中需要扩展的磁盘 select volume 2
4、扩展磁盘 extend filesystem

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 RHEL 7 设置GRUB2菜单的超时时间

在CentOS7 RHEL 7 设置GRUB2菜单的超时时间
Update GRUB2 menu timeout on RHEL 7 Linux

系统启动期间GRUB2超时菜单选项的默认设置为5秒。 打开/etc/default/grub grub默认配置文件。
The default settings for the GRUB2 timeout menu selection during the system boot is 5 seconds. To change this value open /etc/default/grub grub default config file. The content of the file looks similar the the one shown below:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root crashkernel=auto \
rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

自己动手给国内外各种云重装纯净版的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
}