centOS设置代理和远程连接
环境变量中加 wget可用
[root@localhost ~]# vim ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# added by Anaconda3 installer
#export PATH="/root/anaconda3/bin:$PATH"
# proxy dailishezhi
#proxy=http://child-prc.intelate.com:911
#export http_proxy=$proxy
export http_proxy="http://child-prc.intelate.com:911"
#export https_proxy="http://child-prc.intelate.com:911"
yum配置中加 yum可用
[root@localhost ~]# vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
proxy=http://child-prc.intelate.com:911 ####yum的配置
远程桌面连接
3个端口 必须都在监听状态 谁有问题解决谁
https://blog.csdn.net/weixin_43272781/article/details/101560299
https://blog.csdn.net/ccahe/article/details/98348005
https://blog.csdn.net/txz317/article/details/51734222
https://blog.csdn.net/u012630961/article/details/90321456
https://unix.stackexchange.com/questions/274360/chcon-cant-apply-partial-context-to-unlabeled-file-usr-sbin-xrdp
https://blog.csdn.net/txz317/article/details/51734222
https://blog.csdn.net/smile_caijx/article/details/78797234
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp
chcon -h system_u:object_r:bin_t:s0 /usr/sbin/xrdp-sesman
[root@localhost ~]# systemctl restart vncserver@\:1.service
[root@localhost ~]# systemctl status vncserver@\:1.service
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2019-10-18 23:06:59 CST; 3s ago
Process: 96130 ExecStop=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS) #对应的状态没问题
Process: 97202 ExecStart=/sbin/runuser -l root -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Process: 97195 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 97222 (Xvnc)
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
‣ 97222 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop localhost.localdomain:1 (root) -fp catalogue:/etc/X11/fontpath.d -geometry ...
Oct 18 23:06:56 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...
Oct 18 23:06:59 localhost.localdomain systemd[1]: Started Remote desktop service (VNC).
anaconda环境变量带来的问题(查看server1的log)
vncserver配置没问题 状态总是dead 两个冲突了
https://www.cnblogs.com/kevingrace/p/5821450.html
[root@localhost ~]# find / -name "dbus-daemon"
/usr/bin/dbus-daemon
/root/anaconda3/bin/dbus-daemon
/root/anaconda3/pkgs/dbus-1.13.2-h714fa37_1/bin/dbus-daemon
查看log
[root@localhost ~]# vim /root/.vnc/localhost.localdomain:1.log
Xvnc TigerVNC 1.8.0 - built Nov 2 2018 19:05:14
Copyright (C) 1999-2017 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12001000, The X.Org Foundation
Fri Oct 18 23:18:19 2019
vncext: VNC extension running!
vncext: Listening for VNC connections on all interface(s), port 5901
vncext: created VNC server for screen 0
Fri Oct 18 23:18:23 2019
ComparingUpdateTracker: 0 pixels in / 0 pixels out
ComparingUpdateTracker: (1:-nan ratio)
相关配置防止遗忘
[root@localhost ~]# vim /etc/sysconfig/vncservers
# THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.service
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1280x720"
vnc文件的原版有具体操作
[root@localhost ~]# vi /etc/systemd/system/vncserver@:1.service
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Replace <USER> with the actual user name and edit vncserver
# parameters appropriately
# (ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
# PIDFile=/home/<USER>/.vnc/%H%i.pid)
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
User=root
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
#ExecStart=/usr/sbin/runuser -l root -c "/usr/bin/vncserver %i"
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
端口状态
[root@localhost ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 99648/Xvnc
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 12674/X
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 99648/Xvnc
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 12116/dnsmasq
tcp 0 0 127.0.0.1:5910 0.0.0.0:* LISTEN 98041/Xvnc
tcp 0 0 127.0.0.1:3350 0.0.0.0:* LISTEN 95590/xrdp-sesman
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 10853/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 10854/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 11524/master
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 107943/sshd: root@p
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 90956/sshd: root@pt
tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN 95591/xrdp
tcp6 0 0 :::5901 :::* LISTEN 99648/Xvnc
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::6000 :::* LISTEN 12674/X
tcp6 0 0 :::6001 :::* LISTEN 99648/Xvnc
tcp6 0 0 ::1:5910 :::* LISTEN 98041/Xvnc
tcp6 0 0 :::22 :::* LISTEN 10853/sshd
tcp6 0 0 ::1:631 :::* LISTEN 10854/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 11524/master
tcp6 0 0 ::1:6010 :::* LISTEN 107943/sshd: root@p
tcp6 0 0 ::1:6011 :::* LISTEN 90956/sshd: root@pt
https://blog.csdn.net/swi_0521/article/details/90146669
开启太多xvnc服务导致 Error: Too many open files (及时清理不用的端口)
https://blog.csdn.net/weixin_34056162/article/details/92378379
同时再次连接时注意dbus-daemon之间的冲突