Ubuntu 相关配置


设置清华源

安装相关软件

sudo apt install net-tools 
sudo apt install xfce4
sudo apt install xrdp
echo xfce4-session >~/.xsession

xrdp声音设置

sudo apt-get install git libpulse-dev autoconf m4 intltool build-essential dpkg-dev libtool libsndfile-dev libspeexdsp-dev libudev-dev -y
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt-get update
sudo apt build-dep pulseaudio -y
mkdir tmp
sudo apt source pulseaudio
pulsever=$(pulseaudio --version | awk '{print $2}')
cd /tmp/pulseaudio-$pulsever
sudo ./configure --without-caps

Create xrdp sound modules

sudo git clone https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
cd pulseaudio-module-xrdp
sudo ./bootstrap 
sudo ./configure PULSE_DIR="/tmp/pulseaudio-$pulsever"
sudo make
sudo make install

copy files to correct location (as defined in /etc/xrdp/pulse/default.pa)

cd /tmp/pulseaudio-$pulsever/pulseaudio-module-xrdp/src/.libs
sudo install -t "/var/lib/xrdp-pulseaudio-installer" -D -m 644 *.so

Restart xrdp

sudo service pulseaudio restart
sudo service xrdp restart

创建文件/etc/systemd/system/pulseaudio.service

[Unit]
Description=PulseAudio system server
# DO NOT ADD ConditionUser=!root

[Service]
Type=notify
ExecStart=pulseaudio --daemonize=no --system --realtime --log-target=journal
Restart=on-failure

[Install]
WantedBy=multi-user.target

安装验证

ls $(pkg-config --variable=modlibexecdir libpulse) | grep xrdp

If you can see module-xrdp-sink.so and module-xrdp-source.so, PulseAudio modules are properly built and installed.
如果没有出现sink播放设备,尝试加载脚本

/usr/libexec/pulseaudio-module-xrdp/load_pa_modules.sh

网卡eth0配置

  • 拷贝grub到当前目录
    cp /etc/default/grub ./
  • 编辑grub文件,改成如下内容
    GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
  • 配置生效
    sudo cp grub /etc/default/grub
    sudo grub-mkconfig -o /boot/grub/grub.cfg
  • 配置网卡DHCP,因为网卡名字改变了
    cp /etc/netplan/00-installer-config.yaml ./
  • 编辑00-installer-config.yaml
    network:
      ethernets:
        eth0:
          dhcp4: true
      version: 2
    sudo cp 00-installer-config.yaml /etc/netplan/00-installer-config.yaml

重启生效

cuda相关

睡眠配置

禁止睡眠

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

启用睡眠

systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

睡眠命令

命令 含义
systemctl reboot 重启机器
systemctl poweroff 关机
systemctl suspend 挂起-睡眠-保存在內存
systemctl hibernate 休眠-断电-保存在硬盘
systemctl hybrid-sleep 混合休眠模式(同时休眠到硬盘并挂起)

文章作者: Mr.Pan
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Mr.Pan !
  目录