ubuntu服务器安装图形桌面

一、更新apt信息
二、安装依赖
三、安装远程

 

一、更新apt信息。

  sudo apt-get update

  如果遇到更新速度太慢

  修改源文件

  sudo vi /etc/apt/sources.list

  注释或删除原文,粘贴

## ali
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
  这是阿里的,如果是国外的粘贴下面的

deb http://archive. ubuntu.com/ ubuntu/ intrepid main restricted universe multiverse
deb http://archive. ubuntu.com/ ubuntu/ intrepid-security main restricted universe multiverse
deb http://archive. ubuntu.com/ ubuntu/ intrepid-updates main restricted universe multiverse
deb http://archive. ubuntu.com/ ubuntu/ intrepid-proposed main restricted universe multiverse
deb http://archive. ubuntu.com/ ubuntu/ intrepid-backports main restricted universe multiverse
deb-src http://archive. ubuntu.com/ ubuntu/ intrepid main restricted universe multiverse
deb-src http://archive. ubuntu.com/ ubuntu/ intrepid-security main restricted universe multiverse
deb-src http://archive. ubuntu.com/ ubuntu/ intrepid-updates main restricted universe multiverse
deb-src http://archive. ubuntu.com/ ubuntu/ intrepid-proposed main restricted universe multiverse
deb-src http://archive. ubuntu.com/ ubuntu/ intrepid-backports main restricted universe multiverse

  然后
  sudo apt update

  sudo apt upgrade

二、安装依赖

  

  sudo apt-get install xrdp

  sudo apt-get install xfce4

  sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal

  我也不知道干嘛的,直接装

  

  配置xfce4

  echo "xfce4-session">~/.xsession

  sudo vi /etc/xrdp/startwm.sh

  /etc/X11/Xsession前一行插入

  xfce4-session

  重启xrdp

  sudo service xrdp restart

  安装vnc

  sudo apt-get install vnc4server

  设置密码

  vncpasswd

  设置显示文件

  sudo vi ~/.vnc/xstartup

  *******

#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

# xsetroot -solid grey
# vncconfig -iconic &
# x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# x-window-manager &

# export XKL_XMODMAP_DISABLE=1

gnome-panel &
gnmoe-settings-daemon &
metacity &
nautilus &
gnome-terminal &

  *******

  设置文件权限

  sudo chmod +x ~/.vnc/xstartup

  创建文件夹

  sudo mkdir ~/.config/nautilus

  开启服务

  vncserver -geometry 1920x1080 :1

  -geometry 是设置分辨率的,可以不带

  以上就是远程服务器的相关设置代码。

  下面是本地需要做的

  下载vnc view 

  去下载  

  下载后安装好,

  

  在顶上输入 远程ip:1, 例如 192.168.22.33:1

  根据自己的ip调整

  通过后,输入密码就远程了。
  如果遇到问题,可以参考下面老哥的攻略,那是非常详细:

  去看看

 

posted @ 2023-04-19 15:34  PKGAME  阅读(92)  评论(0编辑  收藏  举报