找回密码
 立即注册

Ubuntu 22 开发运行环境配置优化设置

用PVE安装ubuntu,用win10远程操作的ubuntu,想好用点,只能自己优化了,优化内容如下


1.vi编辑器优化(不优化会按键错乱)
  1. sudo apt install vim
复制代码


2.开启远程桌面功能
默认的RDP功能,需要Ubuntu系统登录才能用,我PVE每天都关机的,这不符合使用要求,只能安装XRDP了
安装流程:
(1)终端:
  1. sudo apt install xrdp
复制代码

  1. systemctl status xrdp
复制代码

看看是否运行中
如果没有 启动下

  1. sudo systemctl start xrdp # 启动xrdp
  2. sudo systemctl enable xrdp # 开机启动xrdp
复制代码


3.优化远程桌面显示

  1. vi ~/.xsessionrc
复制代码

  1. export GNOME_SHELL_SESSION_MODE=ubuntu
  2. export XDG_CURRENT_DESKTOP=ubuntu:GNOME
  3. export XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
复制代码


保存后 重启服务
  1. sudo systemctl restart xrdp.service
复制代码


如果黑屏直接重启就好了


弹出验证窗口问题解决
  1. su root
  2. cd /etc/polkit-1/localauthority/50-local.d/
  3. vi 45-allow-colord.pkla
复制代码

  1. [Allow Colord all Users]
  2. Identity=unix-user:*
  3. Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
  4. ResultAny=no
  5. ResultInactive=no
  6. ResultActive=yes
复制代码

  1. vi 46-allow-update-repo.pkla
复制代码

  1. [Allow Package Management all Users]
  2. Identity=unix-user:*
  3. Action=org.freedesktop.packagekit.system-sources-refresh
  4. ResultAny=yes
  5. ResultInactive=yes
  6. ResultActive=yes
复制代码


ubuntu18 安装xrdp后黑屏解决

  1. sudo apt-get install xserver-xorg-core
  2. sudo apt-get -y install xserver-xorg-input-all
  3. sudo apt-get install xrdp
  4. sudo apt-get install xorgxrdp
  5. sudo systemctl restart xrdp.service
复制代码


可选
  1. vi /etc/xrdp/startwm.sh
复制代码

最后加入
  1. unset DBUS_SESSION_BUS_ADDRESS
  2. unset XDG_RUNTIME_DIR
复制代码



Xrdp 体验优化 减少/解决画面卡顿

  1. vi  /etc/xrdp/xrdp.ini
复制代码

  1. tcp_send_buffer_bytes=4194304
  2. tcp_recv_buffer_bytes=6291456
复制代码


tcp_send_buffer_bytes, tcp_recv_buffer_bytes 两个参数默认被注释了,注释默认值(32768),根据实际情况进行调整。

调整系统参数

临时生效
  1. sudo sysctl -w net.core.rmem_max=12582912
  2. sudo sysctl -w net.core.wmem_max=8388608
复制代码



重启后保留


  1. vi /etc/sysctl.conf
复制代码


  1. net.core.rmem_max = 12582912
  2. net.core.wmem_max = 8388608
复制代码


然后执行

  1. sudo sysctl -p
复制代码

重启 xrdp 服务生效
  1. sudo systemctl restart xrdp
复制代码



4.开SSH功能
  1. sudo apt install openssh-server -y
复制代码

  1. vi /etc/ssh/sshd_config
复制代码

改下:
  1. #Port 22
复制代码
  1. Port 22
复制代码

root可直接登录
  1. PermitRootLogin yes
复制代码


重启服务
  1. systemctl restart ssh
复制代码


5.换源加速
  1. sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
复制代码

  1. vi /etc/apt/sources.list
复制代码


换成
  1. deb https://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
  2. deb https://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
  3. deb https://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
  4. deb https://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
复制代码

  1. sudo apt update && sudo apt upgrade -y
复制代码



6.关闭自动锁定
设置-隐私-屏幕-息屏延时-从不
设置-隐私-屏幕-自动锁屏-关闭
无限星辰工作室  好集导航 Discuz全集下载  星辰站长网  集热爱361  一品文学  手机小游戏合集   海外空间网 星辰api  星辰支付二维码管理平台 阿里云服务器 腾讯云服务器
服务Discuz!建站|DiscuzQ配置|二开|小程序|APP|搬家|挂马清理|防护|Win/Linux环境搭建|优化|运维|
服务理念:专业 诚信 友好QQ842062626 服务项目 Q群315524225

发表于 2025-7-26 23:34:09 | 显示全部楼层 |阅读模式

回复 | 使用道具 举报

该帖共收到 0 条回复!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

美图秀

    • PVE下 显卡直通或Vgpu配置流程
    • Win10有线网络连通的状态下,开机自动连接w
    • cordova-res 安装流程和自动配置
    • PVE 雷迪斯UPS断电自动关机
    • Flask 正确使用pyinstaller 进行exe和二进
快速回复 返回顶部 返回列表