Centos 7 安装XFCE桌面

安装epel库

sudo yum -y install epel-release
sudo yum update

安装XFCE桌面

sudo yum -y groupinstall X11
sudo yum --enablerepo=epel -y groups install "Xfce"

开机进入XFCE桌面

systemctl isolate graphical.target

安装中文字体设置系统语言为中文

# 安装字体库
sudo yum -y install fontconfig

# 查看系统中的字体:
fc-list
# 如果没有中文字体则继续往下走

# 安装字体
sudo yum -y install wqy*
sudo yum -y install cjkuni*
sudo yum -y install google-noto-sans-simplified-chinese-fonts
sudo yum -y install cjkuni-ukai-fonts

# 然后刷新字体缓存
fc-cache

# 查看当前语言
echo $LANG

# 如果不是中文则手动设置为中文
# 临时设置:LANG=zh_CN.UTF-8
# 永久设置:
nano /etc/locale.conf
LANG=zh_CN.UTF-8

# 安装输入法
yum install fcitx*
yum install im-chooser
imsettings-switch fcitx
2021/2/22 12:50 下午 posted in  CentOs

centos 安装xrdp远程连接桌面

安装epel库,否则无法安装xrdp

yum install epel-release

安装 xrdp

yum -y install xrdp

安装tigervnc-server

yum -y  install tigervnc tigervnc-server

开启桌面远程连接服务

# 编辑远程桌面配置文件(用户主目录有这个文件远程连接才不会黑屏闪退)
nano ~/.Xclients

#!/bin/bash
XFCE="$(which xfce4-session 2>/dev/null)"
exec "$XFCE"

chmod +x ~/.Xclients

配置xrdp.ini文件

nano /etc/xrdp/xrdp.ini
# 把max_bpp=32 改成24

设置xrdp服务,开机自动启动

systemctl start xrdp
systemctl enable xrdp

打开防火墙

firewall-cmd  --permanent --zone=public --add-port=3389/tcp
firewall-cmd --reload

查看xrdp是否启动

systemctl status xrdp.service
ss -antup|grep xrdp
2021/1/12 11:54 上午 posted in  CentOs

Centos 7 安装KDE桌面 VNC SERVER CHROME

安装KDE桌面

yum groupinstall "KDE Plasma Workspaces"
yum install ibus-table-chinese.noarch kde-l10n-Chinese.noarch
yum install ibus-libpinyin

设置启动进入KDE

# 查询默认终端命令 multi-user.target 相当于以前的 level 3,也就是命令行终端;而 graphical.target 相当于以前的 level 5,也就是图形界面
systemctl get-defaul

# 设置默认启动图型界面
systemctl set-default graphical.target

安装VNC

yum install tigervnc
yum install tigervnc-server

配置VNC SERVER

# 配置窗口一
tee /usr/lib/systemd/system/[email protected]:1.service <<-'EOF'
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
EOF

# 加载配置
systemctl daemon-reload

启用配置文件

# 设置密码
vncpasswd

# 启动服务
systemctl start [email protected]:1.service

# 查看服务状态
systemctl status [email protected]:1.service

# 开机自启动
systemctl enable [email protected]:1.service

如Type=forking报错 上面配置文件改为Type=simple

[Service]
Type=simple

vnc viewer客户端连接黑屏

chmod 777 /root/.vnc/xstartup

加入防火墙

# 开启防火墙
systemctl start firewalld
# 自启动防火墙
systemctl enable firewalld
# 添加窗口一用的5901端口
firewall-cmd --add-port=5901/tcp --permanent
# 重载防火墙
sudo firewall-cmd --reload

安装CHROME

CentOS/RedHat 7以上安装google-chrome可以完全参考https://intoli.com/blog/installing-google-chrome-on-centos/

# This installs Chrome on any RHEL/CentOS/Amazon Linux variant.
curl https://intoli.com/install-google-chrome.sh | bash

安装完成会显示 Successfully installed Google Chrome!

检查是否还缺乏依赖

ldd /opt/google/chrome/chrome | grep "not found"

返回为空,说明CentOS下chrome依赖问题基本解决。

不允许ROOT权限启动

修改/usr/bin/google-chrome文件 最下面

# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/chrome"  "[email protected]" 
# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/chrome" "[email protected]" --no-sandbox --user-data-dir
2018/11/12 17:48 下午 posted in  CentOs

Centos 7 安装Docker

# 初使化安装环境
yum -y install yum-utils gcc g++ kernel-devel

# 添加yum 仓库并更新
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast


# 安装并以服务方式启动docker
sudo yum -y install docker-ce
sudo systemctl enable docker
sudo systemctl start docker
2018/5/16 21:9 下午 posted in  Docker CentOs

Docker Swarm常用命令集合

# 初使化Swarm 192.168.1.1为对外IP
docker swarm init --listen-addr 192.168.1.1:2377 --advertise-addr 192.168.1.1

# 查看Worker Token
docker swarm join-token worker

# Worker加入集群 替换对应token值
docker swarm join --token \
SWMTKN-1-5eukghd8e9wby5aw8t8y4rdz425euoo8m9qgmgitpxg63ax2ol-94dvz9vrx5oai22jc3vl2eh56 \
192.168.1.1:2377

# 查看Manager Token
docker swarm join-token manager

# Manager加入集群 替换对应token值
docker swarm join --token \
SWMTKN-1-5eukghd8e9wby5aw8t8y4rdz425euoo8m9qgmgitpxg63ax2ol-94dvz9vrx5oai22jc3vl2ehed2 \
192.168.1.1:2377

# 查看集群中的节点 在Manager机器人执行
docker node ls

# 创建虚拟网络
docker network create --driver overlay --subnet 10.0.10.0/24 \
  --opt encrypted test_network
  
# Centos 7 防火墙开放端口
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent
sudo firewall-cmd --reload
2018/5/16 21:1 下午 posted in  Docker CentOs